[llvm] r225166 - Emit the build attribute Tag_conformance.

Charlie Turner charlie.turner at arm.com
Mon Jan 5 05:12:18 PST 2015


Author: chatur01
Date: Mon Jan  5 07:12:17 2015
New Revision: 225166

URL: http://llvm.org/viewvc/llvm-project?rev=225166&view=rev
Log:
Emit the build attribute Tag_conformance.

Claim conformance to version 2.09 of the ARM ABI.

This build attribute must be emitted first amongst the build attributes when
written to an object file. This is to simplify conformance detection by
consumers.

Change-Id: If9eddcfc416bc9ad6e5cc8cdcb05d0031af7657e

Added:
    llvm/trunk/test/tools/llvm-readobj/ARM/attribute-conformance-1.s
    llvm/trunk/test/tools/llvm-readobj/ARM/attribute-conformance-2.s
Modified:
    llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
    llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
    llvm/trunk/test/CodeGen/ARM/build-attributes.ll
    llvm/trunk/test/MC/ARM/directive-eabi_attribute.s

Modified: llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp?rev=225166&r1=225165&r2=225166&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp Mon Jan  5 07:12:17 2015
@@ -629,6 +629,8 @@ void ARMAsmPrinter::emitAttributes() {
   MCTargetStreamer &TS = *OutStreamer.getTargetStreamer();
   ARMTargetStreamer &ATS = static_cast<ARMTargetStreamer &>(TS);
 
+  ATS.emitTextAttribute(ARMBuildAttrs::conformance, "2.09");
+
   ATS.switchVendor("aeabi");
 
   std::string CPUString = Subtarget->getCPUString();

Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp?rev=225166&r1=225165&r2=225166&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp Mon Jan  5 07:12:17 2015
@@ -300,7 +300,19 @@ private:
     StringRef StringValue;
 
     static bool LessTag(const AttributeItem &LHS, const AttributeItem &RHS) {
-      return (LHS.Tag < RHS.Tag);
+      // The conformance tag must be emitted first when serialised
+      // into an object file. Specifically, the addenda to the ARM ABI
+      // states that (2.3.7.4):
+      //
+      // "To simplify recognition by consumers in the common case of
+      // claiming conformity for the whole file, this tag should be
+      // emitted first in a file-scope sub-subsection of the first
+      // public subsection of the attributes section."
+      //
+      // So it is special-cased in this comparison predicate when the
+      // attributes are sorted in finishAttributeSection().
+      return (RHS.Tag != ARMBuildAttrs::conformance) &&
+             ((LHS.Tag == ARMBuildAttrs::conformance) || (LHS.Tag < RHS.Tag));
     }
   };
 

Modified: llvm/trunk/test/CodeGen/ARM/build-attributes.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/build-attributes.ll?rev=225166&r1=225165&r2=225166&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/build-attributes.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/build-attributes.ll Mon Jan  5 07:12:17 2015
@@ -279,6 +279,7 @@
 ; V7-FAST:   .eabi_attribute 23, 1
 
 ; V8:      .syntax unified
+; V8: .eabi_attribute 67, "2.09"
 ; V8: .eabi_attribute 6, 14
 ; V8-NOT:   .eabi_attribute 19
 ; V8: .eabi_attribute 20, 1

Modified: llvm/trunk/test/MC/ARM/directive-eabi_attribute.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/directive-eabi_attribute.s?rev=225166&r1=225165&r2=225166&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/directive-eabi_attribute.s (original)
+++ llvm/trunk/test/MC/ARM/directive-eabi_attribute.s Mon Jan  5 07:12:17 2015
@@ -5,6 +5,14 @@
         .syntax unified
         .thumb
 
+        .eabi_attribute Tag_conformance, "2.09"
+@ CHECK: .eabi_attribute 67, "2.09"
+@ Tag_conformance should be be emitted first in a file-scope
+@ sub-subsection of the first public subsection of the attributes
+@ section. 2.3.7.4 of ABI Addenda.
+@ CHECK-OBJ:        Tag: 67
+@ CHECK-OBJ-NEXT:   TagName: conformance
+@ CHECK-OBJ-NEXT:   Value: 2.09
 	.eabi_attribute Tag_CPU_raw_name, "Cortex-A9"
 @ CHECK: .eabi_attribute 4, "Cortex-A9"
 @ CHECK-OBJ:        Tag: 4
@@ -220,11 +228,6 @@
 @ CHECK-OBJ-NEXT:   Value: 0
 @ CHECK-OBJ-NEXT:   TagName: T2EE_use
 @ CHECK-OBJ-NEXT:   Description: Not Permitted
-	.eabi_attribute Tag_conformance, "2.09"
-@ CHECK: .eabi_attribute 67, "2.09"
-@ CHECK-OBJ:        Tag: 67
-@ CHECK-OBJ-NEXT:   TagName: conformance
-@ CHECK-OBJ-NEXT:   Value: 2.09
 	.eabi_attribute Tag_Virtualization_use, 0
 @ CHECK: .eabi_attribute 68, 0
 @ CHECK-OBJ:        Tag: 68

Added: llvm/trunk/test/tools/llvm-readobj/ARM/attribute-conformance-1.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/ARM/attribute-conformance-1.s?rev=225166&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/ARM/attribute-conformance-1.s (added)
+++ llvm/trunk/test/tools/llvm-readobj/ARM/attribute-conformance-1.s Mon Jan  5 07:12:17 2015
@@ -0,0 +1,8 @@
+@ RUN: llvm-mc -triple armv7-elf -filetype asm -o - %s | FileCheck %s
+@ RUN: llvm-mc -triple armv7-eabi -filetype obj -o - %s \
+@ RUN:   | llvm-readobj -arm-attributes - | FileCheck %s --check-prefix=CHECK-OBJ
+.eabi_attribute  Tag_conformance, "0"
+ at CHECK:   .eabi_attribute 67, "0"
+ at CHECK-OBJ: Tag: 67
+ at CHECK-OBJ-NEXT: TagName: conformance
+ at CHECK-OBJ-NEXT: Value: 0

Added: llvm/trunk/test/tools/llvm-readobj/ARM/attribute-conformance-2.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/ARM/attribute-conformance-2.s?rev=225166&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/ARM/attribute-conformance-2.s (added)
+++ llvm/trunk/test/tools/llvm-readobj/ARM/attribute-conformance-2.s Mon Jan  5 07:12:17 2015
@@ -0,0 +1,8 @@
+@ RUN: llvm-mc -triple armv7-elf -filetype asm -o - %s | FileCheck %s
+@ RUN: llvm-mc -triple armv7-eabi -filetype obj -o - %s \
+@ RUN:   | llvm-readobj -arm-attributes - | FileCheck %s --check-prefix=CHECK-OBJ
+.eabi_attribute  Tag_conformance, "A.long--non numeric oddity...!!"
+ at CHECK:   .eabi_attribute 67, "A.long--non numeric oddity...!!"
+ at CHECK-OBJ: Tag: 67
+ at CHECK-OBJ-NEXT: TagName: conformance
+ at CHECK-OBJ-NEXT: Value: A.long--non numeric oddity...!!





More information about the llvm-commits mailing list