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

--- Comment #1 from Jose E. Marchesi <jemarch at gcc dot gnu.org> ---
Smaller reproducer:

  static void log_event(const char *event_name, void *dev_ptr)
  {
  }

  void lala ()
  {
    log_event ("foobar", ((void *)0));
  }

Note that the FUNC_PROTO for log_event seems to be created with a name only if
the function gets inlined:

$ bpf-unknown-none-gcc -gbtf -c -O2 foo.c -o foo.o
$ bpftool btf dump file foo.o
[1] INT 'int' size=4 bits_offset=0 nr_bits=32 encoding=SIGNED
[2] FUNC_PROTO '(anon)' ret_type_id=1 vlen=0
[3] FUNC_PROTO 'log_event' ret_type_id=1 vlen=2
        'event_name' type_id=6
        'dev_ptr' type_id=7
[4] INT 'char' size=1 bits_offset=0 nr_bits=8 encoding=SIGNED
[5] CONST '(anon)' type_id=4
[6] PTR '(anon)' type_id=5
[7] PTR '(anon)' type_id=0
[8] FUNC 'lala' type_id=2 linkage=global

$ bpf-unknown-none-gcc -gbtf -c -O2 -fno-inline foo.c -o foo.o
$ /usr/sbin/bpftool btf dump file foo.o
[1] INT 'int' size=4 bits_offset=0 nr_bits=32 encoding=SIGNED
[2] FUNC_PROTO '(anon)' ret_type_id=1 vlen=0
[3] FUNC_PROTO '(anon)' ret_type_id=1 vlen=2
        'event_name' type_id=6
        'dev_ptr' type_id=7
[4] INT 'char' size=1 bits_offset=0 nr_bits=8 encoding=SIGNED
[5] CONST '(anon)' type_id=4
[6] PTR '(anon)' type_id=5
[7] PTR '(anon)' type_id=0
[8] FUNC 'lala' type_id=2 linkage=global
[9] FUNC 'log_event' type_id=3 linkage=static

Reply via email to