https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106773
--- Comment #3 from David Faust <david.faust at oracle dot com> --- There are two remaining issues: 1. We are missing support for 'linkage=extern' encoding for variables, so 'bpf_link_fops' and others are incorrectly marked with 'linkage=global' instead. 2. 'bpf_link_fops' variable is encoded as 'void' type not 'const void'. This is a result of the BTF being generated from internal DWARF representation. The distinction seems to be intentionally removed in dwarf2out.cc:add_type_attribute(), with the later side-effect that looking up the type DIE for the variable when generating BTF actually fails and falls back to the default 'void'. I have an implementation for (1) in progress. For (2) I need to understand why the 'void'/'const void' distinction is removed in DWARF and how to work around it.