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
This commit is contained in:
Fangrui Song 2020-04-29 12:18:45 -07:00
parent 9d4bcc3a60
commit 53ff95254d
3 changed files with 1 additions and 47 deletions

View File

@ -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

View File

@ -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

View 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;