[llvm] r188726 - Adding PIC support for ELF on x86_64 platforms

Hi Lang,

Yeah, I remember this case. Basically what’s happening is that there are relocations for ELF on x86 that use a value that is present in the object image as part of the calculation for the final value that goes in the same location. If you ever find yourself applying relocations for a second time (for instance, because the loaded object location is remapped for out-of-proc execution) the original value is no longer in the loaded object.

You could probably figure out a way to combine the placeholder value with the addend field, either while the relocation records are being built (though I’m not sure if the relevant sections have been loaded yet at that point) or the first time the relocation is applied (though it might be a bit cumbersome to know whether or not any given application was the first).

-Andy

Hi Andy,

Thanks very much for the insight. I’ll see if I can come up with a scheme to support reapplication without having the object file present.

Cheers,
Lang.

Hi Lang,

Did you ever make any progress on this? I ran into the same problem when rewriting the GOT support (though for a different reason). If not, I can take a crack at it, but I wanted to avoid duplicating effort.

Thanks,
Keno

Hi Keno,

I haven’t had a chance to get to it yet. If you have time to check it out please go for it - it would be very appreciated.

Cheers,
Lang.