[all-commits] [llvm/llvm-project] db157d: [lld-macho] Follow-up to D77893
Jez Ng via All-commits
all-commits at lists.llvm.org
Sat May 9 20:58:24 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: db157d27337fcd13017051d125bf6e1439138da1
https://github.com/llvm/llvm-project/commit/db157d27337fcd13017051d125bf6e1439138da1
Author: Jez Ng <jezng at fb.com>
Date: 2020-05-09 (Sat, 09 May 2020)
Changed paths:
M lld/MachO/OutputSection.h
M lld/MachO/OutputSegment.cpp
M lld/MachO/OutputSegment.h
M lld/MachO/Writer.cpp
M lld/test/MachO/section-merge.s
Log Message:
-----------
[lld-macho] Follow-up to D77893
Summary:
1. Don't have isHidden() depend on isNeeded(). Whether a section is
hidden is orthogonal from whether it is needed: hidden sections will
never have a header regardless of whether they have a body. (I know we
override this method with return false for synthetic sections, but
regardless I think it's confusing to write it this way for non-synthetic
sections.)
2. Don't call writeTo() on unneeded sections. D78270 assumes that this
is true when implementing the stub helper section.
3. Filter out the unneeded sections early on to avoid having to deal
with them in multiple places.
4. Remove assumption in test that the referenced file has no other symbols.
(We should create separate input files for future tests to avoid such
issues.)
Reviewers: ruiu, pcc, MaskRay, smeenai, alexshap, gkm, Ktwu, christylee
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79460
Commit: b3e2fc931d2e06560cc8c1640e006aa25ff1ef5a
https://github.com/llvm/llvm-project/commit/b3e2fc931d2e06560cc8c1640e006aa25ff1ef5a
Author: Jez Ng <jezng at fb.com>
Date: 2020-05-09 (Sat, 09 May 2020)
Changed paths:
M lld/MachO/Arch/X86_64.cpp
M lld/MachO/Driver.cpp
M lld/MachO/InputFiles.cpp
M lld/MachO/InputFiles.h
M lld/MachO/InputSection.cpp
M lld/MachO/OutputSegment.h
M lld/MachO/Symbols.h
M lld/MachO/SyntheticSections.cpp
M lld/MachO/SyntheticSections.h
M lld/MachO/Target.h
M lld/MachO/Writer.cpp
M lld/test/MachO/Inputs/libgoodbye.s
M lld/test/MachO/Inputs/libhello.s
A lld/test/MachO/dylink-lazy.s
Log Message:
-----------
[lld-macho] Support calls to functions in dylibs
Summary:
This diff implements lazy symbol binding -- very similar to the PLT
mechanism in ELF.
ELF's .plt section is broken up into two sections in Mach-O:
StubsSection and StubHelperSection. Calls to functions in dylibs will
end up calling into StubsSection, which contains indirect jumps to
addresses stored in the LazyPointerSection (the counterpart to ELF's
.plt.got).
Initially, the LazyPointerSection contains addresses that point into one
of the entry points in the middle of the StubHelperSection. The code in
StubHelperSection will push on the stack an offset into the
LazyBindingSection. The push is followed by a jump to the beginning of
the StubHelperSection (similar to PLT0), which then calls into
dyld_stub_binder. dyld_stub_binder is a non-lazily bound symbol, so this
call looks it up in the GOT.
The stub binder will look up the bind opcodes in the LazyBindingSection
at the given offset. The bind opcodes will tell the binder to update the
address in the LazyPointerSection to point to the symbol, so that
subsequent calls don't have to redo the symbol resolution. The binder
will then jump to the resolved symbol.
Depends on D78269.
Reviewers: ruiu, pcc, MaskRay, smeenai, alexshap, gkm, Ktwu, christylee
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D78270
Commit: 5d3feefa0df9c054f6d683ca13316a822b596f87
https://github.com/llvm/llvm-project/commit/5d3feefa0df9c054f6d683ca13316a822b596f87
Author: Jez Ng <jezng at fb.com>
Date: 2020-05-09 (Sat, 09 May 2020)
Changed paths:
M lld/MachO/SymbolTable.cpp
A lld/test/MachO/resolution.s
Log Message:
-----------
[lld-macho] Dylib symbols should always replace undefined symbols
Summary:
Otherwise we get undefined symbol errors depending on the order of
arguments on the command line.
Depends on D78270.
Reviewers: ruiu, pcc, MaskRay, smeenai, alexshap, gkm, Ktwu, christylee
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79114
Commit: 7bbdbacd00ae04f9c0d609bf2c00036cafb55fef
https://github.com/llvm/llvm-project/commit/7bbdbacd00ae04f9c0d609bf2c00036cafb55fef
Author: Jez Ng <jezng at fb.com>
Date: 2020-05-09 (Sat, 09 May 2020)
Changed paths:
M lld/MachO/ExportTrie.cpp
M lld/MachO/ExportTrie.h
M lld/MachO/InputFiles.cpp
M lld/test/CMakeLists.txt
M lld/test/MachO/dylink.s
Log Message:
-----------
[lld-macho] Use export trie instead of symtab when linking against dylibs
Summary:
This allows us to link against stripped dylibs. Moreover, it's simply
more correct: The symbol table includes symbols that the dylib uses but
doesn't export.
This temporarily regresses our ability to do lazy symbol binding because
dyld_stub_binder isn't in libSystem's export trie. Rather, it is in one
of the sub-libraries libSystem re-exports. (This doesn't affect our
tests since we are mocking out dyld_stub_binder there.) A follow-up diff
will address this by adding support for sub-libraries.
Depends on D79114.
Reviewers: ruiu, pcc, MaskRay, smeenai, alexshap, gkm, Ktwu, christylee
Subscribers: mgorny, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79226
Commit: 198b0c57dffbca309dd5acaebe58300203f4c12d
https://github.com/llvm/llvm-project/commit/198b0c57dffbca309dd5acaebe58300203f4c12d
Author: Jez Ng <jezng at fb.com>
Date: 2020-05-09 (Sat, 09 May 2020)
Changed paths:
M lld/MachO/InputFiles.cpp
M lld/MachO/InputSection.cpp
M lld/MachO/InputSection.h
M lld/test/MachO/relocations.s
M lld/test/MachO/x86-64-reloc-signed.s
Log Message:
-----------
[lld-macho] Support pc-relative section relocations
Summary: So far we've only supported symbol relocations.
Reviewers: ruiu, pcc, MaskRay, smeenai, alexshap, gkm, Ktwu, christylee
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79211
Compare: https://github.com/llvm/llvm-project/compare/a72b9dfd45cd...198b0c57dffb
More information about the All-commits
mailing list