aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86Subtarget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target/X86/X86Subtarget.cpp')
-rw-r--r--lib/Target/X86/X86Subtarget.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/Target/X86/X86Subtarget.cpp b/lib/Target/X86/X86Subtarget.cpp
index d1ed680287..0132f81410 100644
--- a/lib/Target/X86/X86Subtarget.cpp
+++ b/lib/Target/X86/X86Subtarget.cpp
@@ -160,7 +160,15 @@ const char *X86Subtarget::getBZeroEntry() const {
bool X86Subtarget::IsLegalToCallImmediateAddr(const TargetMachine &TM) const {
if (In64BitMode)
return false;
- return isTargetELF() || TM.getRelocationModel() == Reloc::Static;
+ // @LOCALMOD-BEGIN
+ // BUG= http://code.google.com/p/nativeclient/issues/detail?id=2367
+ // For NaCl dynamic linking we do not want to generate a text relocation to
+ // an absolute address in PIC mode. Such a situation arises from
+ // test/CodeGen/X86/call-imm.ll with the default implementation.
+ // For other platforms we retain the default behavior.
+ return (isTargetELF() && !isTargetNaCl()) ||
+ TM.getRelocationModel() == Reloc::Static;
+ // @LOCALMOD-END
}
void X86Subtarget::AutoDetectSubtargetFeatures() {
@@ -416,10 +424,11 @@ X86Subtarget::X86Subtarget(const std::string &TT, const std::string &CPU,
"64-bit code requested on a subtarget that doesn't support it!");
// Stack alignment is 16 bytes on Darwin, Linux and Solaris (both
- // 32 and 64 bit) and for all 64-bit targets.
+ // 32 and 64 bit), NaCl and for all 64-bit targets.
if (StackAlignOverride)
stackAlignment = StackAlignOverride;
else if (isTargetDarwin() || isTargetLinux() || isTargetSolaris() ||
+ isTargetNaCl() || // @LOCALMOD
In64BitMode)
stackAlignment = 16;
}