I was able to work around this by using
Code: Select all
-mcmodel=large
Basically, every single call will end up being compiled to something like this:
Code: Select all
mov address, %eax
callq *%eax
I found this surprising, I figured that gcc would be smart enough to use 32-bit relative displacements at least when the two functions are in the same translation unit (same file). But alas it does this for every single call. I know gcc is being safe, but has anyone figured out a way to indentify the cause of these relocation errors and code around them?
As far as I can tell, linux works around this by putting it's kernel code in the last 2GB of the address space and using
Code: Select all
-mcmodel=kernel
What are people's experiences with this?