Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions llvm/lib/ExecutionEngine/JITLink/MachO_arm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,11 @@ class MachOLinkGraphBuilder_arm64 : public MachOLinkGraphBuilder {
else
return ToSymbolOrErr.takeError();
} else {
if (auto ToSymbolOrErr = findSymbolByAddress(FixupValue))
ToSymbol = &*ToSymbolOrErr;
else
return ToSymbolOrErr.takeError();
auto ToSymbolSec = findSectionByIndex(UnsignedRI.r_symbolnum - 1);
if (!ToSymbolSec)
return ToSymbolSec.takeError();
ToSymbol = getSymbolByAddress(ToSymbolSec->Address);
assert(ToSymbol && "No symbol for section");
FixupValue -= ToSymbol->getAddress();
}

Expand Down
9 changes: 5 additions & 4 deletions llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,11 @@ class MachOLinkGraphBuilder_x86_64 : public MachOLinkGraphBuilder {
else
return ToSymbolOrErr.takeError();
} else {
if (auto ToSymbolOrErr = findSymbolByAddress(FixupValue))
ToSymbol = &*ToSymbolOrErr;
else
return ToSymbolOrErr.takeError();
auto ToSymbolSec = findSectionByIndex(UnsignedRI.r_symbolnum - 1);
if (!ToSymbolSec)
return ToSymbolSec.takeError();
ToSymbol = getSymbolByAddress(ToSymbolSec->Address);
assert(ToSymbol && "No symbol for section");
FixupValue -= ToSymbol->getAddress();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,19 +187,19 @@ anon_func_addr_quad:

# X86_64_RELOC_SUBTRACTOR Quad/Long in named storage with anonymous minuend
#
# jitlink-check: *{8}anon_minuend_quad1 = section_addr(macho_reloc.o, __data) - anon_minuend_quad1 + 2
# jitlink-check: *{8}anon_minuend_quad1 = section_addr(macho_reloc.o, __data) - anon_minuend_quad1 - 2
# Only the form "B: .quad LA - B + C" is tested. The form "B: .quad B - LA + C" is

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this comment be "B: .quad B - LA - C" (or do you want to keep the addition as the canonical form of the relocation with the understanding C C is negative?"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep -- that expression is referencing the canonical form, though that's less clear now that the example has a negative addend. I'll fix that comment on the mainline to clarify.

# invalid because the subtrahend can not be local.
.globl anon_minuend_quad1
.p2align 3
anon_minuend_quad1:
.quad Lanon_data - anon_minuend_quad1 + 2
.quad Lanon_data - anon_minuend_quad1 - 2

# jitlink-check: *{4}anon_minuend_long1 = (section_addr(macho_reloc.o, __data) - anon_minuend_long1 + 2)[31:0]
# jitlink-check: *{4}anon_minuend_long1 = (section_addr(macho_reloc.o, __data) - anon_minuend_long1 - 2)[31:0]
.globl anon_minuend_long1
.p2align 2
anon_minuend_long1:
.long Lanon_data - anon_minuend_long1 + 2
.long Lanon_data - anon_minuend_long1 - 2

# Check X86_64_RELOC_SUBTRACTOR Quad/Long in named storage with minuend and subtrahend.
# Both forms "A: .quad A - B + C" and "A: .quad B - A + C" are tested.
Expand Down