I'm writing my own operating system (static addresses) and I struggle to get the linker to always put my _start
function at my desired location within the processes. I specify the location with -Ttext 0x10000
in my build file (Lets just say 0x10000 for this example).
Normally this works, but when i use -O2
the linker puts my main
function on this address instead.
So how can i make sure that it is _start
that ends up on this address?
And is it possible without writing linker scripts?
The function _start
is common for all processes and should enforce a nice exit for the scheduler in cases where the program returns instead of calling the exit()
. I have a workaround solution in my head but I would preferred to get this working with the linker instead.