mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
[JITLink][MachO][arm64] Build GOT entries for defined symbols too.
During the generic x86-64 support refactor in ecf6466f01c52 the implementation of MachO_arm64_GOTAndStubsBuilder::isGOTEdgeToFix was altered to only return true for external symbols. This behavior is incorrect: GOT entries may be required for defined symbols (e.g. in the large code model). This patch fixes the bug and adds a test case for it (renaming an old test case to avoid any ambiguity).
This commit is contained in:
parent
fc88d818ee
commit
6214a6b655
@ -413,9 +413,8 @@ public:
|
||||
PerGraphGOTAndPLTStubsBuilder_MachO_arm64>::PerGraphGOTAndPLTStubsBuilder;
|
||||
|
||||
bool isGOTEdgeToFix(Edge &E) const {
|
||||
return (E.getKind() == GOTPage21 || E.getKind() == GOTPageOffset12 ||
|
||||
E.getKind() == PointerToGOT) &&
|
||||
E.getTarget().isExternal();
|
||||
return E.getKind() == GOTPage21 || E.getKind() == GOTPageOffset12 ||
|
||||
E.getKind() == PointerToGOT;
|
||||
}
|
||||
|
||||
Symbol &createGOTEntry(Symbol &Target) {
|
||||
|
@ -52,6 +52,23 @@ test_gotpage21_external:
|
||||
test_gotpageoff12_external:
|
||||
ldr x0, [x0, external_data@GOTPAGEOFF]
|
||||
|
||||
# Check ARM64_RELOC_GOTPAGE21 / ARM64_RELOC_GOTPAGEOFF12 handling with a
|
||||
# reference to a defined symbol. Validate both the reference to the GOT entry,
|
||||
# and also the content of the GOT entry.
|
||||
# jitlink-check: *{8}(got_addr(macho_reloc.o, named_data)) = named_data
|
||||
# jitlink-check: decode_operand(test_gotpage21_defined, 1) = \
|
||||
# jitlink-check: (got_addr(macho_reloc.o, named_data)[32:12] - \
|
||||
# jitlink-check: test_gotpage21_defined[32:12])
|
||||
# jitlink-check: decode_operand(test_gotpageoff12_defined, 2) = \
|
||||
# jitlink-check: got_addr(macho_reloc.o, named_data)[11:3]
|
||||
.globl test_gotpage21_defined
|
||||
.p2align 2
|
||||
test_gotpage21_defined:
|
||||
adrp x0, named_data@GOTPAGE
|
||||
.globl test_gotpageoff12_defined
|
||||
test_gotpageoff12_defined:
|
||||
ldr x0, [x0, named_data@GOTPAGEOFF]
|
||||
|
||||
# Check ARM64_RELOC_PAGE21 / ARM64_RELOC_PAGEOFF12 handling with a reference to
|
||||
# a local symbol.
|
||||
#
|
||||
|
Loading…
x
Reference in New Issue
Block a user