[PATCH] D72335: [CMake] Enable -qfuncsect when building with IBM XL
Hubert Tong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 15 07:47:43 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe429f24ed8b1: [CMake] Enable -qfuncsect when building with IBM XL (authored by hubert.reinterpretcast).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72335/new/
https://reviews.llvm.org/D72335
Files:
compiler-rt/CMakeLists.txt
llvm/cmake/modules/HandleLLVMOptions.cmake
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -782,9 +782,11 @@
NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
check_c_compiler_flag("-Werror -fno-function-sections" C_SUPPORTS_FNO_FUNCTION_SECTIONS)
if (C_SUPPORTS_FNO_FUNCTION_SECTIONS)
- # Don't add -ffunction-section if it can be disabled with -fno-function-sections.
+ # Don't add -ffunction-sections if it can't be disabled with -fno-function-sections.
# Doing so will break sanitizers.
add_flag_if_supported("-ffunction-sections" FFUNCTION_SECTIONS)
+ elseif (CMAKE_CXX_COMPILER_ID MATCHES "XL")
+ append("-qfuncsect" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
endif()
add_flag_if_supported("-fdata-sections" FDATA_SECTIONS)
endif()
Index: compiler-rt/CMakeLists.txt
===================================================================
--- compiler-rt/CMakeLists.txt
+++ compiler-rt/CMakeLists.txt
@@ -286,7 +286,11 @@
# Linux test function-sections-are-bad.cpp 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)
+ if(CMAKE_CXX_COMPILER_ID MATCHES "XL")
+ append("-qnofuncsect" TARGET_powerpc64le_CFLAGS)
+ else()
+ append_list_if(COMPILER_RT_HAS_FNO_FUNCTION_SECTIONS_FLAG -fno-function-sections TARGET_powerpc64le_CFLAGS)
+ endif()
endif()
# The following is a workaround for s390x. This avoids creation of "partial
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72335.238261.patch
Type: text/x-patch
Size: 1693 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200115/e2a0e591/attachment-0001.bin>
More information about the llvm-commits
mailing list