Shifed binary image produced by arm-none-eabi-objcopy


Im currently trying to fix a strange behavior of objcopy, which sometimes generates invalid output binary image with 0x4 byte shift.

I found this issue because this shift was affecting my init_array_start table (which is indeed pointing to right address in *.elf file, but after shift in binary file, its payload is gets corrupted - 1 pointer is 0x4 before desired table, and last item becomes null) - hard debugging week unfortunately :slight_smile:

Here are the dumps produced by readelf and xxd:

Orginal init_array_start symbol from *.elf file (symbol point to 0x00085a80)

Valid code payload from *.elf file (note that first entry is at correct 0x00085a80 address)

Invalid payload from *.bin file (note that first entry is at invalid 0x00085a7c address)

Im converting *.elf to *.bin with:

arm-none-eabi-objcopy -O binary binary/executable.axf binary/executable.bin

Is it a bug, or im missing something ?