[LLVMdev] Problem with X86Subtarget::IsLegalToCallImmediateAddr()

David Meyer pdox at google.com
Sun Oct 16 00:44:02 PDT 2011


The current rule is:

/// IsLegalToCallImmediateAddr - Return true if the subtarget allows calls
/// to immediate address.
bool X86Subtarget::IsLegalToCallImmediateAddr(const TargetMachine &TM) const {
  if (In64BitMode)
    return false;
  return isTargetELF() || TM.getRelocationModel() == Reloc::Static;
}

But this is not doing the correct thing for ELF PIC. The
straight-forward way to fix this is to change the || to &&.

However, this would make the function always return false for other
object file formats. I was under the impression only ELF had the
ability to emit this type of relocation anyway. Am I mistaken?

Thanks,
 David



More information about the llvm-dev mailing list