From 53ff95254df4be3365a0bf4da2677e75ccbf32ba Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Wed, 29 Apr 2020 12:18:45 -0700 Subject: [PATCH] Reland D78837 [lld] Remove special cases from default ld driver mode. Drops the behavior from rL217112. Use the Gnu driver mode by default for all platforms when ld is invoked. Other names for the program (such as link or ld64) continue working as before. Reviewed By: MaskRay, srhines, smeenai, ruiu Differential Revision: https://reviews.llvm.org/D78837 --- lld/test/mach-o/Inputs/linker-as-ld.yaml | 6 ------ lld/test/mach-o/linker-as-ld.yaml | 32 -------------------------------- lld/tools/lld/lld.cpp | 10 +--------- 3 files changed, 1 insertion(+), 47 deletions(-) delete mode 100644 lld/test/mach-o/Inputs/linker-as-ld.yaml delete mode 100644 lld/test/mach-o/linker-as-ld.yaml diff --git a/lld/test/mach-o/Inputs/linker-as-ld.yaml b/lld/test/mach-o/Inputs/linker-as-ld.yaml deleted file mode 100644 index 0463154..0000000 --- a/lld/test/mach-o/Inputs/linker-as-ld.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- !mach-o -arch: x86_64 -file-type: MH_DYLIB -install-name: /usr/lib/libSystem.B.dylib -exports: - - name: dyld_stub_binder diff --git a/lld/test/mach-o/linker-as-ld.yaml b/lld/test/mach-o/linker-as-ld.yaml deleted file mode 100644 index 21afdb2..0000000 --- a/lld/test/mach-o/linker-as-ld.yaml +++ /dev/null @@ -1,32 +0,0 @@ -# REQUIRES: system-linker-mach-o -# -# RUN: rm -rf %T/ld && ln -s `which lld` %T/ld \ -# RUN: && %T/ld -arch x86_64 -macosx_version_min 10.8 %s \ -# RUN: %p/Inputs/linker-as-ld.yaml -o %t \ -# RUN: && llvm-nm %t | FileCheck %s -# -# Test linker run as "ld" on darwin works as darwin linker. -# - ---- !mach-o -arch: x86_64 -file-type: MH_OBJECT -flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] -has-UUID: false -OS: unknown -sections: - - segment: __TEXT - section: __text - type: S_REGULAR - attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ] - address: 0x0000000000000000 - content: [ 0xC3 ] -global-symbols: - - name: _main - type: N_SECT - scope: [ N_EXT ] - sect: 1 - value: 0x0000000000000000 -... - -# CHECK: T _main diff --git a/lld/tools/lld/lld.cpp b/lld/tools/lld/lld.cpp index 58a291d..8a8f8d0 100644 --- a/lld/tools/lld/lld.cpp +++ b/lld/tools/lld/lld.cpp @@ -96,17 +96,9 @@ static bool isPETarget(std::vector &v) { } static Flavor parseProgname(StringRef progname) { -#if __APPLE__ - // Use Darwin driver for "ld" on Darwin. - if (progname == "ld") - return Darwin; -#endif - -#if LLVM_ON_UNIX - // Use GNU driver for "ld" on other Unix-like system. + // Use GNU driver for "ld" by default. if (progname == "ld") return Gnu; -#endif // Progname may be something like "lld-gnu". Parse it. SmallVector v; -- 2.7.4