What to do with LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN?

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Oct 23 23:34:45 PDT 2013


Hi Nick,

With the recent addition of a dso symbol list to the LTO api
LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN seems redundant with it. There
seems to be three possibilities of what to do about it

One option is to keep it and move the dso list over to it. That is
instead of the linker telling LTO which symbols are for a DSO symbol
table, LLVM tells the linker which symbols can be hidden and the
linker tells LLVM which of those to keep. This is implemented in the
keep patch.

At first I thought this would the best option, since the new apis are
still not in a llvm release it would be possible to just remove the
redundancy. The probably fatal problem with this approach is that for
LLVM to tell the linker which symbols can be hidden, it has to run
analysis on the file and to do that it has to
MaterializeAllPermanently, which is quiet inefficient.

Another option is to drop it. This is implemented in drop.patch. This
is simple, but may cause some users to miss on optimizations until
they start using the dsolist.

And the last option is that if it is too early to drop it, we may as
well add a bit to it. The safe patch marks linkonce_odr unnamed_addr
symbols with LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN. This is safe
since we don't need to materialize function bodies to see the linkage
and the unnamed_addr attribute.

Cheers,
Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: keep.patch
Type: text/x-patch
Size: 21544 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131024/99c0fdf7/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: drop.patch
Type: text/x-patch
Size: 1475 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131024/99c0fdf7/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: safe.patch
Type: text/x-patch
Size: 1420 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131024/99c0fdf7/attachment-0002.bin>


More information about the llvm-commits mailing list