[compiler-rt] r293558 - [sanitizer] Re-enable -fno-function-sections for powerpc64le

Kostya Kortchinsky via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 30 14:31:49 PST 2017


Author: cryptoad
Date: Mon Jan 30 16:31:49 2017
New Revision: 293558

URL: http://llvm.org/viewvc/llvm-project?rev=293558&view=rev
Log:
[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

Modified:
    compiler-rt/trunk/CMakeLists.txt

Modified: compiler-rt/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=293558&r1=293557&r2=293558&view=diff
==============================================================================
--- compiler-rt/trunk/CMakeLists.txt (original)
+++ compiler-rt/trunk/CMakeLists.txt Mon Jan 30 16:31:49 2017
@@ -144,6 +144,14 @@ append_list_if(COMPILER_RT_HAS_FVISIBILI
 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.




More information about the llvm-commits mailing list