[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Multiboot ELF Loader - Alignment
From: |
Chris Plant |
Subject: |
Multiboot ELF Loader - Alignment |
Date: |
Thu, 21 Oct 2021 20:46:06 +0100 |
User-agent: |
Evolution 3.38.3-1 |
Hello,
I'm continuing to play with Multiboot2 on ARM64 on a Raspberry Pi, and
I've run into something which I'm trying to understand.
I have an ELF file for my kernel which has two segments (I have no idea
why rust is giving me two segments, but it is). If I boot directly
into the ELF file from the Pi firmware it boots fine, but if I boot via
GRUB I have issues with data corruption in .rodata which is in the
second segment. The first segment (.text) appears to load correctly.
Digging into this, the ELF headers specify a load base address of
0x801060 for the second segment, but GRUB allocates and loads this to
0x802000. If I change my linker to align the second segment onto
0x1000 everything works fine.
Is this alignment to 0x1000 a defined behaviour of the GRUB allocator
or Multiboot2? I'm assuming it's not a problem with the ELF file as
it's generated by usual means and runs fine otherwise.
Thanks,
Chris
- Multiboot ELF Loader - Alignment,
Chris Plant <=