aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-elf
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2023-08-30 10:24:56 -0700
committerH.J. Lu <hjl.tools@gmail.com>2023-08-30 17:17:31 -0700
commit68a2d9bf874643da970fe945a9c60c397f6882ad (patch)
tree60eaddb169ea2d0e6e51cdcfc05b3e8200fefc8c /ld/testsuite/ld-elf
parentbac5753ca24bbbd601b6be93faa40e9458d8baa5 (diff)
downloadgdb-68a2d9bf874643da970fe945a9c60c397f6882ad.zip
gdb-68a2d9bf874643da970fe945a9c60c397f6882ad.tar.gz
gdb-68a2d9bf874643da970fe945a9c60c397f6882ad.tar.bz2
elf: Don't merge sections with different SHF_LINK_ORDER
For relocatable link, don't merge 2 SHF_LINK_ORDER sections if output sections of their linked to sections are different. * ldelf.c (elf_orphan_compatible): Don't merge sections with different SHF_LINK_ORDER. * testsuite/ld-elf/pr30791a.d: New file. * testsuite/ld-elf/pr30791a.s: Likewise. * testsuite/ld-elf/pr30791b.d: Likewise. * testsuite/ld-elf/pr30791b.s: Likewise. * testsuite/ld-elf/pr30791c.s: Likewise. * testsuite/ld-elf/pr30791d.s: Likewise.
Diffstat (limited to 'ld/testsuite/ld-elf')
-rw-r--r--ld/testsuite/ld-elf/pr30791a.d16
-rw-r--r--ld/testsuite/ld-elf/pr30791a.s20
-rw-r--r--ld/testsuite/ld-elf/pr30791b.d11
-rw-r--r--ld/testsuite/ld-elf/pr30791b.s20
-rw-r--r--ld/testsuite/ld-elf/pr30791c.s20
-rw-r--r--ld/testsuite/ld-elf/pr30791d.s20
6 files changed, 107 insertions, 0 deletions
diff --git a/ld/testsuite/ld-elf/pr30791a.d b/ld/testsuite/ld-elf/pr30791a.d
new file mode 100644
index 0000000..2446b52
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr30791a.d
@@ -0,0 +1,16 @@
+#source: pr30791a.s
+#source: pr30791b.s
+#ld: -r
+#readelf: -S --wide
+
+#...
+Section Headers:
+#...
+ \[[ 0-9]+\] __patchable_function_entries[ \t]+PROGBITS[ \t0-9a-f]+WAL.*
+#...
+ \[[ 0-9]+\] __patchable_function_entries[ \t]+PROGBITS[ \t0-9a-f]+WAL.*
+#...
+ \[[ 0-9]+\] __patchable_function_entries[ \t]+PROGBITS[ \t0-9a-f]+WAL.*
+#...
+ \[[ 0-9]+\] __patchable_function_entries[ \t]+PROGBITS[ \t0-9a-f]+WAL.*
+#pass
diff --git a/ld/testsuite/ld-elf/pr30791a.s b/ld/testsuite/ld-elf/pr30791a.s
new file mode 100644
index 0000000..44b75db
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr30791a.s
@@ -0,0 +1,20 @@
+ .section .text.a,"ax",%progbits
+ .globl a
+ .type a, %function
+a:
+.LFB0:
+ .section __patchable_function_entries,"awo",%progbits,.LPFE0
+ .dc.a .LPFE0
+ .section .text.a
+.LPFE0:
+ .byte 0
+ .section .text.b,"ax",%progbits
+ .globl b
+ .type b, %function
+b:
+.LFB1:
+ .section __patchable_function_entries,"awo",%progbits,.LPFE1
+ .dc.a .LPFE1
+ .section .text.b
+.LPFE1:
+ .byte 0
diff --git a/ld/testsuite/ld-elf/pr30791b.d b/ld/testsuite/ld-elf/pr30791b.d
new file mode 100644
index 0000000..5013c24
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr30791b.d
@@ -0,0 +1,11 @@
+#source: pr30791c.s
+#source: pr30791d.s
+#ld: -r
+#readelf: -S --wide
+
+#failif
+#...
+ \[[ 0-9]+\] __patchable_function_entries[ \t]+PROGBITS[ \t0-9a-f]+WAL.*
+#...
+ \[[ 0-9]+\] __patchable_function_entries[ \t]+PROGBITS[ \t0-9a-f]+WAL.*
+#...
diff --git a/ld/testsuite/ld-elf/pr30791b.s b/ld/testsuite/ld-elf/pr30791b.s
new file mode 100644
index 0000000..3f97f6c
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr30791b.s
@@ -0,0 +1,20 @@
+ .section .text.c,"ax",%progbits
+ .globl c
+ .type c, %function
+c:
+.LFB0:
+ .section __patchable_function_entries,"awo",%progbits,.LPFE0
+ .dc.a .LPFE0
+ .section .text.c
+.LPFE0:
+ .byte 0
+ .section .text.d,"ax",%progbits
+ .globl d
+ .type d, %function
+d:
+.LFB1:
+ .section __patchable_function_entries,"awo",%progbits,.LPFE1
+ .dc.a .LPFE1
+ .section .text.d
+.LPFE1:
+ .byte 0
diff --git a/ld/testsuite/ld-elf/pr30791c.s b/ld/testsuite/ld-elf/pr30791c.s
new file mode 100644
index 0000000..71ef77b
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr30791c.s
@@ -0,0 +1,20 @@
+ .text
+ .globl a
+ .type a, %function
+a:
+.LFB0:
+ .section __patchable_function_entries,"awo",%progbits,.LPFE0
+ .dc.a .LPFE0
+ .text
+.LPFE0:
+ .byte 0
+ .text
+ .globl b
+ .type b, %function
+b:
+.LFB1:
+ .section __patchable_function_entries,"awo",%progbits,.LPFE1
+ .dc.a .LPFE1
+ .text
+.LPFE1:
+ .byte 0
diff --git a/ld/testsuite/ld-elf/pr30791d.s b/ld/testsuite/ld-elf/pr30791d.s
new file mode 100644
index 0000000..5ca1c60
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr30791d.s
@@ -0,0 +1,20 @@
+ .text
+ .globl c
+ .type c, %function
+c:
+.LFB0:
+ .section __patchable_function_entries,"awo",%progbits,.LPFE0
+ .dc.a .LPFE0
+ .text
+.LPFE0:
+ .byte 0
+ .text
+ .globl d
+ .type d, %function
+d:
+.LFB1:
+ .section __patchable_function_entries,"awo",%progbits,.LPFE1
+ .dc.a .LPFE1
+ .text
+.LPFE1:
+ .byte 0