OSDN Git Service

[lld-macho] Implement weak binding for branch relocations
authorJez Ng <jezng@fb.com>
Thu, 27 Aug 2020 22:54:42 +0000 (15:54 -0700)
committerJez Ng <jezng@fb.com>
Fri, 28 Aug 2020 00:44:15 +0000 (17:44 -0700)
commite263287c797f7d143cf2f38e2df1d5fcee94f9b0
treeb52cc1b6c2cc75d162add121e89239e017292757
parent7f717b6d1f65f8474e8633b040a16c55f0ad6b96
[lld-macho] Implement weak binding for branch relocations

Since there is no "weak lazy" lookup, function calls to weak symbols are
always non-lazily bound. We emit both regular non-lazy bindings as well
as weak bindings, in order that the weak bindings may overwrite the
non-lazy bindings if an appropriate symbol is found at runtime. However,
the bound addresses will still be written (non-lazily) into the
LazyPointerSection.

Reviewed By: #lld-macho, smeenai

Differential Revision: https://reviews.llvm.org/D86573
lld/MachO/Arch/X86_64.cpp
lld/MachO/Symbols.h
lld/MachO/SyntheticSections.cpp
lld/MachO/SyntheticSections.h
lld/MachO/Target.h
lld/MachO/Writer.cpp
lld/test/MachO/weak-binding.s
lld/test/MachO/weak-definition-order.s