Forcing ld to link 32 and 64 bit code together

Jack Black theworkaccount2@gmail.com
Fri Jan 3 14:21:00 GMT 2014


I know you're reading this just to say "it can't be done." But listen.

I'm making some code that will exist in the transition between a 32
bit non-paged environment to a 64 bit paged environment. So my 32 bit
code will turn on 64 bit page tables, and then it needs to jump to 64
bit code. I want to end the 32 bit code with a relative jump to the
symbol name for the 64 bit code, and I just want the linker to fill in
the offset for me (or else I'm just going to have to manually emit the
bytes myself and fix up the offset manually every time the code
changes.)

Is it possible to override the (understandable, correct) behavior of
ld to force it to link 32 and 64 bit together? If not, is there a
specific place I can look in the source to disable the sanity check
for linking 32 and 64 bit code together?

Thanks

JB



More information about the Binutils mailing list