Page 2 of 2

Re: 64-bit memory models

Posted: Sat Oct 06, 2012 10:27 am
by NickJohnson
Hmm, it seems you're right. Almost thought I had it there :P

Any other ideas?

Re: 64-bit memory models

Posted: Sat Oct 06, 2012 10:47 am
by Cognition
Possibly -flto and then use the gold linker. There's also the option of -fwhole-program, though you'd have to compile differently. Lastly there's always the option of switching to an clang + LLVM based build system and using their intermediate files to perform whole program optimization (a bit more complicated but doable).

Re: 64-bit memory models

Posted: Sat Oct 06, 2012 12:15 pm
by NickJohnson
That seems like a bit of a hack... I'm surprised there isn't any way to get GCC to do this properly. All it needs to do is emit a R_X86_64_PC32 relocation for an external symbol. I might go bug the GCC people directly and see if I can't get an answer.

For now, I can deal with not being able to directly reference global variables in other translation units (doing so is so-so design-wise anyway, and I can deal with a restricted environment for this component) but it would be nice to fix this eventually.

Re: 64-bit memory models

Posted: Sat Oct 06, 2012 1:46 pm
by Owen
Hmm, random thought: Tried "-static"?

In dynamic mode, the symbols could theortically be to other DSOs. In static mode, this wouldn't be the case.

Re: 64-bit memory models

Posted: Sat Oct 06, 2012 1:57 pm
by NickJohnson
Yeah, I tried -static too. It doesn't seem to affect anything.