| Issue |
108971
|
| Summary |
clang refuses to pass --no-demangle to lld on aarch64-none-elf
|
| Labels |
clang,
lld
|
| Assignees |
|
| Reporter |
fruityloops1
|
With the following source:
a.cpp
```cpp
int a();
int main(){ return a(); }
```
Running the following with a `x86_64-pc-linux-gnu` host will have the expected behavior, not demangling the symbol:
```
{14:19}~ ➭ clang++ -fuse-ld=lld a.cpp -Wl,--no-demangle
ld.lld: error: undefined symbol: _Z1av
>>> referenced by a.cpp
>>> /tmp/a-0e458f.o:(main)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
{14:34}~ ➭
```
But once you switch to aarch64-none-elf:
```
{14:34}~ ➭ clang++ -fuse-ld=lld a.cpp -Wl,--no-demangle --target=aarch64-none-elf -nodefaultlibs
ld.lld: error: undefined symbol: a()
>>> referenced by a.cpp
>>> /tmp/a-89189f.o:(main)
clang++: error: ld.lld command failed with exit code 1 (use -v to see invocation)
{14:34}~ ➭
```
The -Wl,--no-demangle argument is ignored. With verbose output it can be seen that the --no-demangle argument is discarded by clang before being (not) passed to lld:
```
{14:34}~ ➭ clang++ -fuse-ld=lld a.cpp -Wl,--no-demangle --target=aarch64-none-elf -nodefaultlibs -v
clang version 18.1.8
Target: aarch64-none-unknown-elf
Thread model: posix
InstalledDir: /usr/bin
"/usr/bin/clang++" -cc1 -triple aarch64-none-unknown-elf -emit-obj -mrelax-all -dumpdir a- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name a.cpp -mrelocation-model static -mframe-pointer=non-leaf -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -nostdsysteminc -target-cpu generic -target-feature +v8a -target-feature +fp-armv8 -target-feature +neon -target-abi aapcs -debugger-tuning=gdb -fdebug-compilation-dir=/home/nala -v -fcoverage-compilation-dir=/home/nala -resource-dir /usr/lib/clang/18 -internal-isystem /usr/bin/../lib/clang-runtimes/aarch64-none-elf/include/c++/v1 -internal-isystem /usr/lib/clang/18/include -internal-isystem /usr/bin/../lib/clang-runtimes/aarch64-none-elf/include -fdeprecated-macro -ferror-limit 19 -fno-signed-char -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/a-c3607f.o -x c++ a.cpp
clang -cc1 version 18.1.8 based upon LLVM 18.1.8 default target x86_64-pc-linux-gnu
ignoring nonexistent directory "/usr/bin/../lib/clang-runtimes/aarch64-none-elf/include/c++/v1"
ignoring nonexistent directory "/usr/bin/../lib/clang-runtimes/aarch64-none-elf/include"
ignoring duplicate directory "/usr/lib/clang/18/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/clang/18/include
End of search list.
"/usr/bin/ld.lld" /tmp/a-c3607f.o -Bstatic -EL -L/usr/bin/../lib/clang-runtimes/aarch64-none-elf/lib -L/usr/bin/../lib/clang-runtimes/aarch64-none-elf/lib -L/usr/lib/clang/18/lib/baremetal -o a.out
ld.lld: error: undefined symbol: a()
>>> referenced by a.cpp
>>> /tmp/a-c3607f.o:(main)
clang++: error: ld.lld command failed with exit code 1 (use -v to see invocation)
{14:36}~ ➭
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs