[compiler-rt] 27ef43d - [compiler-rt] Add platform detection support for x32

Harald van Dijk via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 11 11:44:47 PDT 2021


Author: John Paul Adrian Glaubitz
Date: 2021-06-11T19:44:04+01:00
New Revision: 27ef43d279b2f6d0c7bac7718f3904bb204ed646

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

LOG: [compiler-rt] Add platform detection support for x32

Currently, the compiler-rt build system checks only whether __X86_64
is defined to determine whether the default compiler-rt target arch
is x86_64. Since x32 defines __X86_64 as well, we must also check that
the default pointer size is eight bytes and not four bytes to properly
detect a 64-bit x86_64 compiler-rt default target arch.

Reviewed By: hvdijk, vitalybuka

Differential Revision: https://reviews.llvm.org/D99988

Added: 
    

Modified: 
    compiler-rt/cmake/Modules/CompilerRTUtils.cmake

Removed: 
    


################################################################################
diff  --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
index e8e0ec20af29..88ee021fe68c 100644
--- a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
+++ b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
@@ -173,7 +173,13 @@ macro(detect_target_arch)
   elseif(__AARCH64)
     add_default_target_arch(aarch64)
   elseif(__X86_64)
-    add_default_target_arch(x86_64)
+    if(CMAKE_SIZEOF_VOID_P EQUAL "4")
+      add_default_target_arch(x32)
+    elseif(CMAKE_SIZEOF_VOID_P EQUAL "8")
+      add_default_target_arch(x86_64)
+    else()
+      message(FATAL_ERROR "Unsupported pointer size for X86_64")
+    endif()
   elseif(__I386)
     add_default_target_arch(i386)
   elseif(__MIPS64) # must be checked before __MIPS


        


More information about the llvm-commits mailing list