From e4d9e5422fa233e9e32ce89e07a5a6ca89e85090 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 18 Nov 2020 20:29:25 +1030 Subject: [PATCH] PowerPC paranioa testing of symbol merging involving comdat groups 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. --- ld/ChangeLog | 12 ++++++++++++ ld/testsuite/ld-powerpc/group1.d | 14 ++++++++++++++ ld/testsuite/ld-powerpc/group1.s | 10 ++++++++++ ld/testsuite/ld-powerpc/group1.sym | 3 +++ ld/testsuite/ld-powerpc/group2.d | 13 +++++++++++++ ld/testsuite/ld-powerpc/group2.s | 9 +++++++++ ld/testsuite/ld-powerpc/group2.sym | 3 +++ ld/testsuite/ld-powerpc/group3.s | 9 +++++++++ ld/testsuite/ld-powerpc/group3.sym | 3 +++ ld/testsuite/ld-powerpc/powerpc.exp | 9 +++++++++ 10 files changed, 85 insertions(+) create mode 100644 ld/testsuite/ld-powerpc/group1.d create mode 100644 ld/testsuite/ld-powerpc/group1.s create mode 100644 ld/testsuite/ld-powerpc/group1.sym create mode 100644 ld/testsuite/ld-powerpc/group2.d create mode 100644 ld/testsuite/ld-powerpc/group2.s create mode 100644 ld/testsuite/ld-powerpc/group2.sym create mode 100644 ld/testsuite/ld-powerpc/group3.s create mode 100644 ld/testsuite/ld-powerpc/group3.sym diff --git a/ld/ChangeLog b/ld/ChangeLog index 0e2ddeeed6b..e9da9f8c887 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,15 @@ +2020-11-18 Alan Modra + + * 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. + 2020-11-18 Jozef Lawrynowicz * NEWS: Announce support for SHF_GNU_RETAIN. diff --git a/ld/testsuite/ld-powerpc/group1.d b/ld/testsuite/ld-powerpc/group1.d new file mode 100644 index 00000000000..848e2ab7075 --- /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: + +.* : +.*: (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 00000000000..cb918a5272a --- /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 00000000000..4ad8c176d2e --- /dev/null +++ b/ld/testsuite/ld-powerpc/group1.sym @@ -0,0 +1,3 @@ +#... +.* 8 FUNC +GLOBAL DEFAULT \[: 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 00000000000..361100607e1 --- /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: + +.* : +.*: (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 00000000000..882745cf428 --- /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 00000000000..509978a0776 --- /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 00000000000..075ee2f8e5c --- /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 00000000000..6b5028d474a --- /dev/null +++ b/ld/testsuite/ld-powerpc/group3.sym @@ -0,0 +1,3 @@ +#... +.* 4 FUNC +GLOBAL DEFAULT \[: 1\] +1 foo +#pass diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp index 2cbefb841c2..e780d2e6f6c 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 { -- 2.30.2