Skip to content

ELF: allow using program headers and physical addresses to build the image#26

Open
Spaqin wants to merge 1 commit intoantmicro:masterfrom
Spaqin:elf_use_ph
Open

ELF: allow using program headers and physical addresses to build the image#26
Spaqin wants to merge 1 commit intoantmicro:masterfrom
Spaqin:elf_use_ph

Conversation

@Spaqin
Copy link

@Spaqin Spaqin commented Feb 13, 2026

If you're doing something less common, like memory overlays, with multiple sections sharing the same virtual address, the default behavior of iterating over section headers doesn't work - data gets overwritten, corrupting the program.

load doesn't work in this case as it's just a part of an ELF that needs to be loaded in a specific spot, following its physical address (and would feel rather hacky regardless). I didn't want to touch the section headers for compatibility, leaving the virtual addresses case untouched, so I added a new attribute: elf_use_ph.

With that flag enabled, the program data will be copied using program header data at the physical address within.

Example usage:

the_ROM_image:
{
   [bootloader]szl.elf
   top.bit
   [elf_use_ph]runtime.elf
}

allows to use program headers and phaddr instead of sections with vaddr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant