Skip to content

Commit c8961ab

Browse files
committed
Reformat
1 parent ba8d1e8 commit c8961ab

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/macho/MachORelocationElement.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ final class RelocationInfo implements RelocationRecord, RelocationMethod {
191191
public static RelocationInfo newAddend(MachORelocationElement containingElement, MachOSection relocatedSection, int offset, int requestedLength, long addend) {
192192
return new RelocationInfo(containingElement, relocatedSection, offset, requestedLength, addend);
193193
}
194+
194195
private static byte encodeRequestedLength(int requestedLength) {
195196
/*
196197
* NOTE: the Mach-O spec claims that r_length == 3 means a 4-byte length and not an 8-byte

substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/macho/MachOUserDefinedSection.java

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,9 @@ public RelocationRecord markRelocationSite(int offset, ByteBuffer bb, Relocation
171171

172172
if (getOwner().cpuType == MachOCpuType.X86_64) {
173173
/*
174-
* NOTE: X86_64 Mach-O does not support explicit addends, and inline addends are applied even
175-
* during dynamic linking. So if the caller supplies an explicit addend, we turn it into an
176-
* implicit one by updating our content.
174+
* NOTE: X86_64 Mach-O does not support explicit addends, and inline addends are applied
175+
* even during dynamic linking. So if the caller supplies an explicit addend, we turn it
176+
* into an implicit one by updating our content.
177177
*/
178178
long currentInlineAddendValue = sbb.readTruncatedLong(length);
179179
long desiredInlineAddendValue;
@@ -191,12 +191,12 @@ public RelocationRecord markRelocationSite(int offset, ByteBuffer bb, Relocation
191191

192192
/*
193193
* One more complication: for PC-relative relocation, at least on x86-64, Mach-O linkers
194-
* (both AOT ld and dyld) adjust the calculation to compensate for the fact that it's the
195-
* *next* instruction that the PC-relative reference gets resolved against. Note that ELF
196-
* doesn't do this compensation. Our interface duplicates the ELF behaviour, so we have to
197-
* act against this Mach-O-specific fixup here, by *adding* a little to the addend. The
198-
* amount we add is always the length in bytes of the relocation site (since on x86-64 the
199-
* reference is always the last field in a PC-relative instruction).
194+
* (both AOT ld and dyld) adjust the calculation to compensate for the fact that it's
195+
* the *next* instruction that the PC-relative reference gets resolved against. Note
196+
* that ELF doesn't do this compensation. Our interface duplicates the ELF behaviour, so
197+
* we have to act against this Mach-O-specific fixup here, by *adding* a little to the
198+
* addend. The amount we add is always the length in bytes of the relocation site (since
199+
* on x86-64 the reference is always the last field in a PC-relative instruction).
200200
*/
201201
if (RelocationKind.isPCRelative(k)) {
202202
desiredInlineAddendValue += length;
@@ -219,11 +219,13 @@ public RelocationRecord markRelocationSite(int offset, ByteBuffer bb, Relocation
219219
case AARCH64_R_AARCH64_ADD_ABS_LO12_NC:
220220
if (explicitAddend != 0) {
221221
/*
222-
* These relocations should use an explicit addend reloc record instead of an embedded addend,
223-
* according to the Mach-O ld code at
224-
* https://opensource.apple.com/source/ld64/ld64-274.2/src/ld/parsers/macho_relocatable_file.cpp.auto.html
222+
* These relocations should use an explicit addend reloc record instead of
223+
* an embedded addend, according to the Mach-O ld code at
224+
* https://opensource.apple.com/source/ld64/ld64-274.2/src/ld/parsers/
225+
* macho_relocatable_file.cpp.auto.html
225226
*
226-
* > xxxx instruction at xxxx has embedded addend. ARM64_RELOC_ADDEND should be used instead
227+
* > xxxx instruction at xxxx has embedded addend. ARM64_RELOC_ADDEND should
228+
* be used instead
227229
*/
228230
RelocationInfo addend = RelocationInfo.newAddend(el, this, offset, length, explicitAddend);
229231
el.add(addend);

0 commit comments

Comments
 (0)