diff options
author | Kostya Kortchinsky <kostyak@google.com> | 2017-01-30 22:31:49 +0000 |
---|---|---|
committer | Kostya Kortchinsky <kostyak@google.com> | 2017-01-30 22:31:49 +0000 |
commit | fe1f3f3774d0bd44e8bb981e8e20d02777d5c784 (patch) | |
tree | c6fc69512a884e11bce2d25dc218e95b0d92ab93 /CMakeLists.txt | |
parent | 2967dfb22beadb462cbb07c36e0398281935c6b8 (diff) | |
download | compiler-rt-fe1f3f3774d0bd44e8bb981e8e20d02777d5c784.tar.gz |
[sanitizer] Re-enable -fno-function-sections for powerpc64le
Summary:
For a reason that hasn't been investigated for lack of powerpc knowledge and
hardware, -fno-function-sections is required for the Sanitizers to work
properly on powerpc64le. Without, the function-sections-are-bad test fails on
that architecture (and that architecture only).
This patch re-enables the flag in the powerpc64le cflags.
I have to admit I am not entirely sure if my way is the proper way to do this,
so if anyone has a better way, I'll be happy to oblige.
Reviewers: kcc, eugenis
Reviewed By: eugenis
Subscribers: nemanjai, mgorny, llvm-commits
Differential Revision: https://reviews.llvm.org/D29285
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@293558 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3db41db4d..cbde83113 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -144,6 +144,14 @@ append_list_if(COMPILER_RT_HAS_FVISIBILITY_HIDDEN_FLAG -fvisibility=hidden SANIT append_list_if(COMPILER_RT_HAS_FVISIBILITY_INLINES_HIDDEN_FLAG -fvisibility-inlines-hidden SANITIZER_COMMON_CFLAGS) append_list_if(COMPILER_RT_HAS_FNO_LTO_FLAG -fno-lto SANITIZER_COMMON_CFLAGS) +# The following is a workaround for powerpc64le. This is the only architecture +# that requires -fno-function-sections to work properly. If lacking, the ASan +# Linux test function-sections-are-bad.cc fails with the following error: +# 'undefined symbol: __sanitizer_unaligned_load32'. +if(DEFINED TARGET_powerpc64le_CFLAGS) + append_list_if(COMPILER_RT_HAS_FNO_FUNCTION_SECTIONS_FLAG -fno-function-sections TARGET_powerpc64le_CFLAGS) +endif() + if(MSVC) # Replace the /M[DT][d] flags with /MT, and strip any definitions of _DEBUG, # which cause definition mismatches at link time. |