[clang] c41a18c - [CMake] Default ENABLE_X86_RELAX_RELOCATIONS to ON

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 2 23:06:41 PDT 2020


Author: Fangrui Song
Date: 2020-08-02T23:06:31-07:00
New Revision: c41a18cf61790fc898dcda1055c3efbf442c14c0

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

LOG: [CMake] Default ENABLE_X86_RELAX_RELOCATIONS to ON

This makes clang default to -Wa,-mrelax-relocations=yes, which enables
R_386_GOT32X (GNU as enables it regardless of -mrelax-relocations=) and
R_X86_64_[REX_]GOTPCRELX in MC. The produced object files require GNU ld>=2.26
to link. binutils 2.26 is considered a very old release today.

Added: 
    

Modified: 
    clang/CMakeLists.txt
    llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn

Removed: 
    


################################################################################
diff  --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index c487e506cae1..7baf93cbf792 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -259,7 +259,7 @@ set(DEFAULT_SYSROOT "" CACHE STRING
 
 set(ENABLE_LINKER_BUILD_ID OFF CACHE BOOL "pass --build-id to ld")
 
-set(ENABLE_X86_RELAX_RELOCATIONS OFF CACHE BOOL
+set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL
     "enable x86 relax relocations by default")
 
 set(ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER FALSE CACHE BOOL

diff  --git a/llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn b/llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn
index 7fbfb46a41c5..49fc477d35f6 100644
--- a/llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn
+++ b/llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn
@@ -33,7 +33,7 @@ write_cmake_config("Config") {
     "GCC_INSTALL_PREFIX=",
     "BACKEND_PACKAGE_STRING=LLVM ${llvm_version}git",
     "ENABLE_LINKER_BUILD_ID=",
-    "ENABLE_X86_RELAX_RELOCATIONS=",
+    "ENABLE_X86_RELAX_RELOCATIONS=1",
     "ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER=",
     "CLANG_ENABLE_OBJC_REWRITER=1",  # FIXME: flag?
     "CLANG_SYSTEMZ_DEFAULT_ARCH=z10",


        


More information about the cfe-commits mailing list