/* Buffer the access string in the auxiliary strtab. */
bpfcr->bpfcr_astr_off = 0;
- if (accessor != NULL)
- bpfcr->bpfcr_astr_off = btf_ext_add_string (accessor);
+ gcc_assert (accessor != NULL);
+ bpfcr->bpfcr_astr_off = btf_ext_add_string (accessor);
+
bpfcr->bpfcr_type = get_btf_id (ctf_lookup_tree_type (ctfc, type));
bpfcr->bpfcr_insn_label = label;
bpfcr->bpfcr_kind = kind;
/* Core Relocation Final data */
struct cr_final
{
- char *str;
+ const char *str;
tree type;
enum btf_core_reloc_kind kind;
};
{
if (TREE_VALUE (l) == expr)
{
- ret.str = (char *) ggc_alloc_atomic ((index / 10) + 1);
- sprintf (ret.str, "%d", index);
+ char *tmp = (char *) ggc_alloc_atomic ((index / 10) + 1);
+ sprintf (tmp, "%d", index);
+ ret.str = (const char *) tmp;
+
break;
}
index++;
|| data->kind == BPF_RELO_TYPE_MATCHES);
struct cr_final ret;
- ret.str = NULL;
+ ret.str = ggc_strdup ("0");
ret.type = data->type;
ret.kind = data->kind;
/* { dg-final { scan-assembler-times "0x8\[\t \]+\[^\n\]*bpfcr_kind" 13 } } BPF_TYPE_EXISTS */
/* { dg-final { scan-assembler-times "0x9\[\t \]+\[^\n\]*bpfcr_kind" 11 } } BPF_TYPE_SIZE */
/* { dg-final { scan-assembler-times "0xc\[\t \]+\[^\n\]*bpfcr_kind" 13 } } BPF_TYPE_MATCHES */
+/* { dg-final { scan-assembler-times "bpfcr_astr_off \[(\"\]+0\[(\"\]+" 37 } } */
/* { dg-final { scan-assembler-times "0\[\t \]+\[^\n\]*bpfcr_type" 0 { xfail *-*-* } } } */
/* { dg-final { scan-assembler-times "0x6\[\t \]+\[^\n\]*bpfcr_kind" 13 } } BPF_TYPE_ID_LOCAL */
/* { dg-final { scan-assembler-times "0x7\[\t \]+\[^\n\]*bpfcr_kind" 7 } } BPF_TYPE_ID_TARGET */
+/* { dg-final { scan-assembler-times "bpfcr_astr_off \[(\"\]+0\[(\"\]+" 20 } } */