[clang] b929be2 - [Clang][test] Add fPIC when building shared library (#80065)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 31 08:51:18 PST 2024


Author: Jinsong Ji
Date: 2024-01-31T11:51:15-05:00
New Revision: b929be2d12a291412f726f2df54934803343fa29

URL: https://github.com/llvm/llvm-project/commit/b929be2d12a291412f726f2df54934803343fa29
DIFF: https://github.com/llvm/llvm-project/commit/b929be2d12a291412f726f2df54934803343fa29.diff

LOG: [Clang][test] Add fPIC when building shared library (#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"

Added: 
    

Modified: 
    clang/test/Interpreter/cxx20-modules.cppm

Removed: 
    


################################################################################
diff  --git a/clang/test/Interpreter/cxx20-modules.cppm b/clang/test/Interpreter/cxx20-modules.cppm
index cd2b04fdc547d..239968d8c7445 100644
--- a/clang/test/Interpreter/cxx20-modules.cppm
+++ b/clang/test/Interpreter/cxx20-modules.cppm
@@ -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 \


        


More information about the cfe-commits mailing list