llvm-capstone/lld/MachO
Jez Ng 84579fc24f [lld-macho] Basic support for linkage and visibility attributes in LTO
When parsing bitcode, convert LTO Symbols to LLD Symbols in order to perform
resolution. The "winning" symbol will then be marked as Prevailing at LTO
compilation time. This is similar to what the other LLD ports do.

This change allows us to handle `linkonce` symbols correctly, and to deal with
duplicate bitcode symbols gracefully. Previously, both scenarios would result in
an assertion failure inside the LTO code, complaining that multiple Prevailing
definitions are not allowed.

While at it, I also added basic logic around visibility. We don't do anything
useful with it yet, but we do check that its value is valid. LLD-ELF appears to
use it only to set FinalDefinitionInLinkageUnit for LTO, which I think is just a
performance optimization.

From my local experimentation, the linker itself doesn't seem to do anything
differently when encountering linkonce / linkonce_odr / weak / weak_odr. So I've
only written a test for one of them. LLD-ELF has more, but they seem to mostly
be testing the intermediate bitcode output of their LTO backend...? I'm far from
an expert here though, so I might very well be missing things.

Reviewed By: #lld-macho, MaskRay, smeenai

Differential Revision: https://reviews.llvm.org/D94342
2021-02-25 13:27:40 -05:00
..
Arch [lld-macho] Fix semantics & add tests for ARM64 GOT/TLV relocs 2021-02-23 22:02:38 -05:00
CMakeLists.txt [lld-macho] Add ARM64 target arch 2021-02-08 18:14:07 -07:00
Config.h [lld/mac] reject -undefined warning and -undefined suppress with -twolevel_namespace 2021-02-20 13:35:22 -05:00
Driver.cpp Reland [lld-macho]Implement bundle_loader 2021-02-22 14:05:12 -05:00
Driver.h Reland [lld-macho]Implement bundle_loader 2021-02-22 14:05:12 -05:00
DriverUtils.cpp Reland [lld-macho]Implement bundle_loader 2021-02-22 14:05:12 -05:00
Dwarf.cpp
Dwarf.h
ExportTrie.cpp [lld-macho] Associate each Symbol with an InputFile 2021-02-03 13:43:47 -05:00
ExportTrie.h
InputFiles.cpp [lld-macho] Basic support for linkage and visibility attributes in LTO 2021-02-25 13:27:40 -05:00
InputFiles.h Reland [lld-macho]Implement bundle_loader 2021-02-22 14:05:12 -05:00
InputSection.cpp [lld-macho] Fix semantics & add tests for ARM64 GOT/TLV relocs 2021-02-23 22:02:38 -05:00
InputSection.h [lld-macho] Add ARM64 target arch 2021-02-08 18:14:07 -07:00
LTO.cpp [lld-macho] Basic support for linkage and visibility attributes in LTO 2021-02-25 13:27:40 -05:00
LTO.h
MachOStructs.h
MergedOutputSection.cpp
MergedOutputSection.h
ObjC.cpp
ObjC.h
Options.td Reland [lld-macho]Implement bundle_loader 2021-02-22 14:05:12 -05:00
OutputSection.cpp
OutputSection.h
OutputSegment.cpp
OutputSegment.h [lld-macho] add code signature for native arm64 macOS 2021-02-24 17:05:23 -08:00
Symbols.cpp [lld-macho] Associate each Symbol with an InputFile 2021-02-03 13:43:47 -05:00
Symbols.h [lld-macho] Associate each Symbol with an InputFile 2021-02-03 13:43:47 -05:00
SymbolTable.cpp [lld-macho] Associate each Symbol with an InputFile 2021-02-03 13:43:47 -05:00
SymbolTable.h [lld-macho] Associate each Symbol with an InputFile 2021-02-03 13:43:47 -05:00
SyntheticSections.cpp [lld-macho] add code signature for native arm64 macOS 2021-02-24 17:05:23 -08:00
SyntheticSections.h [lld-macho] add code signature for native arm64 macOS 2021-02-24 17:05:23 -08:00
Target.cpp [lld-macho] Fix semantics & add tests for ARM64 GOT/TLV relocs 2021-02-23 22:02:38 -05:00
Target.h [lld-macho] Fix semantics & add tests for ARM64 GOT/TLV relocs 2021-02-23 22:02:38 -05:00
UnwindInfoSection.cpp [lld-macho] Better deduplication of personality pointers 2021-02-23 22:02:38 -05:00
UnwindInfoSection.h [lld-macho] Emit LSDA info in compact unwind 2021-02-08 13:48:00 -05:00
Writer.cpp [lld-macho] add code signature for native arm64 macOS 2021-02-24 17:05:23 -08:00
Writer.h