On Wed, Aug 28, 2024 at 04:15:03PM +0900, Masahiro Yamada wrote: > On Wed, Aug 28, 2024 at 3:50 PM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote: > > > > On Fri, Aug 16, 2024 at 2:39 AM Sami Tolvanen <samitolvanen@xxxxxxxxxx> wrote: > > > > > > The compiler may choose not to emit type information in DWARF for > > > external symbols. Clang, for example, does this for symbols not > > > defined in the current TU. > > > > > > To provide a way to work around this issue, add support for > > > __gendwarfksyms_ptr_<symbol> pointers that force the compiler to emit > > > the necessary type information in DWARF also for the missing symbols. > > > > > > Example usage: > > > > > > #define GENDWARFKSYMS_PTR(sym) \ > > > static typeof(sym) *__gendwarfksyms_ptr_##sym __used \ > > > __section(".discard.gendwarfksyms") = &sym; > > > > > > extern int external_symbol(void); > > > GENDWARFKSYMS_PTR(external_symbol); > > > > > > Signed-off-by: Sami Tolvanen <samitolvanen@xxxxxxxxxx> > > > > > > > > > > Commit ddb5cdbafaaad6b99d7007ae1740403124502d03 > > had a similar idea; it has a reference to each > > export symbol, including the ones defined in different TUs, > > but in assembly code. > > > > Didn't it suffice your need? > > > > > Presumably, this is an unfortunate duplication, but I do not have an > idea to avoid it. > > The symbol reference in assembly code works in *.S as well as *.c. > > The C reference will pull-in the debug info, but it will not work in *.S Correct. I'm not a huge fan of the extra reference either, but I don't see a cleaner way to ensure we always have all the types in DWARF. Sami