Fix default reloc model on ARM.

llvm-svn: 271111
This commit is contained in:
Rafael Espindola 2016-05-28 10:41:15 +00:00
parent 96d06c6972
commit fe796dca90
2 changed files with 7 additions and 2 deletions

View File

@ -175,8 +175,8 @@ static std::string computeDataLayout(const Triple &TT, StringRef CPU,
static Reloc::Model getEffectiveRelocModel(const Triple &TT,
Optional<Reloc::Model> RM) {
if (!RM.hasValue())
// Default relocation model on Darwin is PIC, not DynamicNoPIC.
return TT.isOSDarwin() ? Reloc::PIC_ : Reloc::DynamicNoPIC;
// Default relocation model on Darwin is PIC.
return TT.isOSBinFormatMachO() ? Reloc::PIC_ : Reloc::Static;
// DynamicNoPIC is only used on darwin.
if (*RM == Reloc::DynamicNoPIC && !TT.isOSDarwin())

View File

@ -0,0 +1,5 @@
; RUN: llc -mtriple=armv7-linux-gnu -O0 < %s
@a = external global i32
define i32* @get() {
ret i32* @a
}