[compiler-rt] bbb7212 - [scudo][test] Link with -no-pie to be agnostic of CLANG_DEFAULT_PIE_ON_LINUX

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 8 23:30:11 PDT 2022


Author: Fangrui Song
Date: 2022-04-08T23:30:07-07:00
New Revision: bbb72122aa27a2398b7c06394c879149fd723ccb

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

LOG: [scudo][test] Link with -no-pie to be agnostic of CLANG_DEFAULT_PIE_ON_LINUX

This keeps the test behavior unchanged when CLANG_DEFAULT_PIE_ON_LINUX switches
to ON by default.

Note: current clang --target=mips64el-linux-gnu -fpie -pie -fuse-ld=lld
does not link with C++ exceptions, using -pie would lead to

```
ld.lld: error: cannot preempt symbol: DW.ref.__gxx_personality_v0
...
ld.lld: error: relocation R_MIPS_64 cannot be used against local symbol; recompile with -fPIC
...
```

when linking `ScudoUnitTests`: https://lab.llvm.org/buildbot/#/builders/169/builds/7311/steps/18/logs/stdio

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt b/compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
index 7be58f424dd68..b6b60a2c8ada4 100644
--- a/compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
+++ b/compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
@@ -37,7 +37,7 @@ set(LINK_FLAGS
   ${COMPILER_RT_UNITTEST_LINK_FLAGS}
   ${SANITIZER_TEST_CXX_LIBRARIES}
   )
-list(APPEND LINK_FLAGS -pthread)
+list(APPEND LINK_FLAGS -pthread -no-pie)
 # Linking against libatomic is required with some compilers
 check_library_exists(atomic __atomic_load_8 "" COMPILER_RT_HAS_LIBATOMIC)
 if (COMPILER_RT_HAS_LIBATOMIC)


        


More information about the llvm-commits mailing list