[compiler-rt] 7879fa6 - [compiler-rt] Fix compilation when multiple architectures can be targeted

Evgeny Leviant via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 1 05:26:58 PDT 2021


Author: Evgeny Leviant
Date: 2021-06-01T15:26:51+03:00
New Revision: 7879fa6884723f35463de33cbe03b2acb93ea3cf

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

LOG: [compiler-rt] Fix compilation when multiple architectures can be targeted

When toolchain can supports all of arm, armhf and armv6m architectures compiler-rt
libraries won't compile because architecture specific flags are appended to single
BUILTIN_CFLAGS variable.

Differential revision: https://reviews.llvm.org/D103363

Added: 
    

Modified: 
    compiler-rt/lib/builtins/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
index 17d751b37f4de..bbb322595225c 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -706,6 +706,7 @@ else ()
 
   foreach (arch ${BUILTIN_SUPPORTED_ARCH})
     if (CAN_TARGET_${arch})
+      set(BUILTIN_CFLAGS_${arch} ${BUILTIN_CFLAGS})
       # For ARM archs, exclude any VFP builtins if VFP is not supported
       if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7m|armv7em|armv8m.main|armv8.1m.main)$")
         string(REPLACE ";" " " _TARGET_${arch}_CFLAGS "${TARGET_${arch}_CFLAGS}")
@@ -731,13 +732,13 @@ else ()
       # Needed for clear_cache on debug mode, due to r7's usage in inline asm.
       # Release mode already sets it via -O2/3, Debug mode doesn't.
       if (${arch} STREQUAL "armhf")
-        list(APPEND BUILTIN_CFLAGS -fomit-frame-pointer -DCOMPILER_RT_ARMHF_TARGET)
+        list(APPEND BUILTIN_CFLAGS_${arch} -fomit-frame-pointer -DCOMPILER_RT_ARMHF_TARGET)
       endif()
 
       # For RISCV32, we must force enable int128 for compiling long
       # double routines.
       if("${arch}" STREQUAL "riscv32")
-        list(APPEND BUILTIN_CFLAGS -fforce-enable-int128)
+        list(APPEND BUILTIN_CFLAGS_${arch} -fforce-enable-int128)
       endif()
 
       add_compiler_rt_runtime(clang_rt.builtins
@@ -745,7 +746,7 @@ else ()
                               ARCHS ${arch}
                               SOURCES ${${arch}_SOURCES}
                               DEFS ${BUILTIN_DEFS}
-                              CFLAGS ${BUILTIN_CFLAGS}
+                              CFLAGS ${BUILTIN_CFLAGS_${arch}}
                               PARENT_TARGET builtins)
     endif ()
   endforeach ()


        


More information about the llvm-commits mailing list