| Issue |
63860
|
| Summary |
CMake emits invalid linker arguments for LLD.
|
| Labels |
|
| Assignees |
|
| Reporter |
Gadal
|
This CMake block will generate `-Wl,--push-state,--as-needed,-latomic,--pop-state` if the linker is LD, Gold, LLD, or Mold:
https://github.com/llvm/llvm-project/blob/2ac99205ee1a232b8da5ec144662b29bb00ccd70/llvm/cmake/modules/CheckAtomic.cmake#L89-L90
This review appears to implement support for --push-state and --pop-state in LLD:
https://reviews.llvm.org/D47542
Nevertheless, it appears to not work (Windows, x64):
```
> clang++ -fuse-ld=lld test.cpp -Wl,--push-state,--as-needed,-lkernel32,--pop-state
lld: error: unknown argument: --push-state
lld: error: unknown argument: --pop-state
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
```
I'm using LLD version 16.0.4:
```
> ld.lld.exe --version
LLD 16.0.4 (compatible with GNU linkers)
```
I've attached a repro case (it's a .7z file; .zip couldn't get under Github's 25MB size cap):
[repro_case.zip](https://github.com/llvm/llvm-project/files/12047862/repro_case.zip)
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs