diff options
| -rw-r--r-- | llvm/lib/Target/ARM/ARMTargetMachine.cpp | 4 | ||||
| -rw-r--r-- | llvm/test/CodeGen/ARM/default-reloc.ll | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/Target/ARM/ARMTargetMachine.cpp b/llvm/lib/Target/ARM/ARMTargetMachine.cpp index d3276f79b5e..b2b6f3ae547 100644 --- a/llvm/lib/Target/ARM/ARMTargetMachine.cpp +++ b/llvm/lib/Target/ARM/ARMTargetMachine.cpp @@ -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()) diff --git a/llvm/test/CodeGen/ARM/default-reloc.ll b/llvm/test/CodeGen/ARM/default-reloc.ll new file mode 100644 index 00000000000..0b80b73061b --- /dev/null +++ b/llvm/test/CodeGen/ARM/default-reloc.ll @@ -0,0 +1,5 @@ +; RUN: llc -mtriple=armv7-linux-gnu -O0 < %s +@a = external global i32 +define i32* @get() { + ret i32* @a +} |

