PowerPC paranioa testing of symbol merging involving comdat groups
Alan Modra
amodra@gmail.com
Wed Nov 18 13:22:42 GMT 2020
Ensures we don't mistreat st_other localentry bits.
* testsuite/ld-powerpc/group1.d,
* testsuite/ld-powerpc/group1.s,
* testsuite/ld-powerpc/group1.sym,
* testsuite/ld-powerpc/group2.d,
* testsuite/ld-powerpc/group2.s,
* testsuite/ld-powerpc/group2.sym,
* testsuite/ld-powerpc/group3.s,
* testsuite/ld-powerpc/group3.sym: New test files.
* testsuite/ld-powerpc/powerpc.exp: Run new tests.
diff --git a/ld/testsuite/ld-powerpc/group1.d b/ld/testsuite/ld-powerpc/group1.d
new file mode 100644
index 0000000000..848e2ab707
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/group1.d
@@ -0,0 +1,14 @@
+#source: group1.s
+#source: group2.s
+#source: group3.s
+#as: -a64 -e foo
+#ld: -melf64ppc
+#objdump: -d
+
+.*
+
+Disassembly of section \.text:
+
+.* <foo>:
+.*: (60 00 00 00|00 00 00 60) nop
+.*: (4e 80 00 20|20 00 80 4e) blr
diff --git a/ld/testsuite/ld-powerpc/group1.s b/ld/testsuite/ld-powerpc/group1.s
new file mode 100644
index 0000000000..cb918a5272
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/group1.s
@@ -0,0 +1,10 @@
+ .abiversion 2
+ .section .text,"axG",%progbits,foo,comdat
+ .globl foo
+ .type foo,%function
+foo:
+0:
+ nop
+ .localentry foo,.-0b
+ blr
+ .size foo,.-0b
diff --git a/ld/testsuite/ld-powerpc/group1.sym b/ld/testsuite/ld-powerpc/group1.sym
new file mode 100644
index 0000000000..4ad8c176d2
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/group1.sym
@@ -0,0 +1,3 @@
+#...
+.* 8 FUNC +GLOBAL DEFAULT \[<localentry>: 4\] +1 foo
+#pass
diff --git a/ld/testsuite/ld-powerpc/group2.d b/ld/testsuite/ld-powerpc/group2.d
new file mode 100644
index 0000000000..361100607e
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/group2.d
@@ -0,0 +1,13 @@
+#source: group2.s
+#source: group1.s
+#source: group3.s
+#as: -a64 -e foo
+#ld: -melf64ppc
+#objdump: -d
+
+.*
+
+Disassembly of section \.text:
+
+.* <foo>:
+.*: (4e 80 00 20|20 00 80 4e) blr
diff --git a/ld/testsuite/ld-powerpc/group2.s b/ld/testsuite/ld-powerpc/group2.s
new file mode 100644
index 0000000000..882745cf42
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/group2.s
@@ -0,0 +1,9 @@
+ .abiversion 2
+ .section .text,"axG",%progbits,foo,comdat
+ .globl foo
+ .type foo,%function
+foo:
+0:
+ .localentry foo,0
+ blr
+ .size foo,.-0b
diff --git a/ld/testsuite/ld-powerpc/group2.sym b/ld/testsuite/ld-powerpc/group2.sym
new file mode 100644
index 0000000000..509978a077
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/group2.sym
@@ -0,0 +1,3 @@
+#...
+.* 4 FUNC +GLOBAL DEFAULT +1 foo
+#pass
diff --git a/ld/testsuite/ld-powerpc/group3.s b/ld/testsuite/ld-powerpc/group3.s
new file mode 100644
index 0000000000..075ee2f8e5
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/group3.s
@@ -0,0 +1,9 @@
+ .abiversion 2
+ .section .text,"axG",%progbits,foo,comdat
+ .globl foo
+ .type foo,%function
+foo:
+0:
+ .localentry foo,1
+ blr
+ .size foo,.-0b
diff --git a/ld/testsuite/ld-powerpc/group3.sym b/ld/testsuite/ld-powerpc/group3.sym
new file mode 100644
index 0000000000..6b5028d474
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/group3.sym
@@ -0,0 +1,3 @@
+#...
+.* 4 FUNC +GLOBAL DEFAULT \[<localentry>: 1\] +1 foo
+#pass
diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp
index 2cbefb841c..e780d2e6f6 100644
--- a/ld/testsuite/ld-powerpc/powerpc.exp
+++ b/ld/testsuite/ld-powerpc/powerpc.exp
@@ -335,6 +335,15 @@ set ppc64elftests {
"-a64 -mpower10" {pcrelopt.s}
{{objdump {-d -Mpower10} pcrelopt.d}
{readelf {-S --wide} pcrelopt.sec}} "pcrelopt" }
+ {"group1" "-melf64ppc -e foo" "" "-a64" {group1.s group2.s group3.s}
+ {{objdump {-d} group1.d}
+ {readelf {-s} group1.sym}} "group1"}
+ {"group2" "-melf64ppc -e foo" "" "-a64" {group2.s group1.s group3.s}
+ {{objdump {-d} group2.d}
+ {readelf {-s} group2.sym}} "group2"}
+ {"group3" "-melf64ppc -e foo" "" "-a64" {group3.s group2.s group1.s}
+ {{objdump {-d} group2.d}
+ {readelf {-s} group3.sym}} "group3"}
}
set ppceabitests {
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list