llvm/lld/test
Fangrui Song fc0aa8424c [ELF] Check COMMON symbols for PROVIDE and don't redefine COMMON symbols edata/end/etext
In GNU ld, the definition precedence is: regular symbol assignment > relocatable object definition > `PROVIDE` symbol assignment.

GNU ld's internal linker scripts define the non-reserved (by C and C++)
edata/end/etext with `PROVIDE` so the relocatable object definition takes
precedence. This makes sense because `int end;` is valid.

We currently redefine such symbols if they are COMMON, but not if they are
regular definitions, so `int end;` with -fcommon is essentially a UB in ld.lld.
Fix this (also improve consistency and match GNU ld) by using the
`isDefined` code path for `isCommon`. In GNU ld, reserved identifiers like
`__ehdr_start` do not use `PROVIDE`, while we treat them all as `PROVIDE`, this
seems fine.

Reviewed By: peter.smith

Differential Revision: https://reviews.llvm.org/D120389
2022-02-23 10:15:42 -08:00
..
COFF Reland: Make lld-link work in a non-MSVC shell, add /winsysroot: 2022-02-16 09:22:39 -05:00
ELF [ELF] Check COMMON symbols for PROVIDE and don't redefine COMMON symbols edata/end/etext 2022-02-23 10:15:42 -08:00
MachO [lld-macho] Improve hiding of unnamed_addr symbols 2022-02-18 12:09:38 -05:00
MinGW [LLD][MinGW] Add --heap argument support 2022-01-30 00:01:45 +02:00
Unit
wasm [lld][WebAssembly] Convert a bunch more tests to asm. NFC 2022-02-18 16:30:08 -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