]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gnu directives: bfd: generic tests for objcopy of gnu attributes v2
authorMatthieu Longo <matthieu.longo@arm.com>
Thu, 10 Apr 2025 16:22:51 +0000 (17:22 +0100)
committerMatthieu Longo <matthieu.longo@arm.com>
Thu, 22 Jan 2026 10:11:17 +0000 (10:11 +0000)
binutils/testsuite/binutils-all/objcopy.exp
binutils/testsuite/binutils-all/object-attr-v2.d [new file with mode: 0644]
binutils/testsuite/binutils-all/object-attr-v2.s [new file with mode: 0644]

index 459a2e6cd7ed465bfd2e114eb943c9dca3ad963a..3ad92256610f826054d58bfb375f4438a8ef9887 100644 (file)
@@ -1329,6 +1329,7 @@ if [is_elf_format] {
        run_dump_test "note-6-32"
     }
     run_dump_test "note-5"
+    run_dump_test "object-attr-v2"
 }
 
 run_dump_test "copy-2"
diff --git a/binutils/testsuite/binutils-all/object-attr-v2.d b/binutils/testsuite/binutils-all/object-attr-v2.d
new file mode 100644 (file)
index 0000000..8c94b52
--- /dev/null
@@ -0,0 +1,52 @@
+#name: Copy object attributes v2 data from an object to another.
+#PROG: objcopy
+#target: [supports_oa_v2]
+#readelf: -A
+
+Subsections:
+ - Name:[       ]+foo_1
+   Scope:[      ]+private
+   Length:[     ]+20
+   Comprehension:[      ]+optional
+   Encoding:[   ]+ULEB128
+   Values:
+ +Tag_unknown_1:[       ]+1 .*
+ +Tag_unknown_2:[       ]+0 .*
+ +Tag_unknown_3:[       ]+0 .*
+ +Tag_unknown_4:[       ]+0 .*
+
+ - Name:[       ]+foo_2
+   Scope:[      ]+private
+   Length:[     ]+16
+   Comprehension:[      ]+optional
+   Encoding:[   ]+ULEB128
+   Values:
+ +Tag_unknown_0:[       ]+1 .*
+ +Tag_unknown_1:[       ]+1 .*
+
+ - Name:[       ]+foo_3
+   Scope:[      ]+private
+   Length:[     ]+26
+   Comprehension:[      ]+optional
+   Encoding:[   ]+NTBS
+   Values:
+ +Tag_unknown_0:[       ]+"hello"
+ +Tag_unknown_1:[       ]+"world"
+
+ - Name:[       ]+gnu_bar
+   Scope:[      ]+public
+   Length:[     ]+20
+   Comprehension:[      ]+optional
+   Encoding:[   ]+ULEB128
+   Values:
+ +Tag_unknown_0:[       ]+1 .*
+ +Tag_unknown_1:[       ]+0 .*
+ +Tag_unknown_2:[       ]+1 .*
+
+ - Name:[       ]+gnu_foo
+   Scope:[      ]+public
+   Length:[     ]+16
+   Comprehension:[      ]+required
+   Encoding:[   ]+ULEB128
+   Values:
+ +Tag_unknown_1:[       ]+1 .*
diff --git a/binutils/testsuite/binutils-all/object-attr-v2.s b/binutils/testsuite/binutils-all/object-attr-v2.s
new file mode 100644 (file)
index 0000000..d502950
--- /dev/null
@@ -0,0 +1,31 @@
+       .gnu_subsection gnu_foo, required, uleb128
+       .gnu_attribute 1, 1
+
+       .gnu_subsection gnu_bar, optional, uleb128
+       .gnu_attribute 0, 1
+       .gnu_attribute 1, 0
+       .gnu_attribute 2, 1
+
+       .gnu_subsection foo_1, optional, uleb128
+       .gnu_attribute 1, 1
+
+       .gnu_subsection foo_2, optional, uleb128
+       .gnu_attribute 0, 1
+       .gnu_attribute 1, 1
+
+       .gnu_subsection foo_1, optional, uleb128
+       .gnu_attribute 2, 0
+
+       .gnu_subsection foo_2, optional, uleb128
+       .gnu_attribute 1, 1
+
+       .gnu_subsection foo_1, optional, uleb128
+       .gnu_attribute 2, 0
+
+       .gnu_subsection foo_1, optional, uleb128
+       .gnu_attribute 3, 0
+       .gnu_attribute 4, 0
+
+       .gnu_subsection foo_3, optional, ntbs
+       .gnu_attribute 0, "hello"
+       .gnu_attribute 1, "world"