- insn = calloc(insn_len, 1);
- if (!insn)
- return -ENOMEM;
- insn->op = BYTECODE_OP_GET_SYMBOL;
- bytecode_reloc_offset_u32 =
- bytecode_get_len(&ctx->bytecode_reloc->b)
- + sizeof(reloc_offset);
- symbol_offset.offset =
- (uint16_t) bytecode_reloc_offset_u32;
- memcpy(insn->data, &symbol_offset,
- sizeof(symbol_offset));
- /* reloc_offset points to struct load_op */
- reloc_offset_u32 = bytecode_get_len(&ctx->bytecode->b);
- if (reloc_offset_u32 > LTTNG_FILTER_MAX_LEN - 1) {
- free(insn);
- return -EINVAL;
- }
- reloc_offset = (uint16_t) reloc_offset_u32;
- ret = bytecode_push(&ctx->bytecode, insn, 1, insn_len);
- if (ret) {
- free(insn);
- return ret;
- }
- /* append reloc */
- ret = bytecode_push(&ctx->bytecode_reloc, &reloc_offset,
- 1, sizeof(reloc_offset));
- if (ret) {
- free(insn);
- return ret;
- }
- ret = bytecode_push(&ctx->bytecode_reloc,
- op->u.symbol,
- 1, strlen(op->u.symbol) + 1);
- free(insn);