Get rid of old alignment hack

This commit is contained in:
Garhoogin 2023-05-06 17:57:39 -05:00
parent 988ef820ce
commit a608559cbf
4 changed files with 8 additions and 6 deletions

View File

@ -37,9 +37,4 @@ SECTIONS {
_end = __bss_end__ ;
__end__ = __bss_end__ ;
}
.fill : {
. = ALIGN(4);
LONG(0) /* hack to make GCC actually align */
}
}

Binary file not shown.

View File

@ -76,6 +76,13 @@ public class RCMRelocator {
b[offset + 3] = (byte) ((n >>> 24) & 0xFF);
}
public static byte[] padBytes(byte[] b, int alignment) {
int paddedSize = ((b.length + (alignment - 1)) / alignment) * alignment;
byte[] padded = new byte[paddedSize];
System.arraycopy(b, 0, padded, 0, b.length);
return padded;
}
public static void main(String[] args) {
//read arguments. First RCM name, then relocation output from objdump, then symbol output
//from objdump
@ -127,7 +134,7 @@ public class RCMRelocator {
//generate relocation section
try {
byte[] rcm = Files.readAllBytes(Paths.get(rcmPath));
byte[] rcm = padBytes(Files.readAllBytes(Paths.get(rcmPath)), 4);
ByteArrayOutputStream baos = new ByteArrayOutputStream(); //relocation table
ByteArrayOutputStream thunks = new ByteArrayOutputStream(); //thunks (for ARM->THUMB B)
int nRelocations = 0;

Binary file not shown.