freebsd-dev/lib/clang
Dimitry Andric c3e6b9d390 Pull in r352826 from upstream lld trunk (by Fangrui Song):
[ELF] Support --{,no-}allow-shlib-undefined

  Summary:
  In ld.bfd/gold, --no-allow-shlib-undefined is the default when
  linking an executable. This patch implements a check to error on
  undefined symbols in a shared object, if all of its DT_NEEDED entries
  are seen.

  Our approach resembles the one used in gold, achieves a good balance
  to be useful but not too smart (ld.bfd traces all DSOs and emulates
  the behavior of a dynamic linker to catch more cases).

  The error is issued based on the symbol table, different from
  undefined reference errors issued for relocations. 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 undefined references and thus system libraries should be
  excluded (https://sourceware.org/bugzilla/show_bug.cgi?id=6811). The
  story may have changed now but we make --allow-shlib-undefined the
  default for now. Its interaction with -shared can be discussed in the
  future.

  Reviewers: ruiu, grimar, pcc, espindola

  Reviewed By: ruiu

  Subscribers: joerg, emaste, arichardson, llvm-commits

  Differential Revision: https://reviews.llvm.org/D57385

Pull in r352943 from upstream lld trunk (by Fangrui Song):

  [ELF] Default to --no-allow-shlib-undefined for executables

  Summary:
  This follows the ld.bfd/gold behavior.

  The error check is useful as it captures a common type of ld.so
  undefined symbol errors as link-time errors:

      // a.cc => a.so (not linked with -z defs)
      void f(); // f is undefined
      void g() { f(); }

      // b.cc => executable with a DT_NEEDED entry on a.so
      void g();
      int main() { g(); }

      // ld.so errors when g() is executed (lazy binding) or when the program is started (-z now)
      // symbol lookup error: ... undefined symbol: f

  Reviewers: ruiu, grimar, pcc, espindola

  Reviewed By: ruiu

  Subscribers: llvm-commits, emaste, arichardson

  Tags: #llvm

  Differential Revision: https://reviews.llvm.org/D57569

Together, these add support for --no-allow-shlib-undefined, and make it
the default for executables, so they will fail to link if any symbols
from needed shared libraries are undefined.

Reported by:	jbeich
PR:		236062, 236141
MFC after:	1 month
X-MFC-With:	r344779
2019-03-20 20:57:11 +00:00
..
headers Update version numbers, and regenerate config headers for llvm, clang, 2019-01-20 18:34:30 +00:00
include Pull in r352826 from upstream lld trunk (by Fangrui Song): 2019-03-20 20:57:11 +00:00
libclang Update llvm and clang build glue to make MK_CLANG_EXTRAS=yes and 2019-01-21 19:39:35 +00:00
liblldb Update lldb build glue to make MK_LLDB=yes work. 2019-01-22 18:03:45 +00:00
libllvm Add a few missed files to the MK_LLVM_TARGET_BPF=yes case, otherwise 2019-03-05 22:04:23 +00:00
libllvmminimal Merge ^/head r344178 through r344512. 2019-02-25 11:59:29 +00:00
clang.build.mk Completely revamp the way llvm, clang and lldb are built. 2016-08-26 22:44:22 +00:00
clang.pre.mk Add forgotten {llvm,clang}.pre.mk files. 2016-08-26 22:56:23 +00:00
freebsd_cc_version.h Merge llvm, clang, compiler-rt, libc++, lld, and lldb release_80 branch 2019-02-15 21:44:42 +00:00
lldb.pre.mk Centralize where LLVM_SRCS, CLANG_SRCS and LLDB_SRCS are defined. 2016-08-27 10:00:33 +00:00
llvm.build.mk Comment -DNDEBUG in head after r339436 when head was switched 2018-10-21 15:54:38 +00:00
llvm.pre.mk Use SRCTOP and OBJTOP throughout the llvm/clang/lldb build. 2016-08-27 09:29:39 +00:00
Makefile Completely revamp the way llvm, clang and lldb are built. 2016-08-26 22:44:22 +00:00
Makefile.inc Add WITH_PIE knob to build Position Independent Executables 2019-02-15 22:22:38 +00:00