Skip to content

Commit

Permalink
[Clang][test] Add fPIC when building shared library (#80065)
Browse files Browse the repository at this point in the history
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"
  • Loading branch information
jsji committed Jan 31, 2024
1 parent d04ae1b commit b929be2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions clang/test/Interpreter/cxx20-modules.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
//
// RUN: %clang -std=c++20 %t/mod.cppm --precompile \
// RUN: -o %t/mod.pcm --target=x86_64-linux-gnu
// RUN: %clang %t/mod.pcm -c -o %t/mod.o --target=x86_64-linux-gnu
// RUN: %clang -shared %t/mod.o -o %t/libmod.so --target=x86_64-linux-gnu
// RUN: %clang -fPIC %t/mod.pcm -c -o %t/mod.o --target=x86_64-linux-gnu
// RUN: %clang -fPIC -shared %t/mod.o -o %t/libmod.so --target=x86_64-linux-gnu
//
// RUN: cat %t/import.cpp | env LD_LIBRARY_PATH=%t:$LD_LIBRARY_PATH \
// RUN: clang-repl -Xcc=-std=c++20 -Xcc=-fmodule-file=M=%t/mod.pcm \
Expand Down

0 comments on commit b929be2

Please sign in to comment.