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:
With the following source: a.cpp
Running the following with a
x86_64-pc-linux-gnu
host will have the expected behavior, not demangling the symbol:But once you switch to aarch64-none-elf:
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: