llvm-project/lld/test
Fangrui Song 3d85424096 [ELF] Parse archives as --start-lib object files
https://maskray.me/blog/2022-01-16-archives-and-start-lib

For every definition in an extracted archive member, we intern the symbol twice,
once for the archive index entry, once for the .o symbol table after extraction.
This is inefficient.

Symbols in a --start-lib ObjFile/BitcodeFile are only interned once because the
result is cached in symbols[i].

Just handle an archive using the --start-lib code path. We can therefore remove
ArchiveFile and LazyArchive. For many projects, archive member extraction ratio
is high and it is a net performance win. Linking a Release build of clang is
1.01x as fast.

Note: --start-lib scans symbols in the same order that llvm-ar adds them to the
index, so in the common case the semantics should be identical. If the archive
symbol table was created in a different order, or is incomplete, this strategy
may have different semantics. Such cases are considered user error.

The `is neither ET_REL nor LLVM bitcode` error is changed to a warning.
Previously an archive may have such members without a diagnostic. Using a
warning prevents breakage.

* For some tests, the diagnostics get improved where we did not consider
  the archive member name: `b.a:` => `b.a(b.o):`.
* `no-obj.s`: the link is now allowed, matching GNU ld
* `archive-no-index.s`: the `is neither ET_REL nor LLVM bitcode` diagnostic is
  demoted to a warning.
* `incompatible.s`: even when an archive is unextracted, we may report an
  "incompatible with" error.

---

I recently decreased sizeof(SymbolUnion) by 8 and decreased memory usage quite a
bit, so retaining `symbols` for un-extracted archive members should not cause a
memory usage problem.

Reviewed By: peter.smith

Differential Revision: https://reviews.llvm.org/D119074
2022-02-15 09:38:00 -08:00
..
COFF Revert "try to fix windows build after 73e585e44d" and 2022-02-11 23:47:53 -08:00
ELF [ELF] Parse archives as --start-lib object files 2022-02-15 09:38:00 -08:00
MachO [lld-macho] Unset ExportDynamic where possible for LTO 2022-02-11 22:26:19 -05:00
MinGW [LLD][MinGW] Add --heap argument support 2022-01-30 00:01:45 +02:00
Unit Support multi-configuration generators correctly in several config files 2021-02-11 09:32:20 -08:00
wasm [WebAssembly] Use GeneralDynamic TLS for exception handling builtins. 2022-02-14 14:08:32 -08:00
CMakeLists.txt [lld/test] List one test dep per line 2021-12-17 09:51:01 -05:00
lit.cfg.py [lld/tests] Stop setting the "asserts" and "debug" features 2022-01-05 13:39:17 -05:00
lit.site.cfg.py.in Fix lld macho standalone build by including llvm/Config/llvm-config.h instead of llvm/Config/config.h 2021-05-19 11:15:07 -04:00