[Lldb-commits] [lldb] [lldb] Improve ELF trampoline function detection (PR #178695)
Ebuka Ezike via lldb-commits
lldb-commits at lists.llvm.org
Tue Feb 10 07:52:59 PST 2026
da-viper wrote:
> > The mold linker adds a function symbol to the symbol table (.symtab) for every shared library exported function.
>
> This sounds reasonable but is it in fact correct to do so? Doesn't sound accidental so I guess it is allowable.
>
> > I cannot think of a way to add another symbol in the trampoline's file address without linking with mold.
> > Is there a way to write a test for this ?
>
> Poorly thought out ideas:
>
> * Load the symbol from a json file https://lldb.llvm.org/use/symbolfilejson.html, this was done for a non-address bit test at some point (so that it could run on any hardware). Though this is adding symbols into lldb's own structures, not the library.
> * obj2yaml the smallest library you can get it down to, then link it with a main program just enough to be able to load into lldb. Assuming the YAML can capture that detail.
> * Terrible extension of that - compile, obj2yaml, patch the yaml, yaml2obj, link normally
> * Use llvm-objcopy (https://llvm.org/docs/CommandGuide/llvm-objcopy.html#cmdoption-llvm-objcopy-add-symbol). No idea if that'll add the type you want though.
Thanks, Went with the `llvm-objcopy` it's easier to recheck if the test fails.
https://github.com/llvm/llvm-project/pull/178695
More information about the lldb-commits
mailing list