ARM64: disable generation of .loh directives outside MachO.
authorTim Northover <tnorthover@apple.com>
Fri, 18 Apr 2014 14:54:46 +0000 (14:54 +0000)
committerTim Northover <tnorthover@apple.com>
Fri, 18 Apr 2014 14:54:46 +0000 (14:54 +0000)
Part of PR19455.

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

lib/Target/ARM64/ARM64TargetMachine.cpp
test/CodeGen/ARM64/collect-loh.ll

index 946a0ee59e271f62025cc9c20a858183bee50342..8070ce0d8b2a2bb5f1617a012defe60e34da70b0 100644 (file)
@@ -165,7 +165,8 @@ bool ARM64PassConfig::addPreEmitPass() {
   // Relax conditional branch instructions if they're otherwise out of
   // range of their destination.
   addPass(createARM64BranchRelaxation());
-  if (TM->getOptLevel() != CodeGenOpt::None && EnableCollectLOH)
+  if (TM->getOptLevel() != CodeGenOpt::None && EnableCollectLOH &&
+      TM->getSubtarget<ARM64Subtarget>().isTargetMachO())
     addPass(createARM64CollectLOHPass());
   return true;
 }
index 08ab0620b8b751aab43f11fbf976be02d6577008..e92690b04f8c290c357347e606dc45c705c2a732 100644 (file)
@@ -1,4 +1,10 @@
 ; RUN: llc -mtriple=arm64-apple-ios -O2 -arm64-collect-loh -arm64-collect-loh-bb-only=false < %s -o - | FileCheck %s
+; RUN: llc -mtriple=arm64-linux-gnu -O2 -arm64-collect-loh -arm64-collect-loh-bb-only=false < %s -o - | FileCheck %s --check-prefix=CHECK-ELF
+
+; CHECK-ELF-NOT: .loh
+; CHECK-ELF-NOT: AdrpAdrp
+; CHECK-ELF-NOT: AdrpAdd
+; CHECK-ELF-NOT: AdrpLdrGot
 
 @a = internal unnamed_addr global i32 0, align 4
 @b = external global i32