1
1
mirror of https://github.com/rui314/mold.git synced 2024-10-04 08:37:28 +03:00

Disable PIE in run-clang.sh unit test

This fixes the following error when Clang 15 is installed on the system:
> mold: error: out/test/elf/x86_64/run-clang/a.o:(.text):
> R_X86_64_32 relocation at offset 0x5 against symbol `.rodata' can not
> be used; recompile with -fPIC

The error occurs because Clang 15 assumes PIE to be enabled by default:
https://releases.llvm.org/15.0.0/tools/clang/docs/ReleaseNotes.html#build-system-changes

Attempting to produce a position-independent executable from an object
file that was created by `cc` without `-fPIE` caused the linker to bail
out.

Signed-off-by: Christoph Erhardt <github@sicherha.de>
This commit is contained in:
Christoph Erhardt 2022-09-27 15:14:08 +02:00
parent 95ad47ca7d
commit 7aa87220c4

View File

@ -29,7 +29,7 @@ int main() {
EOF
LD_PRELOAD=`pwd`/mold-wrapper.so MOLD_PATH=`pwd`/mold \
clang -o $t/exe $t/a.o -fuse-ld=/usr/bin/ld
clang -no-pie -o $t/exe $t/a.o -fuse-ld=/usr/bin/ld
readelf -p .comment $t/exe > $t/log
grep -q mold $t/log