Rafael, I believe MachO can't represent this relocation, even in non-PIC mode. On my Mac, I tried compiling "call 256". I got: in section __TEXT,__text reloc 0: R_ABS reloc but no absolute symbol at target address I believe the correct thing to do is: isTargetELF() && TM.getRelocationModel() == Reloc::Static This will do the right thing on ELF, and the right thing on other formats. This may have been the original intent. - pdox
2011/10/21 David Meyer <pdox at google.com>> Rafael,> > I believe MachO can't represent this relocation, even in non-PIC mode. > On my Mac, I tried compiling "call 256". I got:I think PIC is just the default (the kernel being non-PIC for example), but I am not sure.> in section __TEXT,__text reloc 0: R_ABS reloc but no absolute symbol > at target address > > I believe the correct thing to do is: > > isTargetELF() && TM.getRelocationModel() == Reloc::Static > > This will do the right thing on ELF, and the right thing on other > formats. This may have been the original intent.Could be, echristo, bigcheese, would this be correct for Mach-O and COFF?> - pdox >Cheers, Rafael
Rafael Ávila de Espíndola
2011-Oct-21 18:05 UTC
[LLVMdev] Typo in IsLegalToCallImmediateAddr?
> Could be, echristo, bigcheese, would this be correct for Mach-O and COFF?bigcheese noted on IRC that the test crashes the COFF emitter. For some reason I am always getting movl $256, %eax ## imm = 0x100 calll *%eax on darwin already, so I guess you are right, the correct would be isTargetELF() && TM.getRelocationModel() == Reloc::Static; Please include a test with the commit :-) Cheers, Rafael