Skip to content

Commit b929be2

Browse files
authored
[Clang][test] Add fPIC when building shared library (llvm#80065)
Fix linking error: "ld: error: can't create dynamic relocation R_X86_64_64 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output"
1 parent d04ae1b commit b929be2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clang/test/Interpreter/cxx20-modules.cppm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
//
88
// RUN: %clang -std=c++20 %t/mod.cppm --precompile \
99
// RUN: -o %t/mod.pcm --target=x86_64-linux-gnu
10-
// RUN: %clang %t/mod.pcm -c -o %t/mod.o --target=x86_64-linux-gnu
11-
// RUN: %clang -shared %t/mod.o -o %t/libmod.so --target=x86_64-linux-gnu
10+
// RUN: %clang -fPIC %t/mod.pcm -c -o %t/mod.o --target=x86_64-linux-gnu
11+
// RUN: %clang -fPIC -shared %t/mod.o -o %t/libmod.so --target=x86_64-linux-gnu
1212
//
1313
// RUN: cat %t/import.cpp | env LD_LIBRARY_PATH=%t:$LD_LIBRARY_PATH \
1414
// RUN: clang-repl -Xcc=-std=c++20 -Xcc=-fmodule-file=M=%t/mod.pcm \

0 commit comments

Comments
 (0)