[compiler-rt] r303103 - builtins: fix filtering aliased targets

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Mon May 15 12:09:13 PDT 2017


Author: compnerd
Date: Mon May 15 14:09:13 2017
New Revision: 303103

URL: http://llvm.org/viewvc/llvm-project?rev=303103&view=rev
Log:
builtins: fix filtering aliased targets

Some build targets (e.g. i686) have aliased names (e.g. i386).  We would
get multiple definitions previously and have the linker arbitrarily
select a definition on those aliased targets.  Make this more
deterministic by checking those aliases.

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

Modified: compiler-rt/trunk/lib/builtins/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/CMakeLists.txt?rev=303103&r1=303102&r2=303103&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/builtins/CMakeLists.txt Mon May 15 14:09:13 2017
@@ -483,11 +483,18 @@ else ()
 
   foreach (arch ${BUILTIN_SUPPORTED_ARCH})
     if (CAN_TARGET_${arch})
+      # NOTE: some architectures (e.g. i386) have multiple names.  Ensure that
+      # we catch them all.
+      set(_arch ${arch})
+      if("${arch}" STREQUAL "i686")
+        set(_arch "i386|i686")
+      endif()
+
       # 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}/*)
+        if (${_file} MATCHES ${_arch}/*)
           get_filename_component(_name ${_file} NAME)
           string(REPLACE ".S" ".c" _cname "${_name}")
           list(REMOVE_ITEM ${arch}_SOURCES ${_cname})




More information about the llvm-commits mailing list