Fixed Bug 2751
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Mon, 15 Sep 2008 21:06:55 +0000 (21:06 +0000)
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Mon, 15 Sep 2008 21:06:55 +0000 (21:06 +0000)
http://llvm.org/bugs/show_bug.cgi?id=2751

Abicall was enabled even when static code model was provided
in the command line.
The correct behavior is to disable abicall when static is
specified.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56228 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Mips/MipsSubtarget.cpp
lib/Target/Mips/MipsTargetMachine.cpp

index 530920b03c32a40bfa2944aaba1403abb0690921..48f58a55aadafbdbbbd0d8bed77c805aab4d0ea0 100644 (file)
@@ -65,9 +65,9 @@ MipsSubtarget::MipsSubtarget(const TargetMachine &TM, const Module &M,
     HasCondMov = true;
   }
 
-  // Abicall is the default for O32 ABI and is ignored 
-  // for EABI.
-  if (NotABICall || isABI_EABI())
+  // Abicall is the default for O32 ABI, but is disabled within EABI and in
+  // static code.
+  if (NotABICall || isABI_EABI() || (TM.getRelocationModel() == Reloc::Static))
     HasABICall = false;
 
   // TODO: disable when handling 64 bit symbols in the future.
index b24e498ae4763ec42b63dfc2d1a93b85070f6b71..276868cbb203c4b05608c85a0c7ffc491d5abbb4 100644 (file)
@@ -46,7 +46,7 @@ MipsTargetMachine(const Module &M, const std::string &FS, bool isLittle=false):
   TLInfo(*this) 
 {
   // Abicall enables PIC by default
-  if (Subtarget.hasABICall() && (getRelocationModel() != Reloc::Static))
+  if (Subtarget.hasABICall())
     setRelocationModel(Reloc::PIC_);  
 
   // TODO: create an option to enable long calls, like -mlong-calls,