From 8aa60c39db3eb7289c4d5e1ff2edc47dc4daa806 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Wed, 31 Jul 2019 17:08:34 +0000 Subject: [PATCH] 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367448 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../compiler-rt/lib/builtins/BUILD.gn | 126 ++++++++++-------- 1 file changed, 73 insertions(+), 53 deletions(-) diff --git a/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn b/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn index 4772a519540..9af7d6b3845 100644 --- a/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn +++ b/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn @@ -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", ] } } -- 2.50.0