How to tell g++ to use only relative instructions?

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.
sebihepp
Member
Member
Posts: 194
Joined: Tue Aug 26, 2008 11:24 am
GitHub: https://github.com/sebihepp

Re: How to tell g++ to use only relative instructions?

Post by sebihepp »

In our kernel we load kernel modules which are basically just ELF object files (linked with "-r"). They are relocated at runtime by the module loader, which finds space in the area of memory reserved for modules and then loads the module into that region. It performs relocation and linking against both the kernel symbols and the symbols of other modules that are present.
Hey, that's an interessting idea. :) The Kernel is like a runtime linker. :D
I'm not sure about much of your kernel design, but maybe you could pick something up from our design and make it work for you?
Thanks, but I want to write my own code and learn something.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: How to tell g++ to use only relative instructions?

Post by pcmattman »

sebihepp wrote:
I'm not sure about much of your kernel design, but maybe you could pick something up from our design and make it work for you?
Thanks, but I want to write my own code and learn something.
Absolutely. I meant pick up design ideas, not free code, though :)
Post Reply