summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compiler-rt/lib/builtins/CMakeLists.txt25
1 files changed, 18 insertions, 7 deletions
diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt
index 6289cdd18f0..309ef4fcf7a 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -249,15 +249,26 @@ set(arm_SOURCES
add_custom_target(builtins)
if (NOT WIN32)
- foreach(arch x86_64 i386 arm)
- if(CAN_TARGET_${arch})
+ foreach (arch x86_64 i386 arm)
+ if (CAN_TARGET_${arch})
+ # Filter out generic versions of routines that are re-implemented in
+ # architecture specific manner. This prevents multiple definitions of the
+ # same symbols, making the symbol selection non-deterministic.
+ foreach (_file ${${arch}_SOURCES})
+ if (${_file} MATCHES ${arch}/*)
+ get_filename_component(_name ${_file} NAME)
+ string(REPLACE ".S" ".c" _cname "${_name}")
+ list(REMOVE_ITEM ${arch}_SOURCES ${_cname})
+ endif ()
+ endforeach ()
+
set_source_files_properties(${${arch}_SOURCES} PROPERTIES LANGUAGE C)
add_compiler_rt_runtime(clang_rt.builtins-${arch} ${arch} STATIC
- SOURCES ${${arch}_SOURCES}
- CFLAGS "-std=c99")
+ SOURCES ${${arch}_SOURCES}
+ CFLAGS "-std=c99")
add_dependencies(builtins clang_rt.builtins-${arch})
- endif()
- endforeach()
-endif()
+ endif ()
+ endforeach ()
+endif ()
add_dependencies(compiler-rt builtins)
OpenPOWER on IntegriCloud