[llvm] r367448 - gn build: Fix redundant object files in builtin lib.

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 31 10:08:34 PDT 2019


Author: nico
Date: Wed Jul 31 10:08:34 2019
New Revision: 367448

URL: http://llvm.org/viewvc/llvm-project?rev=367448&view=rev
Log:
gn build: Fix redundant object files in builtin lib.

compiler-rt's builtin library has generic implementations of many
functions, and then per-arch optimized implementations of some.

In the CMake build, both filter_builtin_sources() and an explicit loop
at the end of the build file (see D37166) filter out the generic
versions if a per-arch file is present.

The GN build wasn't doing this filtering. Just do the filtering manually
and explicitly, instead of being clever.

While here, also remove files from the mingw/arm build that are
redundantly listed after D39938 / r318139 (both from the CMake and the
GN build).

While here, also fix a target_os -> target_cpu typo.

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

Modified:
    llvm/trunk/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn

Modified: llvm/trunk/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn?rev=367448&r1=367447&r2=367448&view=diff
==============================================================================
--- llvm/trunk/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn (original)
+++ llvm/trunk/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn Wed Jul 31 10:08:34 2019
@@ -201,7 +201,23 @@ static_library("builtins") {
       "powixf2.c",
     ]
   }
-  if (target_os == "x86") {
+  if (target_cpu == "x86") {
+    sources -= [
+      "ashldi3.c",
+      "ashrdi3.c",
+      "divdi3.c",
+      "floatdidf.c",
+      "floatdisf.c",
+      "floatdixf.c",
+      "floatundidf.c",
+      "floatundisf.c",
+      "floatundixf.c",
+      "lshrdi3.c",
+      "moddi3.c",
+      "muldi3.c",
+      "udivdi3.c",
+      "umoddi3.c",
+    ]
     sources += [
       "i386/ashldi3.S",
       "i386/ashrdi3.S",
@@ -225,6 +241,14 @@ static_library("builtins") {
       ]
     }
   } else if (target_cpu == "x64") {
+    sources -= [
+      "floatdidf.c",
+      "floatdisf.c",
+      "floatdixf.c",
+      "floatundidf.c",
+      "floatundisf.c",
+      "floatundixf.c",
+    ]
     sources += [
       "x86_64/floatdidf.c",
       "x86_64/floatdisf.c",
@@ -242,65 +266,61 @@ static_library("builtins") {
   }
 
   if (target_cpu == "arm") {
-    sources += [
-      "arm/bswapdi2.S",
-      "arm/bswapsi2.S",
-      "arm/clzdi2.S",
-      "arm/clzsi2.S",
-      "arm/comparesf2.S",
-      "arm/divmodsi4.S",
-      "arm/divsi3.S",
-      "arm/modsi3.S",
-      "arm/sync_fetch_and_add_4.S",
-      "arm/sync_fetch_and_add_8.S",
-      "arm/sync_fetch_and_and_4.S",
-      "arm/sync_fetch_and_and_8.S",
-      "arm/sync_fetch_and_max_4.S",
-      "arm/sync_fetch_and_max_8.S",
-      "arm/sync_fetch_and_min_4.S",
-      "arm/sync_fetch_and_min_8.S",
-      "arm/sync_fetch_and_nand_4.S",
-      "arm/sync_fetch_and_nand_8.S",
-      "arm/sync_fetch_and_or_4.S",
-      "arm/sync_fetch_and_or_8.S",
-      "arm/sync_fetch_and_sub_4.S",
-      "arm/sync_fetch_and_sub_8.S",
-      "arm/sync_fetch_and_umax_4.S",
-      "arm/sync_fetch_and_umax_8.S",
-      "arm/sync_fetch_and_umin_4.S",
-      "arm/sync_fetch_and_umin_8.S",
-      "arm/sync_fetch_and_xor_4.S",
-      "arm/sync_fetch_and_xor_8.S",
-      "arm/udivmodsi4.S",
-      "arm/udivsi3.S",
-      "arm/umodsi3.S",
-    ]
-    if (target_os == "mingw") {
+    if (target_os != "mingw") {
+      sources -= [
+        "bswapdi2.c",
+        "bswapsi2.c",
+        "clzdi2.c",
+        "clzsi2.c",
+        "comparesf2.c",
+        "divmodsi4.c",
+        "divsi3.c",
+        "modsi3.c",
+        "udivmodsi4.c",
+        "udivsi3.c",
+        "umodsi3.c",
+      ]
+      sources += [
+        "arm/bswapdi2.S",
+        "arm/bswapsi2.S",
+        "arm/clzdi2.S",
+        "arm/clzsi2.S",
+        "arm/comparesf2.S",
+        "arm/divmodsi4.S",
+        "arm/divsi3.S",
+        "arm/modsi3.S",
+        "arm/sync_fetch_and_add_4.S",
+        "arm/sync_fetch_and_add_8.S",
+        "arm/sync_fetch_and_and_4.S",
+        "arm/sync_fetch_and_and_8.S",
+        "arm/sync_fetch_and_max_4.S",
+        "arm/sync_fetch_and_max_8.S",
+        "arm/sync_fetch_and_min_4.S",
+        "arm/sync_fetch_and_min_8.S",
+        "arm/sync_fetch_and_nand_4.S",
+        "arm/sync_fetch_and_nand_8.S",
+        "arm/sync_fetch_and_or_4.S",
+        "arm/sync_fetch_and_or_8.S",
+        "arm/sync_fetch_and_sub_4.S",
+        "arm/sync_fetch_and_sub_8.S",
+        "arm/sync_fetch_and_umax_4.S",
+        "arm/sync_fetch_and_umax_8.S",
+        "arm/sync_fetch_and_umin_4.S",
+        "arm/sync_fetch_and_umin_8.S",
+        "arm/sync_fetch_and_xor_4.S",
+        "arm/sync_fetch_and_xor_8.S",
+        "arm/udivmodsi4.S",
+        "arm/udivsi3.S",
+        "arm/umodsi3.S",
+      ]
+    } else {
       sources += [
         "arm/aeabi_idivmod.S",
         "arm/aeabi_ldivmod.S",
         "arm/aeabi_uidivmod.S",
         "arm/aeabi_uldivmod.S",
         "arm/chkstk.S",
-        "divdi3.c",
-        "divmoddi4.c",
-        "divmodsi4.c",
-        "divsi3.c",
-        "emutls.c",
-        "fixdfdi.c",
-        "fixsfdi.c",
-        "fixunsdfdi.c",
-        "fixunssfdi.c",
-        "floatdidf.c",
-        "floatdisf.c",
-        "floatundidf.c",
-        "floatundisf.c",
         "mingw_fixfloat.c",
-        "moddi3.c",
-        "udivmoddi4.c",
-        "udivmodsi4.c",
-        "udivsi3.c",
-        "umoddi3.c",
       ]
     }
   }




More information about the llvm-commits mailing list