// If this is for a position dependent executable, the static linker can
// figure it out.
- if (TM.getRelocationModel() != Reloc::PIC_)
+ if (!isPositionIndependent())
return X86II::MO_NO_FLAG;
// The COFF dynamic linker just patches the executable sections.
return X86II::MO_GOTPCREL;
if (isTargetDarwin()) {
- if (RM != Reloc::PIC_)
+ if (!isPositionIndependent())
return X86II::MO_DARWIN_NONLAZY;
return X86II::MO_DARWIN_NONLAZY_PIC_BASE;
}
} else if (isTargetCOFF()) {
setPICStyle(PICStyles::None);
} else if (isTargetDarwin()) {
- if (TM.getRelocationModel() == Reloc::PIC_)
+ if (isPositionIndependent())
setPICStyle(PICStyles::StubPIC);
else {
assert(TM.getRelocationModel() == Reloc::DynamicNoPIC);
PICStyle == PICStyles::StubPIC;
}
+ bool isPositionIndependent() const {
+ return TM.getRelocationModel() == Reloc::PIC_;
+ }
+
bool isCallingConvWin64(CallingConv::ID CC) const {
switch (CC) {
// On Win64, all these conventions just use the default convention.