Relocatable ELF Object Help

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
bloodline
Member
Member
Posts: 264
Joined: Tue Sep 15, 2020 8:07 am
Location: London, UK

Re: Relocatable ELF Object Help

Post by bloodline »

Since position independent executables do work when using C code, but I can’t get the linker to output relocation information,my solution is to use gcc’s variable __attribute__ ( (section(.reloc))) tag to place the pointer I want to relocate into its own ELF section, this is obviously easy for my Loader to locate and then write the correct value to.

This feels a little hacky, but it works really well.
CuriOS: A single address space GUI based operating system built upon a fairly pure Microkernel/Nanokernel. Download latest bootable x86 Disk Image: https://github.com/h5n1xp/CuriOS/blob/main/disk.img.zip
Discord:https://discord.gg/zn2vV2Su
Post Reply