fix: 🐛 Fix 2/2 for objcopy unaligned sections bug
This one restores rust-objcopy but explicitly aligns the beginning of each section. This avoids incorrect binary output (.rodata section was offset 10-12 bytes because of unaligned section start).
This commit is contained in:
parent
d2ed7c21ac
commit
ce3b94e86e
|
@ -50,7 +50,10 @@ PLATFORM_TARGET="--target=${TARGET_JSON} --features=${TARGET_FEATURES}"
|
|||
DEVICE_FEATURES = "noserial"
|
||||
QEMU_FEATURES = "qemu,rpi3"
|
||||
|
||||
OBJCOPY = "/opt/homebrew/Cellar/aarch64-elf-binutils/2.40/bin/aarch64-elf-objcopy" # Part of `cargo objcopy` in cargo-binutils
|
||||
# Working objcopy from `brew install aarch64-elf-binutils`
|
||||
#OBJCOPY = "/opt/homebrew/Cellar/aarch64-elf-binutils/2.40/bin/aarch64-elf-objcopy" # Part of `cargo objcopy` in cargo-binutils
|
||||
# LLVM's objcopy, usually full of bugs like https://github.com/llvm/llvm-project/issues/58407
|
||||
OBJCOPY = "rust-objcopy" # Part of `cargo objcopy` in cargo-binutils
|
||||
OBJCOPY_PARAMS = "--strip-all -O binary"
|
||||
NM = "rust-nm" # Part of `cargo nm` in cargo-binutils
|
||||
|
||||
|
|
|
@ -59,14 +59,16 @@ SECTIONS
|
|||
*(.text*)
|
||||
} :segment_code
|
||||
|
||||
.vectors ALIGN(2048):
|
||||
.vectors :
|
||||
{
|
||||
. = ALIGN(2048);
|
||||
__EXCEPTION_VECTORS_START = .;
|
||||
KEEP(*(.vectors))
|
||||
} :segment_code
|
||||
|
||||
.rodata ALIGN(4):
|
||||
.rodata :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
*(.rodata*)
|
||||
FILL(0x00)
|
||||
. = ALIGN(PAGE_SIZE); /* Fill up to page size */
|
||||
|
@ -84,8 +86,9 @@ SECTIONS
|
|||
FILL(0x00)
|
||||
} :segment_data
|
||||
|
||||
.bss ALIGN(PAGE_SIZE) (NOLOAD):
|
||||
.bss (NOLOAD):
|
||||
{
|
||||
. = ALIGN(PAGE_SIZE);
|
||||
__BSS_START = .;
|
||||
*(.bss*)
|
||||
. = ALIGN(PAGE_SIZE); /* Align up to page size */
|
||||
|
|
Loading…
Reference in New Issue