ARM: only emit EABI attributes on EABI targets
authorSaleem Abdulrasool <compnerd@compnerd.org>
Sun, 13 Dec 2015 05:27:45 +0000 (05:27 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Sun, 13 Dec 2015 05:27:45 +0000 (05:27 +0000)
EABI attributes should only be emitted on EABI targets.  This prevents the
emission of the optimization goals EABI attribute on Windows ARM.

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

lib/Target/ARM/ARMAsmPrinter.cpp
test/CodeGen/ARM/Windows/no-eabi.ll [new file with mode: 0644]

index 61141c0031df07eb80765edfec3d652d42489634..206db9619a2f1b34b3b19273ad736fb6172dfe6d 100644 (file)
@@ -540,7 +540,8 @@ void ARMAsmPrinter::EmitEndOfAsmFile(Module &M) {
   MCTargetStreamer &TS = *OutStreamer->getTargetStreamer();
   ARMTargetStreamer &ATS = static_cast<ARMTargetStreamer &>(TS);
 
-  if (OptimizationGoals > 0)
+  if (OptimizationGoals > 0 &&
+      (Subtarget->isTargetAEABI() || Subtarget->isTargetGNUAEABI()))
     ATS.emitAttribute(ARMBuildAttrs::ABI_optimization_goals, OptimizationGoals);
   OptimizationGoals = -1;
 
diff --git a/test/CodeGen/ARM/Windows/no-eabi.ll b/test/CodeGen/ARM/Windows/no-eabi.ll
new file mode 100644 (file)
index 0000000..033ca02
--- /dev/null
@@ -0,0 +1,10 @@
+; RUN: llc -O3 -mtriple thumbv7-windows %s -filetype asm -o - | FileCheck -check-prefix CHECK-NONEABI %s
+; RUN: llc -O3 -mtriple armv7--linux-gnueabi %s -filetype asm -o - | FileCheck -check-prefix CHECK-EABI %s
+
+define arm_aapcs_vfpcc void @function() {
+  ret void
+}
+
+; CHECK-EABI: .eabi_attribute
+; CHECK-NONEABI-NOT: .eabi_attribute
+