summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2014-01-19 08:25:41 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2014-01-19 08:25:41 +0000
commitd0fb7e49cceaa8dec6d91fae34e426352fd9979b (patch)
tree2b27111b58592fc9fbd70d87b2c94fd22ddc3bd8
parent70c092f3ec6b12211090a235ac4f72e8c5dd597a (diff)
downloadllvm-d0fb7e49cceaa8dec6d91fae34e426352fd9979b.tar.gz
llvm-d0fb7e49cceaa8dec6d91fae34e426352fd9979b.tar.bz2
llvm-d0fb7e49cceaa8dec6d91fae34e426352fd9979b.tar.xz
ARM ELF: ensure that the tag types are corrected
Ensure that the tag types are reflected on a replacement. This is particularly important for the compatibility tag which has multiple representations where the last definition wins. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199577 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp3
-rw-r--r--test/MC/ARM/directive-eabi_attribute-overwrite.s18
2 files changed, 21 insertions, 0 deletions
diff --git a/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp b/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
index 1e3dc61744..4c07926294 100644
--- a/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
+++ b/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
@@ -290,6 +290,7 @@ private:
if (AttributeItem *Item = getAttributeItem(Attribute)) {
if (!OverwriteExisting)
return;
+ Item->Type = AttributeItem::NumericAttribute;
Item->IntValue = Value;
return;
}
@@ -310,6 +311,7 @@ private:
if (AttributeItem *Item = getAttributeItem(Attribute)) {
if (!OverwriteExisting)
return;
+ Item->Type = AttributeItem::TextAttribute;
Item->StringValue = Value;
return;
}
@@ -330,6 +332,7 @@ private:
if (AttributeItem *Item = getAttributeItem(Attribute)) {
if (!OverwriteExisting)
return;
+ Item->Type = AttributeItem::NumericAndTextAttributes;
Item->IntValue = IntValue;
Item->StringValue = StringValue;
return;
diff --git a/test/MC/ARM/directive-eabi_attribute-overwrite.s b/test/MC/ARM/directive-eabi_attribute-overwrite.s
new file mode 100644
index 0000000000..3e257dbe9d
--- /dev/null
+++ b/test/MC/ARM/directive-eabi_attribute-overwrite.s
@@ -0,0 +1,18 @@
+@ RUN: llvm-mc -triple armv7-eabi -filetype obj -o - %s | llvm-readobj -s -sd \
+@ RUN: | FileCheck %s
+
+ .syntax unified
+ .thumb
+
+ .eabi_attribute Tag_compatibility, 1
+ .eabi_attribute Tag_compatibility, 1, "aeabi"
+
+@ CHECK: Section {
+@ CHECK: Name: .ARM.attributes
+@ CHECK: Type: SHT_ARM_ATTRIBUTES
+@ CHECK: SectionData (
+@ CHECK: 0000: 41170000 00616561 62690001 0D000000
+@ CHECK: 0010: 20014145 41424900
+@ CHECK: )
+@ CHECK: }
+