[LLVMdev] Typo in IsLegalToCallImmediateAddr?
David Meyer
pdox at google.com
Mon Oct 17 16:24:54 PDT 2011
Rafael,
I believe your example is not related to IsLegalToCallImmediateAddr.
This is an example of calling to an immediate address:
typedef int (*funcptr)(void);
int main() {
funcptr foo = (funcptr)0x100;
foo();
}
If IsLegalToCallImmedateAddr is true, this generates a call to
absolute address 0x100:
call 0x100
This requires a relocation of the value 0x100 - PC.
(NOTE: this is NOT the same as: "foo: call foo+0x100", which requires
no relocation)
This can't be done correctly in PIC mode. If you do this in a shared
library, the relocation is ignored and you get a jump to module_start
+ 0x100 instead of absolute 0x100.
- pdox
More information about the llvm-dev
mailing list