Reland D78837 [lld] Remove special cases from default ld driver mode.
authorFangrui Song <maskray@google.com>
Wed, 29 Apr 2020 19:18:45 +0000 (12:18 -0700)
committerFangrui Song <maskray@google.com>
Wed, 29 Apr 2020 21:45:44 +0000 (14:45 -0700)
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 [deleted file]
lld/test/mach-o/linker-as-ld.yaml [deleted file]
lld/tools/lld/lld.cpp

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 (file)
index 0463154..0000000
+++ /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 (file)
index 21afdb2..0000000
+++ /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
index 58a291d..8a8f8d0 100644 (file)
@@ -96,17 +96,9 @@ static bool isPETarget(std::vector<const char *> &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<StringRef, 3> v;