lld: improve the `-arch` handling for MachO
authorSaleem Abdulrasool <compnerd@compnerd.org>
Sat, 6 Jun 2020 02:54:58 +0000 (19:54 -0700)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Mon, 8 Jun 2020 18:04:19 +0000 (11:04 -0700)
commitfcdf7578aa697526e5eee05fb0e5390c4ef02eb9
tree86aaec80e6175e9aeb6c63a00aaa344815c41999
parent22c2dc5931a73eebf2a2e2b2d7a8cf757907dc3e
lld: improve the `-arch` handling for MachO

Use the default target triple configured by the user to determine the
default architecture for `ld64.lld`.  Stash the architecture in the
configuration as when linking against TBDs, we will need to filter out
the symbols based upon the architecture.  Treat the Haswell slice as it
is equivalent to `x86_64` but with the extra Haswell extensions (e.g.
AVX2, FMA3, BMI1, etc).  This will make it easier to add new
architectures in the future.

This change also changes the failure mode where an invalid `-arch`
parameter will result in the linker exiting without further processing.
40 files changed:
lld/MachO/Config.h
lld/MachO/Driver.cpp
lld/test/MachO/archive.s
lld/test/MachO/dylib.s
lld/test/MachO/dylink-lazy.s
lld/test/MachO/dylink.s
lld/test/MachO/entry-symbol.s
lld/test/MachO/export-trie.s
lld/test/MachO/invalid/alignment-too-large.yaml
lld/test/MachO/invalid/archive-no-index.s
lld/test/MachO/invalid/bad-archive.s
lld/test/MachO/invalid/duplicate-symbol.s
lld/test/MachO/invalid/invalid-executable.s
lld/test/MachO/invalid/invalid-relocation.yaml
lld/test/MachO/invalid/missing-dylib.s
lld/test/MachO/invalid/no-id-dylink.yaml
lld/test/MachO/invalid/no-such-file.s
lld/test/MachO/invalid/order-file-bad-arch.test
lld/test/MachO/invalid/order-file-bad-objfile.test
lld/test/MachO/invalid/undefined-symbol.s
lld/test/MachO/link-search-order.s
lld/test/MachO/load-commands.s
lld/test/MachO/no-exports-dylib.s
lld/test/MachO/order-file.s
lld/test/MachO/platform-version.test
lld/test/MachO/relocations.s
lld/test/MachO/resolution.s
lld/test/MachO/search-paths.test
lld/test/MachO/section-headers.s
lld/test/MachO/section-merge.s
lld/test/MachO/segments.s
lld/test/MachO/silent-ignore.test
lld/test/MachO/static-link.s
lld/test/MachO/sub-library.s
lld/test/MachO/subsections-section-relocs.s
lld/test/MachO/subsections-symbol-relocs.s
lld/test/MachO/symbol-order.s
lld/test/MachO/symtab.s
lld/test/MachO/x86-64-reloc-signed.s
lld/test/MachO/x86-64-reloc-unsigned.s