[PATCH] D57385: [ELF] Support --{,no-}allow-shlib-undefined

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 29 07:24:55 PST 2019


MaskRay created this revision.
MaskRay added reviewers: ruiu, grimar, pcc.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.

In ld.bfd/gold, --no-allow-shlib-undefined is the default when linking
an executable.  If a DSO on the command line has an unresolved undefined
reference, and all of its DT_NEEDED entries are seen, a warning is
issued.

This warning is issued based on the symbol table, different from
undefined reference errors issued for relocations.

The cases warned by --allow-shlib-undefined are runtime errors (ld.so:
unknown symbol) that are really link-time problems. It is most effective
when there are DSOs that were not linked with -z,defs (e.g. when static
sanitizers runtime is used).

gold has a comment that some system libraries on GNU/Linux may have
spurious warnings and thus system libraries should be excluded.
(https://sourceware.org/bugzilla/show_bug.cgi?id=6811)
The status may have changed now but we make --allow-shlib-undefined the
default for now. Its interaction with -shared can be discussed in the
future.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D57385

Files:
  ELF/Config.h
  ELF/Driver.cpp
  ELF/InputFiles.cpp
  ELF/InputFiles.h
  ELF/Options.td
  ELF/SymbolTable.cpp
  ELF/SymbolTable.h
  ELF/Writer.cpp
  test/ELF/allow-shlib-undefined.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57385.184086.patch
Type: text/x-patch
Size: 8798 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190129/fec163cc/attachment.bin>


More information about the llvm-commits mailing list