[PATCH] D50475: ELF: Only add libcall symbols to the link if defined in bitcode.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 8 14:00:16 PDT 2018


pcc created this revision.
pcc added a reviewer: ruiu.
Herald added subscribers: jfb, dexonsmith, steven_wu, kristof.beyls, arichardson, emaste.
Herald added a reviewer: javed.absar.
Herald added a reviewer: espindola.

Adding all libcall symbols to the link can have undesired consequences.
For example, the libgcc implementation of __sync_val_compare_and_swap_8
on 32-bit ARM pulls in an .init_array entry that aborts the program if
the Linux kernel does not support 64-bit atomics, which would prevent
the program from running even if it does not use 64-bit atomics.

This change makes it so that we only add libcall symbols to the
link before LTO if we have to, i.e. if the symbol's definition is in
bitcode. Any other required libcall symbols will be added to the link
after LTO when we add the LTO object file to the link.


Repository:
  rL LLVM

https://reviews.llvm.org/D50475

Files:
  lld/ELF/Driver.cpp
  lld/ELF/Symbols.cpp
  lld/ELF/Symbols.h
  lld/test/ELF/lto/Inputs/libcall-archive.s
  lld/test/ELF/lto/libcall-archive.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50475.159787.patch
Type: text/x-patch
Size: 4364 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180808/7d0a0b11/attachment.bin>


More information about the llvm-commits mailing list