[LLD] [COFF] Handle undefined weak symbols in LTO (#70430)

When reading the bitcode input, undefined weak symbols will show up as
undefined symbols - which fails the early pass of checking for missing
symbols in symtab.reportUnresolvable(), before doing the actual LTO
compilation.

Mark such symbols as deferUndefined (added in
3785a413feef896e8a022731cc6ed405d5ebe81b /
https://reviews.llvm.org/D89004 for the -wrap option), to let them pass
through this LTO precheck. After the LTO compilation, the weak undefined
symbols will point towards an absolute null symbol as default.

Such weak undefined symbols are used for the TLS init function in the
Itanium C++ ABI, for TLS variables that potentially need to run a
constructor, when accessed across translation units.

This fixes https://github.com/llvm/llvm-project/issues/64513.

GitOrigin-RevId: 1d95a071d6fc43fb413a0d3f5a9d1e52a18abab0
2 files changed
tree: a5c54961697bf66920cc197af3e26c9fc1038e57
  1. cmake/
  2. COFF/
  3. Common/
  4. docs/
  5. ELF/
  6. include/
  7. MachO/
  8. MinGW/
  9. test/
  10. tools/
  11. unittests/
  12. utils/
  13. wasm/
  14. .clang-format
  15. .clang-tidy
  16. .gitignore
  17. CMakeLists.txt
  18. CODE_OWNERS.TXT
  19. LICENSE.TXT
  20. README.md
README.md

LLVM Linker (lld)

This directory and its subdirectories contain source code for the LLVM Linker, a modular cross platform linker which is built as part of the LLVM compiler infrastructure project.

lld is open source software. You may freely distribute it under the terms of the license agreement found in LICENSE.txt.

Benchmarking

In order to make sure various developers can evaluate patches over the same tests, we create a collection of self contained programs.

It is hosted at https://s3-us-west-2.amazonaws.com/linker-tests/lld-speed-test.tar.xz

The current sha256 is 10eec685463d5a8bbf08d77f4ca96282161d396c65bd97dc99dbde644a31610f.