The current testsuite for gas/readelf lacked two tests for EABI build
attributes:
- one when the final attribute is an empty string.
- one when the final attribute is a string missing the NULL terminator.
Those two issues cannot occur with Object Attributes v1 (OAv1) sections
created by the GNU binutils. Indeed a value of '\0' (empty string) for a
tag with a string value is considered as the default value for the
attribute, and consequently is eliminated by Gas from the output object
file during the serialization.
However, readelf should be able to process correctly files of an unknown
origin that could contain those two use cases.
This patch adds the two tests mentioned above. The first one is marked
as XFAIL because the empty string is not processed correctly by readelf
when it is in the last position. The second one passes, but simply print
out "[...]" without mentioning that the NTBS is corrupted.
A following patch will fix the bug in readelf, and will amend the newly
introduced tests.
--- /dev/null
+# name: EABI attribute - empy string
+# source: attr-empty-string.s
+# as:
+# readelf: -T -A
+# This test is only valid on EABI based ports.
+# target: *-*-*eabi* *-*-nacl*
+# xfail: *
+
+Attribute Section: aeabi
+File Attributes
+ Tag_CPU_raw_name: ""
--- /dev/null
+ .section .XXX.attributes, "", %0x70000003
+ # Format version
+ .byte 'A'
+ # Size
+ .4byte (.Lend_attrs - .)
+ # "Vendor"
+ .asciz "aeabi"
+ # File scope
+ .byte 1
+ # Size
+ .4byte (.Lend_attrs - . + 1)
+ .uleb128 4
+ .asciz ""
+.Lend_attrs:
--- /dev/null
+# name: EABI attribute - non-null terminated string
+# source: attr-non-null-terminated-string.s
+# This test is only valid on EABI based ports.
+# target: *-*-*eabi* *-*-nacl*
+# as:
+# readelf: --silent-truncation -A
+Attribute Section: aeabi
+File Attributes
+ Tag_CPU_raw_name: "ab"
--- /dev/null
+ .section .XXX.attributes, "", %0x70000003
+ # Format version
+ .byte 'A'
+ # Size
+ .4byte (.Lend_attrs - .)
+ # "Vendor"
+ .asciz "aeabi"
+ # File scope
+ .byte 1
+ # Size
+ .4byte (.Lend_attrs - . + 1)
+ .uleb128 4
+ .byte 'a', 'b', 'c'
+.Lend_attrs: