[PATCH] D28956: [LLD][ELF] Add support for local symbols in Synthetic Sections
Peter Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 20 08:46:51 PST 2017
peter.smith created this revision.
Herald added a subscriber: aemerson.
A synthetic local symbol is a symbol with STB_LOCAL binding defined in a SyntheticSection. The primary use case for these symbols is to identify Thunks (When support for Thunks as synthetic sections) is added. Another use case is ARM/AArch64 mapping symbols such as $a, $t and $d. These can be added to Thunks and PLT sections to give better disassembly.
For thunks we need to create a symbol in the SyntheticSection representing the Thunk so we can retarget the relocation at it. As functions with STB_LOCAL binding can have the same name, and may need more than one range extension Thunk it simplifies the Thunk implementation if we can make the Thunk symbols have STB_LOCAL binding, and allow non-unique names.
Mapping symbols such as $a, $t and $d are helpful for the disassembler to identify which parts of the Thunk are ARM, Thumb or Data. The ABI allows mapping symbols to have a .suffix which is ignored to account for tools that can't handle non-unique names.
We can already add symbols with STB_LOCAL binding to synthetic sections by using addRegular, however we have to say IsLocal=false in the SymbolBody and we have to have a unique name. These are not fundamental restrictions to implement Thunks or MappingSymbols as in both cases we can make sure the symbol name we add is unique. However I'm not hugely keen on setting IsLocal=false, there is also potential for other SymbolTable processing treating the symbols as if they were global.
As the local symbols are added outside of SymbolTable::Symbols I've incremented NumLocals when adding a synthetic local.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 6398 bytes
Desc: not available
More information about the llvm-commits