[PATCH] D103363: [compiler-rt] Fix compilation when multiple architectures can be targeted
Eugene Leviant via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat May 29 10:07:16 PDT 2021
evgeny777 created this revision.
evgeny777 added reviewers: mstorsjo, kcc, eugenis, samsonov, phosek.
Herald added subscribers: kristof.beyls, mgorny, dberris.
evgeny777 requested review of this revision.
clang based toolchain can support all of arm, armhf and armv6m architectures which will break compilation of compiler-rt libraries when arm or armv6m is tested after armhf, because latter is adding `--DCOMPILER_RT_ARMHF_TARGET`.
https://reviews.llvm.org/D103363
Files:
compiler-rt/lib/builtins/CMakeLists.txt
Index: compiler-rt/lib/builtins/CMakeLists.txt
===================================================================
--- compiler-rt/lib/builtins/CMakeLists.txt
+++ compiler-rt/lib/builtins/CMakeLists.txt
@@ -706,6 +706,7 @@
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 @@
# 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 @@
ARCHS ${arch}
SOURCES ${${arch}_SOURCES}
DEFS ${BUILTIN_DEFS}
- CFLAGS ${BUILTIN_CFLAGS}
+ CFLAGS ${BUILTIN_CFLAGS_${arch}}
PARENT_TARGET builtins)
endif ()
endforeach ()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103363.348643.patch
Type: text/x-patch
Size: 1723 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210529/d7887d72/attachment.bin>
More information about the llvm-commits
mailing list