https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112656

--- Comment #5 from Indu Bhagat <ibhagat at gcc dot gnu.org> ---
The reason for the noted difference in BTF for BPF vs non-BPF target is:

On non-BPF targets, BTF is emitted in early_finish. On BPF target however,
-mco-re is default, and hence, BTF is emitted in late finish. See
ctf_debug_early_finish:

void
ctf_debug_early_finish (const char * filename)
{
  /* Emit CTF debug info early always.  */
  if (ctf_debug_info_level > CTFINFO_LEVEL_NONE
      /* Emit BTF debug info early if CO-RE relocations are not
         required.  */
      || (btf_debuginfo_p () && !btf_with_core_debuginfo_p ()))
    ctf_debug_finalize (filename, btf_debuginfo_p ());
}

For posterity - In summary, it cannot be assumed that BTF generated for BPF
target will be same as that generated for x86_64, at least until -mco-re is the
default.

Reply via email to