public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/3] s390: Generate .eh_frame unwind information for .plt section
@ 2025-01-22 14:10 Jens Remus
  2025-01-22 14:10 ` [PATCH 1/3] s390: Fix linker s390 emulation option parsing Jens Remus
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Jens Remus @ 2025-01-22 14:10 UTC (permalink / raw)
  To: binutils, Andreas Krebbel; +Cc: Jens Remus, Andreas Arnez

This enables the linker on s390x to generate .eh_frame unwind
information for the .plt section.  Based on x86-64.  This enables
e.g. perf to unwind through PLT entries.  Furthermore this lays the
foundation to generate SFrame stack trace information in the future.

Patch 1 resolves an issue in the linker s390 emulation option parsing.
This is a prerequisite to add support for linker option
"--[no-]ld-generated-unwind-info" in patch 3.

Patch 2 adds basic PLT generation tests that are extended in patch 3.

Patch 3 adds support for linker option
"--[no-]ld-generated-unwind-info" and enables the linker to generate
.eh_frame for .plt by default.

Regards,
Jens

Jens Remus (3):
  s390: Fix linker s390 emulation option parsing
  s390: Add basic PLT generation tests
  s390: Generate .eh_frame unwind information for .plt section

 bfd/elf64-s390.c                         | 126 ++++++++++++++++++++++-
 ld/NEWS                                  |   6 ++
 ld/emulparams/elf64_s390.sh              |   1 +
 ld/emultempl/s390.em                     |   6 +-
 ld/testsuite/ld-s390/plt_31-1.s          |  40 +++++++
 ld/testsuite/ld-s390/plt_31-1.wf         |  32 ++++++
 ld/testsuite/ld-s390/plt_31_non-pic-1.pd |  54 ++++++++++
 ld/testsuite/ld-s390/plt_31_pic-1.pd     |  57 ++++++++++
 ld/testsuite/ld-s390/plt_64-1.pd         |  38 +++++++
 ld/testsuite/ld-s390/plt_64-1.s          |  26 +++++
 ld/testsuite/ld-s390/plt_64-1.wf         |  33 ++++++
 ld/testsuite/ld-s390/plt_64-1_eh.wf      |  31 ++++++
 ld/testsuite/ld-s390/pltlib.s            |  16 +++
 ld/testsuite/ld-s390/s390.exp            |  28 ++++-
 14 files changed, 488 insertions(+), 6 deletions(-)
 create mode 100644 ld/testsuite/ld-s390/plt_31-1.s
 create mode 100644 ld/testsuite/ld-s390/plt_31-1.wf
 create mode 100644 ld/testsuite/ld-s390/plt_31_non-pic-1.pd
 create mode 100644 ld/testsuite/ld-s390/plt_31_pic-1.pd
 create mode 100644 ld/testsuite/ld-s390/plt_64-1.pd
 create mode 100644 ld/testsuite/ld-s390/plt_64-1.s
 create mode 100644 ld/testsuite/ld-s390/plt_64-1.wf
 create mode 100644 ld/testsuite/ld-s390/plt_64-1_eh.wf
 create mode 100644 ld/testsuite/ld-s390/pltlib.s

-- 
2.45.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] s390: Fix linker s390 emulation option parsing
  2025-01-22 14:10 [PATCH 0/3] s390: Generate .eh_frame unwind information for .plt section Jens Remus
@ 2025-01-22 14:10 ` Jens Remus
  2025-01-22 14:10 ` [PATCH 2/3] s390: Add basic PLT generation tests Jens Remus
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Jens Remus @ 2025-01-22 14:10 UTC (permalink / raw)
  To: binutils, Andreas Krebbel; +Cc: Jens Remus, Andreas Arnez

Append s390-specific emulation options to the shell variables instead of
replacing their contents.

ld/
	* emultempl/s390.em (PARSE_AND_LIST_LONGOPTS,
	PARSE_AND_LIST_OPTIONS, PARSE_AND_LIST_ARGS_CASES): Append to
	emulation options instead of replacing them.

Fixes: b4cbbe8f7294 ("S/390: Add support for pgste marker")
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---
 ld/emultempl/s390.em | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ld/emultempl/s390.em b/ld/emultempl/s390.em
index 3a2e49d80a7e..8548768cc5f1 100644
--- a/ld/emultempl/s390.em
+++ b/ld/emultempl/s390.em
@@ -42,16 +42,16 @@ EOF
 # Define some shell vars to insert bits of code into the standard elf
 # parse_args and list_options functions.
 #
-PARSE_AND_LIST_LONGOPTS='
+PARSE_AND_LIST_LONGOPTS=${PARSE_AND_LIST_LONGOPTS}'
   { "s390-pgste", no_argument, NULL, OPTION_PGSTE},
 '
 
-PARSE_AND_LIST_OPTIONS='
+PARSE_AND_LIST_OPTIONS=${PARSE_AND_LIST_OPTIONS}'
   fprintf (file, _("  --s390-pgste                Tell the kernel to "
 		   "allocate 4k page tables\n"));
 '
 
-PARSE_AND_LIST_ARGS_CASES='
+PARSE_AND_LIST_ARGS_CASES=${PARSE_AND_LIST_ARGS_CASES}'
     case OPTION_PGSTE:
       params.pgste = 1;
       break;
-- 
2.45.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/3] s390: Add basic PLT generation tests
  2025-01-22 14:10 [PATCH 0/3] s390: Generate .eh_frame unwind information for .plt section Jens Remus
  2025-01-22 14:10 ` [PATCH 1/3] s390: Fix linker s390 emulation option parsing Jens Remus
@ 2025-01-22 14:10 ` Jens Remus
  2025-01-22 14:10 ` [PATCH 3/3] s390: Generate .eh_frame unwind information for .plt section Jens Remus
  2025-01-27  9:12 ` [PATCH 0/3] " Andreas Krebbel
  3 siblings, 0 replies; 6+ messages in thread
From: Jens Remus @ 2025-01-22 14:10 UTC (permalink / raw)
  To: binutils, Andreas Krebbel; +Cc: Jens Remus, Andreas Arnez

ld/testsuite/
	* ld-s390/plt_31_non-pic-1.pd: New non-PIC/PIE PLT generation
	test for 31-bit.
	* ld-s390/plt_31_pic-1.pd: New PIC/PIE PLT generation test for
	31-bit.
	* ld-s390/plt_31-1.wf: New PLT generation test for 31-bit.
	* ld-s390/plt_64-1.pd: New PLT generation test for 64-bit.
	* ld-s390/plt_64-1.wf: Likewise.
	* ld-s390/plt-1.s: New PLT generation test for 31/64-bit.
	* ld-s390/pltlib.s: Likewise.
	* ld-s390/s390.exp: Run new PLT generation tests.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---
 ld/testsuite/ld-s390/plt_31-1.s          | 40 +++++++++++++++++
 ld/testsuite/ld-s390/plt_31-1.wf         | 32 +++++++++++++
 ld/testsuite/ld-s390/plt_31_non-pic-1.pd | 54 ++++++++++++++++++++++
 ld/testsuite/ld-s390/plt_31_pic-1.pd     | 57 ++++++++++++++++++++++++
 ld/testsuite/ld-s390/plt_64-1.pd         | 38 ++++++++++++++++
 ld/testsuite/ld-s390/plt_64-1.s          | 26 +++++++++++
 ld/testsuite/ld-s390/plt_64-1.wf         | 33 ++++++++++++++
 ld/testsuite/ld-s390/pltlib.s            | 16 +++++++
 ld/testsuite/ld-s390/s390.exp            | 20 +++++++++
 9 files changed, 316 insertions(+)
 create mode 100644 ld/testsuite/ld-s390/plt_31-1.s
 create mode 100644 ld/testsuite/ld-s390/plt_31-1.wf
 create mode 100644 ld/testsuite/ld-s390/plt_31_non-pic-1.pd
 create mode 100644 ld/testsuite/ld-s390/plt_31_pic-1.pd
 create mode 100644 ld/testsuite/ld-s390/plt_64-1.pd
 create mode 100644 ld/testsuite/ld-s390/plt_64-1.s
 create mode 100644 ld/testsuite/ld-s390/plt_64-1.wf
 create mode 100644 ld/testsuite/ld-s390/pltlib.s

diff --git a/ld/testsuite/ld-s390/plt_31-1.s b/ld/testsuite/ld-s390/plt_31-1.s
new file mode 100644
index 000000000000..47e101025e80
--- /dev/null
+++ b/ld/testsuite/ld-s390/plt_31-1.s
@@ -0,0 +1,40 @@
+	.text
+	.globl _start
+	.type _start,@function
+_start:
+	.cfi_startproc
+	.cfi_remember_state
+	# Save used call-saved registers.
+	stm	%r12,%r15,48(%r15)
+	.cfi_rel_offset %r12, 48
+	.cfi_rel_offset %r13, 52
+	.cfi_rel_offset %r14, 56
+	.cfi_rel_offset %r15, 60
+	# Allocate stack frame and maintain backchain.
+	lr	%r0,%r15
+	ahi	%r15,-96
+	.cfi_adjust_cfa_offset 96
+	st	%r0,0(%r15)
+	# Setup literal pool pointer in r13.
+	bras	%r13,.Llp_end
+.Llp:
+.Llpgot: .long	_GLOBAL_OFFSET_TABLE_-.Llp
+.Llpfoo: .long	foo@plt
+.Llpbar: .long	bar@plt
+.Llp_end:
+	# Setup GOT pointer in r12.
+	l	%r12,.Llpgot-.Llp(%r13)		# _GLOBAL_OFFSET_TABLE_
+	alr	%r12,%r13
+	# Call foo via PLT.
+	l	%r1,.Llpfoo-.Llp(%r13)		# foo@plt
+	basr	%r14,%r1
+	# Call bar via PLT.
+	l	%r1,.Llpbar-.Llp(%r13)		# bar@plt
+	basr	%r14,%r1
+	# Free stack frame and restore used call-saved registers.
+	lm	%r12,%r15,96+48(%r15)
+	.cfi_restore_state
+	# Return to caller with return code 0.
+	xr	%r2,%r2
+	br	%r14
+	.cfi_endproc
diff --git a/ld/testsuite/ld-s390/plt_31-1.wf b/ld/testsuite/ld-s390/plt_31-1.wf
new file mode 100644
index 000000000000..e4fa3a3e7a23
--- /dev/null
+++ b/ld/testsuite/ld-s390/plt_31-1.wf
@@ -0,0 +1,32 @@
+#source: plt_31-1.s
+#as: -m31
+#ld: -m elf_s390 [-pic]
+#readelf: -wf
+#target: s390-*-*
+
+Contents of the .eh_frame section:
+
+
+00000000 00000010 00000000 CIE
+  Version:               1
+  Augmentation:          "zR"
+  Code alignment factor: 1
+  Data alignment factor: -4
+  Return address column: 14
+  Augmentation data:     1b
+  DW_CFA_def_cfa: r15 ofs 96
+
+00000014 00000020 00000018 FDE cie=00000000 pc=[0-9a-f]+..[0-9a-f]+
+  DW_CFA_remember_state
+  DW_CFA_advance_loc: 4 to [0-9a-f]+
+  DW_CFA_offset: r12 at cfa-48
+  DW_CFA_offset: r13 at cfa-44
+  DW_CFA_offset: r14 at cfa-40
+  DW_CFA_offset: r15 at cfa-36
+  DW_CFA_advance_loc: 6 to [0-9a-f]+
+  DW_CFA_def_cfa_offset: 192
+  DW_CFA_advance_loc: 42 to [0-9a-f]+
+  DW_CFA_restore_state
+  DW_CFA_nop
+  DW_CFA_nop
+  DW_CFA_nop
diff --git a/ld/testsuite/ld-s390/plt_31_non-pic-1.pd b/ld/testsuite/ld-s390/plt_31_non-pic-1.pd
new file mode 100644
index 000000000000..6e9c01de69f3
--- /dev/null
+++ b/ld/testsuite/ld-s390/plt_31_non-pic-1.pd
@@ -0,0 +1,54 @@
+#source: plt_31-1.s
+#as: -m31
+#ld: -m elf_s390
+#objdump: -M insnlength -dzrj.plt
+#target: s390-*-*
+
+.*: +file format .*
+
+
+Disassembly of section .plt:
+
+# PLT0 for non-PIC/PIE
+[0-9a-f]+ <.plt>:
+ +[0-9a-f]+:	50 10 f0 1c [	 ]*st	%r1,28\(%r15\)
+ +[0-9a-f]+:	0d 10 [	 ]*basr	%r1,%r0
+ +[0-9a-f]+:	58 10 10 12 [	 ]*l	%r1,18\(%r1\)
+ +[0-9a-f]+:	d2 03 f0 18 10 04 [	 ]*mvc	24\(4,%r15\),4\(%r1\)
+ +[0-9a-f]+:	58 10 10 08 [	 ]*l	%r1,8\(%r1\)
+ +[0-9a-f]+:	07 f1 [	 ]*br	%r1
+ +[0-9a-f]+:	00 00 [	 ]*\.short	0x0000
+ +[0-9a-f]+:	([0-9a-f]{2} ){2}[	 ]*.*
+ +[0-9a-f]+:	([0-9a-f]{2} ){2}[	 ]*.*
+ +[0-9a-f]+:	00 00 [	 ]*\.short	0x0000
+ +[0-9a-f]+:	00 00 [	 ]*\.short	0x0000
+
+# PLTn for non-PIC/PIE
+[0-9a-f]+ <foo@plt>:
+ +[0-9a-f]+:	0d 10 [	 ]*basr	%r1,%r0
+ +[0-9a-f]+:	58 10 10 16 [	 ]*l	%r1,22\(%r1\)
+ +[0-9a-f]+:	58 10 10 00 [	 ]*l	%r1,0\(%r1\)
+ +[0-9a-f]+:	07 f1 [	 ]*br	%r1
+ +[0-9a-f]+:	0d 10 [	 ]*basr	%r1,%r0
+ +[0-9a-f]+:	58 10 10 0e [	 ]*l	%r1,14\(%r1\)
+ +[0-9a-f]+:	a7 f4 ([0-9a-f]{2} ){2}[	 ]*j	[0-9a-f]+ \<\.plt\>
+ +[0-9a-f]+:	00 00 [	 ]*\.short	0x0000
+ +[0-9a-f]+:	([0-9a-f]{2} ){2}[	 ]*.*
+ +[0-9a-f]+:	([0-9a-f]{2} ){2}[	 ]*.*
+ +[0-9a-f]+:	([0-9a-f]{2} ){2}[	 ]*.*
+ +[0-9a-f]+:	([0-9a-f]{2} ){2}[	 ]*.*
+
+# PLTn for non-PIC/PIE
+[0-9a-f]+ <bar@plt>:
+ +[0-9a-f]+:	0d 10 [	 ]*basr	%r1,%r0
+ +[0-9a-f]+:	58 10 10 16 [	 ]*l	%r1,22\(%r1\)
+ +[0-9a-f]+:	58 10 10 00 [	 ]*l	%r1,0\(%r1\)
+ +[0-9a-f]+:	07 f1 [	 ]*br	%r1
+ +[0-9a-f]+:	0d 10 [	 ]*basr	%r1,%r0
+ +[0-9a-f]+:	58 10 10 0e [	 ]*l	%r1,14\(%r1\)
+ +[0-9a-f]+:	a7 f4 ([0-9a-f]{2} ){2}[	 ]*j	[0-9a-f]+ \<\.plt\>
+ +[0-9a-f]+:	00 00 [	 ]*\.short	0x0000
+ +[0-9a-f]+:	([0-9a-f]{2} ){2}[	 ]*.*
+ +[0-9a-f]+:	([0-9a-f]{2} ){2}[	 ]*.*
+ +[0-9a-f]+:	([0-9a-f]{2} ){2}[	 ]*.*
+ +[0-9a-f]+:	([0-9a-f]{2} ){2}[	 ]*.*
diff --git a/ld/testsuite/ld-s390/plt_31_pic-1.pd b/ld/testsuite/ld-s390/plt_31_pic-1.pd
new file mode 100644
index 000000000000..8cee0ee84831
--- /dev/null
+++ b/ld/testsuite/ld-s390/plt_31_pic-1.pd
@@ -0,0 +1,57 @@
+#source: plt_31-1.s
+#as: -m31
+#ld: -m elf_s390 -pic
+#objdump: -M insnlength -dzrj.plt
+#target: s390-*-*
+
+.*: +file format .*
+
+
+Disassembly of section .plt:
+
+# PLT0 for PIC/PIE
+[0-9a-f]+ <.plt>:
+ +[0-9a-f]+:	50 10 f0 1c [	 ]*st	%r1,28\(%r15\)
+ +[0-9a-f]+:	58 10 c0 04 [	 ]*l	%r1,4\(%r12\)
+ +[0-9a-f]+:	50 10 f0 18 [	 ]*st	%r1,24\(%r15\)
+ +[0-9a-f]+:	58 10 c0 08 [	 ]*l	%r1,8\(%r12\)
+ +[0-9a-f]+:	07 f1 [	 ]*br	%r1
+ +[0-9a-f]+:	00 00 [	 ]*\.short	0x0000
+ +[0-9a-f]+:	00 00 [	 ]*\.short	0x0000
+ +[0-9a-f]+:	00 00 [	 ]*\.short	0x0000
+ +[0-9a-f]+:	00 00 [	 ]*\.short	0x0000
+ +[0-9a-f]+:	00 00 [	 ]*\.short	0x0000
+ +[0-9a-f]+:	00 00 [	 ]*\.short	0x0000
+ +[0-9a-f]+:	00 00 [	 ]*\.short	0x0000
+
+# PLTn for PIC/PIE and GOT offset < 4096
+[0-9a-f]+ <foo@plt>:
+ +[0-9a-f]+:	58 10 c0 0c [	 ]*l	%r1,12\(%r12\)
+ +[0-9a-f]+:	07 f1 [	 ]*br	%r1
+ +[0-9a-f]+:	00 00 [	 ]*\.short	0x0000
+ +[0-9a-f]+:	00 00 [	 ]*\.short	0x0000
+ +[0-9a-f]+:	00 00 [	 ]*\.short	0x0000
+ +[0-9a-f]+:	0d 10 [	 ]*basr	%r1,%r0
+ +[0-9a-f]+:	58 10 10 0e [	 ]*l	%r1,14\(%r1\)
+ +[0-9a-f]+:	a7 f4 ([0-9a-f]{2} ){2}[	 ]*j	[0-9a-f]+ \<\.plt\>
+ +[0-9a-f]+:	00 00 [	 ]*\.short	0x0000
+ +[0-9a-f]+:	00 00 [	 ]*\.short	0x0000
+ +[0-9a-f]+:	00 00 [	 ]*\.short	0x0000
+ +[0-9a-f]+:	([0-9a-f]{2} ){2}[	 ]*.*
+ +[0-9a-f]+:	([0-9a-f]{2} ){2}[	 ]*.*
+
+# PLTn for PIC/PIE and GOT offset < 4096
+[0-9a-f]+ <bar@plt>:
+ +[0-9a-f]+:	58 10 c0 10 [	 ]*l	%r1,16\(%r12\)
+ +[0-9a-f]+:	07 f1 [	 ]*br	%r1
+ +[0-9a-f]+:	00 00 [	 ]*\.short	0x0000
+ +[0-9a-f]+:	00 00 [	 ]*\.short	0x0000
+ +[0-9a-f]+:	00 00 [	 ]*\.short	0x0000
+ +[0-9a-f]+:	0d 10 [	 ]*basr	%r1,%r0
+ +[0-9a-f]+:	58 10 10 0e [	 ]*l	%r1,14\(%r1\)
+ +[0-9a-f]+:	a7 f4 ([0-9a-f]{2} ){2}[	 ]*j	[0-9a-f]+ \<\.plt\>
+ +[0-9a-f]+:	00 00 [	 ]*\.short	0x0000
+ +[0-9a-f]+:	00 00 [	 ]*\.short	0x0000
+ +[0-9a-f]+:	00 00 [	 ]*\.short	0x0000
+ +[0-9a-f]+:	([0-9a-f]{2} ){2}[	 ]*.*
+ +[0-9a-f]+:	([0-9a-f]{2} ){2}[	 ]*.*
diff --git a/ld/testsuite/ld-s390/plt_64-1.pd b/ld/testsuite/ld-s390/plt_64-1.pd
new file mode 100644
index 000000000000..5f12a2f8f6cf
--- /dev/null
+++ b/ld/testsuite/ld-s390/plt_64-1.pd
@@ -0,0 +1,38 @@
+#source: plt_64-1.s
+#as: -m64
+#ld: -m elf64_s390
+#objdump: -dzrj.plt
+#target: s390x-*-*
+
+.*: +file format .*
+
+
+Disassembly of section .plt:
+
+[0-9a-f]+ <.plt>:
+ +[0-9a-f]+:	e3 10 f0 38 00 24 [	 ]*stg	%r1,56\(%r15\)
+ +[0-9a-f]+:	c0 10 ([0-9a-f]{2} ){4}[	 ]*larl	%r1,[0-9a-f]+ \<_GLOBAL_OFFSET_TABLE_\>
+ +[0-9a-f]+:	d2 07 f0 30 10 08 [	 ]*mvc	48\(8,%r15\),8\(%r1\)
+ +[0-9a-f]+:	e3 10 10 10 00 04 [	 ]*lg	%r1,16\(%r1\)
+ +[0-9a-f]+:	07 f1 [	 ]*br	%r1
+ +[0-9a-f]+:	07 00 [	 ]*nopr
+ +[0-9a-f]+:	07 00 [	 ]*nopr
+ +[0-9a-f]+:	07 00 [	 ]*nopr
+
+[0-9a-f]+ <foo@plt>:
+ +[0-9a-f]+:	c0 10 ([0-9a-f]{2} ){4}[	 ]*larl	%r1,[0-9a-f]+ \<foo\>
+ +[0-9a-f]+:	e3 10 10 00 00 04 [	 ]*lg	%r1,0\(%r1\)
+ +[0-9a-f]+:	07 f1 [	 ]*br	%r1
+ +[0-9a-f]+:	0d 10 [	 ]*basr	%r1,%r0
+ +[0-9a-f]+:	e3 10 10 0c 00 14 [	 ]*lgf	%r1,12\(%r1\)
+ +[0-9a-f]+:	c0 f4 ff ff ff e5 [	 ]*jg	[0-9a-f]+ \<\.plt\>
+ +[0-9a-f]+:	00 00 00 00 [	 ]*.long	0x00000000
+
+[0-9a-f]+ <bar@plt>:
+ +[0-9a-f]+:	c0 10 ([0-9a-f]{2} ){4}[	 ]*larl	%r1,[0-9a-f]+ \<bar\>
+ +[0-9a-f]+:	e3 10 10 00 00 04 [	 ]*lg	%r1,0\(%r1\)
+ +[0-9a-f]+:	07 f1 [	 ]*br	%r1
+ +[0-9a-f]+:	0d 10 [	 ]*basr	%r1,%r0
+ +[0-9a-f]+:	e3 10 10 0c 00 14 [	 ]*lgf	%r1,12\(%r1\)
+ +[0-9a-f]+:	c0 f4 ff ff ff d5 [	 ]*jg	[0-9a-f]+ \<\.plt\>
+ +[0-9a-f]+:	00 00 00 18 [	 ]*.long	0x00000018
diff --git a/ld/testsuite/ld-s390/plt_64-1.s b/ld/testsuite/ld-s390/plt_64-1.s
new file mode 100644
index 000000000000..f5382731f714
--- /dev/null
+++ b/ld/testsuite/ld-s390/plt_64-1.s
@@ -0,0 +1,26 @@
+	.text
+	.globl _start
+	.type _start,@function
+_start:
+	.cfi_startproc
+	.cfi_remember_state
+	# Save used call-saved registers.
+	stmg	%r14,%r15,112(%r15)
+	.cfi_rel_offset %r14, 112
+	.cfi_rel_offset %r15, 120
+	# Allocate stack frame and maintain backchain.
+	lgr	%r0,%r15
+	aghi	%r15,-160
+	.cfi_adjust_cfa_offset 160
+	stg	%r0,0(%r15)
+	# Call foo via PLT.
+	brasl	%r14,foo@plt
+	# Call bar via PLT.
+	brasl	%r14,bar@plt
+	# Free stack frame and restore used call-saved registers.
+	lmg	%r14,%r15,160+112(%r15)
+	.cfi_restore_state
+	# Return to caller with return code 0.
+	xgr	%r2,%r2
+	br	%r14
+	.cfi_endproc
diff --git a/ld/testsuite/ld-s390/plt_64-1.wf b/ld/testsuite/ld-s390/plt_64-1.wf
new file mode 100644
index 000000000000..61dc4c7a9894
--- /dev/null
+++ b/ld/testsuite/ld-s390/plt_64-1.wf
@@ -0,0 +1,33 @@
+#source: plt_64-1.s
+#as: -m64
+#ld: -m elf64_s390
+#readelf: -wf
+#target: s390x-*-*
+
+Contents of the .eh_frame section:
+
+
+00000000 0000000000000014 00000000 CIE
+  Version:               1
+  Augmentation:          "zR"
+  Code alignment factor: 1
+  Data alignment factor: -8
+  Return address column: 14
+  Augmentation data:     1b
+  DW_CFA_def_cfa: r15 ofs 160
+  DW_CFA_nop
+  DW_CFA_nop
+  DW_CFA_nop
+
+00000018 000000000000001c 0000001c FDE cie=00000000 pc=00000000010002b8..00000000010002e4
+  DW_CFA_remember_state
+  DW_CFA_advance_loc: 6 to 00000000010002be
+  DW_CFA_offset: r14 at cfa-48
+  DW_CFA_offset: r15 at cfa-40
+  DW_CFA_advance_loc: 8 to 00000000010002c6
+  DW_CFA_def_cfa_offset: 320
+  DW_CFA_advance_loc: 24 to 00000000010002de
+  DW_CFA_restore_state
+  DW_CFA_nop
+  DW_CFA_nop
+  DW_CFA_nop
diff --git a/ld/testsuite/ld-s390/pltlib.s b/ld/testsuite/ld-s390/pltlib.s
new file mode 100644
index 000000000000..3308d5547059
--- /dev/null
+++ b/ld/testsuite/ld-s390/pltlib.s
@@ -0,0 +1,16 @@
+	.text
+	.globl foo
+	.type foo,@function
+foo:
+	.cfi_startproc
+	br	%r14
+	.cfi_endproc
+	.size foo,.-foo
+
+	.globl bar
+	.type bar,@function
+bar:
+	.cfi_startproc
+	br	%r14
+	.cfi_endproc
+	.size bar,.-bar
diff --git a/ld/testsuite/ld-s390/s390.exp b/ld/testsuite/ld-s390/s390.exp
index 8958b5cb5313..26dab72c013d 100644
--- a/ld/testsuite/ld-s390/s390.exp
+++ b/ld/testsuite/ld-s390/s390.exp
@@ -59,6 +59,18 @@ set s390tests {
      "-m31" {gotreloc-1.s}
      {{objdump -dzrj.text gotreloc_31-no-pie-1.dd}}
      "gotreloc_31-1"}
+    {"Helper shared library (PLT test)"
+     "-shared -m elf_s390" "" "-m31" {pltlib.s}
+     {}
+     "libpltlib_31.so"}
+    {"PLT: PLT generation (non-PIC/PIE)"
+     "-m elf_s390 tmpdir/libpltlib_31.so" "" "-m31" {plt_31-1.s}
+     {{objdump "-M insnlength -dzrj.plt" plt_31_non-pic-1.pd} {readelf "-wf" plt_31-1.wf}}
+     "plt_31_non-pic-1"}
+    {"PLT: PLT generation (PIC/PIE)"
+     "-m elf_s390 tmpdir/libpltlib_31.so -pic" "" "-m31" {plt_31-1.s}
+     {{objdump "-M insnlength -dzrj.plt" plt_31_pic-1.pd} {readelf "-wf" plt_31-1.wf}}
+     "plt_31_pic-1"}
 }
 
 set s390xtests {
@@ -101,6 +113,14 @@ set s390xtests {
     {"WEAKUNDEF2: overflow test (PLT32DBL)"
      "-m elf64_s390 -dT 8GB.ld --no-error-rwx-segments -no-pie" "" "-m64" {weakundef-2.s}
      {{objdump "-dzrj.text" weakundef-2.dd}} "weakundef-2"}
+    {"Helper shared library (PLT test)"
+     "-shared -m elf64_s390" "" "-m64" {pltlib.s}
+     {}
+     "libpltlib_64.so"}
+    {"PLT: PLT generation"
+     "-m elf64_s390 tmpdir/libpltlib_64.so" "" "-m64" {plt_64-1.s}
+     {{objdump "-dzrj.plt" plt_64-1.pd} {readelf "-wf" plt_64-1.wf}}
+     "plt_64-1"}
 }
 
 if [istarget "s390-*-*"] {
-- 
2.45.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/3] s390: Generate .eh_frame unwind information for .plt section
  2025-01-22 14:10 [PATCH 0/3] s390: Generate .eh_frame unwind information for .plt section Jens Remus
  2025-01-22 14:10 ` [PATCH 1/3] s390: Fix linker s390 emulation option parsing Jens Remus
  2025-01-22 14:10 ` [PATCH 2/3] s390: Add basic PLT generation tests Jens Remus
@ 2025-01-22 14:10 ` Jens Remus
  2025-01-27  9:12 ` [PATCH 0/3] " Andreas Krebbel
  3 siblings, 0 replies; 6+ messages in thread
From: Jens Remus @ 2025-01-22 14:10 UTC (permalink / raw)
  To: binutils, Andreas Krebbel; +Cc: Jens Remus, Andreas Arnez

Enable unwinding using .eh_frame information through PLT entries.  Based
on x86-64.

This enhances stack traces if the instruction pointer is in a PLT entry.
For instance perf call graphs, when using --call-graph=dwarf, and Glibc
backtraces, when using backtrace() e.g. from a signal handler.
Note that GDB could already unwind through PLT entries using its s390-
specific prologue unwinder.

Furthermore this lays the foundation to generate SFrame information for
the PLT section in the future.

bfd/
	* elf64-s390.c: Include dwarf2.h.
	(PLT_CIE_SIZE, PLT_FDE_SIZE,
	PLT_FDE_START_OFFSET, PLT_FDE_LEN_OFFSET,
	elf_s390x_eh_frame_plt): New .eh_frame template for .plt
	section.
	(elf_s390_link_hash_table): Add plt_eh_frame field.
	(elf_s390_create_dynamic_sections): New s390-specific wrapper
	around _bfd_elf_create_dynamic_sections.  Create .eh_frame
	section for .plt section.
	(elf_backend_create_dynamic_sections): Register s390-specific
	elf_s390_create_dynamic_sections.
	(elf_s390_late_size_sections): Fill in .eh_frame section for
	.plt section.  Write .plt section size into .eh_frame FDE
	covering .plt section.
	(elf_s390_finish_dynamic_sections): Write .plt section start
	into .eh_frame FDE covering .plt section.  Call
	_bfd_elf_write_section_eh_frame on on htab->plt_eh_frame
	section.

ld/
	* NEWS: Add news entry.
	* emulparams/elf64_s390.sh: Include plt_unwind.sh.

ld/testsuite/
	* ld-s390/plt_64-1_eh.wf: New PLT .eh_frame generation test.
	* ld-s390/s390.exp: Link some existing test cases with
	--no-ld-generated-unwind-info so that they do not fail.  Run
	new PLT .eh_frame generation test.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---
 bfd/elf64-s390.c                    | 126 +++++++++++++++++++++++++++-
 ld/NEWS                             |   6 ++
 ld/emulparams/elf64_s390.sh         |   1 +
 ld/testsuite/ld-s390/plt_64-1_eh.wf |  31 +++++++
 ld/testsuite/ld-s390/s390.exp       |  12 ++-
 5 files changed, 171 insertions(+), 5 deletions(-)
 create mode 100644 ld/testsuite/ld-s390/plt_64-1_eh.wf

diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index 27836b87d6f8..259ad13be51f 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -26,6 +26,7 @@
 #include "elf-bfd.h"
 #include "elf/s390.h"
 #include "elf-s390.h"
+#include "dwarf2.h"
 #include <stdarg.h>
 
 /* In case we're on a 32-bit machine, construct a 64-bit "-1" value
@@ -564,6 +565,35 @@ static const bfd_byte elf_s390x_first_plt_entry[PLT_FIRST_ENTRY_SIZE] =
     0x07, 0x00				    /* nopr    %r0		 */
   };
 
+/* .eh_frame covering the .plt section.  */
+
+#define PLT_CIE_SIZE		24
+#define PLT_FDE_SIZE		20
+#define PLT_FDE_START_OFFSET	(PLT_CIE_SIZE + 8)
+#define PLT_FDE_LEN_OFFSET	(PLT_CIE_SIZE + 12)
+
+static const bfd_byte elf_s390x_eh_frame_plt[] =
+{
+  0, 0, 0, PLT_CIE_SIZE - 4,	/* CIE length */
+  0, 0, 0, 0,			/* CIE ID */
+  1,				/* CIE version */
+  'z', 'R', 0,			/* Augmentation string */
+  1,				/* Code alignment factor */
+  0x78,				/* Data alignment factor */
+  14,				/* Return address column */
+  1,				/* Augmentation size */
+  DW_EH_PE_pcrel | DW_EH_PE_sdata4, /* FDE encoding */
+  DW_CFA_def_cfa, 15, 0xa0, 0x01, /* DW_CFA_def_cfa: r15 ofs 160 */
+  DW_CFA_nop, DW_CFA_nop, DW_CFA_nop,
+
+  0, 0, 0, PLT_FDE_SIZE - 4,	/* FDE length */
+  0, 0, 0, PLT_CIE_SIZE + 4,	/* CIE pointer */
+  0, 0, 0, 0,			/* R_S390_PC32 .plt goes here */
+  0, 0, 0, 0,			/* .plt size goes here */
+  0,				/* Augmentation size */
+  DW_CFA_nop, DW_CFA_nop, DW_CFA_nop
+};
+
 
 /* s390 ELF linker hash entry.  */
 
@@ -656,6 +686,7 @@ struct elf_s390_link_hash_table
 
   /* Short-cuts to get to dynamic linker sections.  */
   asection *irelifunc;
+  asection *plt_eh_frame;
 
   union {
     bfd_signed_vma refcount;
@@ -1852,6 +1883,15 @@ elf_s390_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
      sym dynamic relocs.  */
   elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, info);
 
+  if (_bfd_elf_eh_frame_present (info))
+    {
+      if (htab->plt_eh_frame != NULL
+	  && htab->elf.splt != NULL
+	  && htab->elf.splt->size != 0
+	  && !bfd_is_abs_section (htab->elf.splt->output_section))
+	htab->plt_eh_frame->size = sizeof (elf_s390x_eh_frame_plt);
+    }
+
   /* We now have determined the sizes of the various dynamic sections.
      Allocate memory for them.  */
   relocs = false;
@@ -1863,6 +1903,7 @@ elf_s390_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
       if (s == htab->elf.splt
 	  || s == htab->elf.sgot
 	  || s == htab->elf.sgotplt
+	  || s == htab->plt_eh_frame
 	  || s == htab->elf.sdynbss
 	  || s == htab->elf.sdynrelro
 	  || s == htab->elf.iplt
@@ -1930,6 +1971,16 @@ elf_s390_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
       s->alloced = 1;
     }
 
+  if (htab->plt_eh_frame != NULL
+      && htab->plt_eh_frame->contents != NULL)
+    {
+      memcpy (htab->plt_eh_frame->contents,
+	      elf_s390x_eh_frame_plt,
+	      htab->plt_eh_frame->size);
+      bfd_put_32 (dynobj, htab->elf.splt->size,
+		  htab->plt_eh_frame->contents + PLT_FDE_LEN_OFFSET);
+    }
+
   return _bfd_elf_add_dynamic_tags (output_bfd, info, relocs);
 }
 
@@ -3703,6 +3754,38 @@ elf_s390_finish_dynamic_sections (bfd *output_bfd,
 	  }
     }
 
+  /* Adjust .eh_frame for .plt section.  */
+  if (htab->plt_eh_frame != NULL
+      && htab->plt_eh_frame->contents != NULL)
+    {
+      if (htab->elf.splt != NULL
+	  && htab->elf.splt->size != 0
+	  && (htab->elf.splt->flags & SEC_EXCLUDE) == 0
+	  && htab->elf.splt->output_section != NULL
+	  && htab->plt_eh_frame->output_section != NULL)
+	{
+	  bfd_vma plt_start = htab->elf.splt->output_section->vma;
+	  bfd_vma eh_frame_start = htab->plt_eh_frame->output_section->vma
+				   + htab->plt_eh_frame->output_offset
+				   + PLT_FDE_START_OFFSET;
+	  /* Note: Linker may have discarded the FDE, so that store may
+	     be beyond current htab->plt_eh_frame->size.  Can be ignored,
+	     as htab->plt_eh_frame->contents got allocated with
+	     sizeof (elf_s390x_eh_frame_plt).  See PR 12570.  */
+	  bfd_put_signed_32 (dynobj, plt_start - eh_frame_start,
+			     htab->plt_eh_frame->contents
+			     + PLT_FDE_START_OFFSET);
+	}
+
+      if (htab->plt_eh_frame->sec_info_type == SEC_INFO_TYPE_EH_FRAME)
+	{
+	  if (! _bfd_elf_write_section_eh_frame (output_bfd, info,
+						 htab->plt_eh_frame,
+						 htab->plt_eh_frame->contents))
+	    return NULL;
+	}
+    }
+
   return true;
 }
 \f
@@ -3926,6 +4009,47 @@ bfd_elf_s390_set_options (struct bfd_link_info *info,
   return true;
 }
 
+/* Create .plt, .rela.plt, .got, .got.plt, .rela.got, .dynbss, and
+   .rela.bss sections in DYNOBJ, and set up shortcuts to them in our
+   hash table.  */
+
+static bool
+elf_s390_create_dynamic_sections (bfd *dynobj,
+                                  struct bfd_link_info *info)
+{
+  struct elf_s390_link_hash_table *htab;
+
+  if (!_bfd_elf_create_dynamic_sections (dynobj, info))
+    return false;
+
+  htab = elf_s390_hash_table (info);
+  if (htab == NULL)
+    return false;
+
+  if (htab->elf.splt != NULL)
+    {
+      /* Create .eh_frame section for .plt section.  */
+      if (!info->no_ld_generated_unwind_info)
+        {
+          flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY
+                            | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+                            | SEC_LINKER_CREATED);
+
+          if (htab->plt_eh_frame == NULL)
+            {
+              htab->plt_eh_frame
+                = bfd_make_section_anyway_with_flags (dynobj,
+                                                      ".eh_frame",
+                                                      flags);
+              if (htab->plt_eh_frame == NULL
+                  || !bfd_set_section_alignment (htab->plt_eh_frame, 3))
+                return false;
+            }
+        }
+    }
+
+  return true;
+}
 
 /* Why was the hash table entry size definition changed from
    ARCH_SIZE/8 to 4? This breaks the 64 bit dynamic linker and
@@ -3992,7 +4116,7 @@ const struct elf_size_info s390_elf64_size_info =
 #define elf_backend_adjust_dynamic_symbol     elf_s390_adjust_dynamic_symbol
 #define elf_backend_check_relocs	      elf_s390_check_relocs
 #define elf_backend_copy_indirect_symbol      elf_s390_copy_indirect_symbol
-#define elf_backend_create_dynamic_sections   _bfd_elf_create_dynamic_sections
+#define elf_backend_create_dynamic_sections   elf_s390_create_dynamic_sections
 #define elf_backend_finish_dynamic_sections   elf_s390_finish_dynamic_sections
 #define elf_backend_finish_dynamic_symbol     elf_s390_finish_dynamic_symbol
 #define elf_backend_gc_mark_hook	      elf_s390_gc_mark_hook
diff --git a/ld/NEWS b/ld/NEWS
index 17fb20a6b9f7..acb3263a29f6 100644
--- a/ld/NEWS
+++ b/ld/NEWS
@@ -1,5 +1,11 @@
 -*- text -*-
 
+* On s390, generate ".eh_frame" unwind information for the linker generated
+  .plt section.  Enabled by default.  Can be disabled using linker option
+  --no-ld-generated-unwind-info.
+
+* On s390, add support for linker option --[no-]ld-generated-unwind-info.
+
 Changes in 2.44:
 
 * Support for Nios II target has been removed, as this architecture has been
diff --git a/ld/emulparams/elf64_s390.sh b/ld/emulparams/elf64_s390.sh
index d0a2a59a0926..b58314800d10 100644
--- a/ld/emulparams/elf64_s390.sh
+++ b/ld/emulparams/elf64_s390.sh
@@ -1,3 +1,4 @@
+source_sh ${srcdir}/emulparams/plt_unwind.sh
 SCRIPT_NAME=elf
 ELFSIZE=64
 OUTPUT_FORMAT="elf64-s390"
diff --git a/ld/testsuite/ld-s390/plt_64-1_eh.wf b/ld/testsuite/ld-s390/plt_64-1_eh.wf
new file mode 100644
index 000000000000..717e7a7e2a61
--- /dev/null
+++ b/ld/testsuite/ld-s390/plt_64-1_eh.wf
@@ -0,0 +1,31 @@
+#source: plt_64-1.s
+#as: -m64
+#ld: -m elf64_s390
+#readelf: -wf
+#target: s390x-*-*
+
+Contents of the .eh_frame section:
+
+
+00000000 0000000000000014 00000000 CIE
+  Version:               1
+  Augmentation:          "zR"
+  Code alignment factor: 1
+  Data alignment factor: -8
+  Return address column: 14
+  Augmentation data:     1b
+  DW_CFA_def_cfa: r15 ofs 160
+  DW_CFA_nop
+  DW_CFA_nop
+  DW_CFA_nop
+
+00000018 0000000000000014 0000001c FDE cie=00000000 pc=0000000001000258..00000000010002b8
+  DW_CFA_nop
+  DW_CFA_nop
+  DW_CFA_nop
+  DW_CFA_nop
+  DW_CFA_nop
+  DW_CFA_nop
+  DW_CFA_nop
+
+#...
diff --git a/ld/testsuite/ld-s390/s390.exp b/ld/testsuite/ld-s390/s390.exp
index 26dab72c013d..d91eeacc730a 100644
--- a/ld/testsuite/ld-s390/s390.exp
+++ b/ld/testsuite/ld-s390/s390.exp
@@ -74,7 +74,7 @@ set s390tests {
 }
 
 set s390xtests {
-    {"TLS -fpic -shared transitions" "-shared -melf64_s390 --hash-style=sysv" ""
+    {"TLS -fpic -shared transitions" "-shared -melf64_s390 --hash-style=sysv --no-ld-generated-unwind-info" ""
      "-m64 -Aesame" {tlspic1_64.s tlspic2_64.s}
      {{readelf -WSsrl tlspic_64.rd} {objdump -dzrj.text tlspic_64.dd}
       {objdump -sj.got tlspic_64.sd} {objdump -sj.tdata tlspic_64.td}}
@@ -82,7 +82,7 @@ set s390xtests {
     {"Helper shared library" "-shared -melf64_s390" ""
      "-m64 -Aesame" {tlslib_64.s} {} "libtlslib_64.so"}
     {"TLS -fpic and -fno-pic exec transitions"
-     "-melf64_s390 tmpdir/libtlslib_64.so --hash-style=sysv" ""
+     "-melf64_s390 tmpdir/libtlslib_64.so --hash-style=sysv --no-ld-generated-unwind-info" ""
      "-m64 -Aesame" {tlsbinpic_64.s tlsbin_64.s}
      {{readelf -WSsrl tlsbin_64.rd} {objdump -dzrj.text tlsbin_64.dd}
       {objdump -sj.got tlsbin_64.sd} {objdump -sj.tdata tlsbin_64.td}}
@@ -117,10 +117,14 @@ set s390xtests {
      "-shared -m elf64_s390" "" "-m64" {pltlib.s}
      {}
      "libpltlib_64.so"}
-    {"PLT: PLT generation"
-     "-m elf64_s390 tmpdir/libpltlib_64.so" "" "-m64" {plt_64-1.s}
+    {"PLT: PLT generation without .eh_frame unwind info"
+     "-m elf64_s390 tmpdir/libpltlib_64.so --no-ld-generated-unwind-info" "" "-m64" {plt_64-1.s}
      {{objdump "-dzrj.plt" plt_64-1.pd} {readelf "-wf" plt_64-1.wf}}
      "plt_64-1"}
+    {"PLT: PLT generation with .eh_frame unwind info"
+     "-m elf64_s390 tmpdir/libpltlib_64.so" "" "-m64" {plt_64-1.s}
+     {{objdump "-dzrj.plt" plt_64-1.pd} {readelf "-wf" plt_64-1_eh.wf}}
+     "plt_64-1_eh"}
 }
 
 if [istarget "s390-*-*"] {
-- 
2.45.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] s390: Generate .eh_frame unwind information for .plt section
  2025-01-22 14:10 [PATCH 0/3] s390: Generate .eh_frame unwind information for .plt section Jens Remus
                   ` (2 preceding siblings ...)
  2025-01-22 14:10 ` [PATCH 3/3] s390: Generate .eh_frame unwind information for .plt section Jens Remus
@ 2025-01-27  9:12 ` Andreas Krebbel
  2025-01-27 15:48   ` Jens Remus
  3 siblings, 1 reply; 6+ messages in thread
From: Andreas Krebbel @ 2025-01-27  9:12 UTC (permalink / raw)
  To: Jens Remus, binutils; +Cc: Andreas Arnez

Hi Jens,

Patches are ok. Thank you very much!

Andreas


On 1/22/25 3:10 PM, Jens Remus wrote:
> This enables the linker on s390x to generate .eh_frame unwind
> information for the .plt section.  Based on x86-64.  This enables
> e.g. perf to unwind through PLT entries.  Furthermore this lays the
> foundation to generate SFrame stack trace information in the future.
>
> Patch 1 resolves an issue in the linker s390 emulation option parsing.
> This is a prerequisite to add support for linker option
> "--[no-]ld-generated-unwind-info" in patch 3.
>
> Patch 2 adds basic PLT generation tests that are extended in patch 3.
>
> Patch 3 adds support for linker option
> "--[no-]ld-generated-unwind-info" and enables the linker to generate
> .eh_frame for .plt by default.
>
> Regards,
> Jens
>
> Jens Remus (3):
>    s390: Fix linker s390 emulation option parsing
>    s390: Add basic PLT generation tests
>    s390: Generate .eh_frame unwind information for .plt section
>
>   bfd/elf64-s390.c                         | 126 ++++++++++++++++++++++-
>   ld/NEWS                                  |   6 ++
>   ld/emulparams/elf64_s390.sh              |   1 +
>   ld/emultempl/s390.em                     |   6 +-
>   ld/testsuite/ld-s390/plt_31-1.s          |  40 +++++++
>   ld/testsuite/ld-s390/plt_31-1.wf         |  32 ++++++
>   ld/testsuite/ld-s390/plt_31_non-pic-1.pd |  54 ++++++++++
>   ld/testsuite/ld-s390/plt_31_pic-1.pd     |  57 ++++++++++
>   ld/testsuite/ld-s390/plt_64-1.pd         |  38 +++++++
>   ld/testsuite/ld-s390/plt_64-1.s          |  26 +++++
>   ld/testsuite/ld-s390/plt_64-1.wf         |  33 ++++++
>   ld/testsuite/ld-s390/plt_64-1_eh.wf      |  31 ++++++
>   ld/testsuite/ld-s390/pltlib.s            |  16 +++
>   ld/testsuite/ld-s390/s390.exp            |  28 ++++-
>   14 files changed, 488 insertions(+), 6 deletions(-)
>   create mode 100644 ld/testsuite/ld-s390/plt_31-1.s
>   create mode 100644 ld/testsuite/ld-s390/plt_31-1.wf
>   create mode 100644 ld/testsuite/ld-s390/plt_31_non-pic-1.pd
>   create mode 100644 ld/testsuite/ld-s390/plt_31_pic-1.pd
>   create mode 100644 ld/testsuite/ld-s390/plt_64-1.pd
>   create mode 100644 ld/testsuite/ld-s390/plt_64-1.s
>   create mode 100644 ld/testsuite/ld-s390/plt_64-1.wf
>   create mode 100644 ld/testsuite/ld-s390/plt_64-1_eh.wf
>   create mode 100644 ld/testsuite/ld-s390/pltlib.s
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] s390: Generate .eh_frame unwind information for .plt section
  2025-01-27  9:12 ` [PATCH 0/3] " Andreas Krebbel
@ 2025-01-27 15:48   ` Jens Remus
  0 siblings, 0 replies; 6+ messages in thread
From: Jens Remus @ 2025-01-27 15:48 UTC (permalink / raw)
  To: Andreas Krebbel, binutils; +Cc: Andreas Arnez

Thanks! Committed to mainline.

Regards,
Jens

On 27.01.2025 10:12, Andreas Krebbel wrote:
> Hi Jens,
> 
> Patches are ok. Thank you very much!
> 
> Andreas
> 
> 
> On 1/22/25 3:10 PM, Jens Remus wrote:
>> This enables the linker on s390x to generate .eh_frame unwind
>> information for the .plt section.  Based on x86-64.  This enables
>> e.g. perf to unwind through PLT entries.  Furthermore this lays the
>> foundation to generate SFrame stack trace information in the future.
>>
>> Patch 1 resolves an issue in the linker s390 emulation option parsing.
>> This is a prerequisite to add support for linker option
>> "--[no-]ld-generated-unwind-info" in patch 3.
>>
>> Patch 2 adds basic PLT generation tests that are extended in patch 3.
>>
>> Patch 3 adds support for linker option
>> "--[no-]ld-generated-unwind-info" and enables the linker to generate
>> .eh_frame for .plt by default.
>>
>> Regards,
>> Jens
>>
>> Jens Remus (3):
>>    s390: Fix linker s390 emulation option parsing
>>    s390: Add basic PLT generation tests
>>    s390: Generate .eh_frame unwind information for .plt section
>>
>>   bfd/elf64-s390.c                         | 126 ++++++++++++++++++++++-
>>   ld/NEWS                                  |   6 ++
>>   ld/emulparams/elf64_s390.sh              |   1 +
>>   ld/emultempl/s390.em                     |   6 +-
>>   ld/testsuite/ld-s390/plt_31-1.s          |  40 +++++++
>>   ld/testsuite/ld-s390/plt_31-1.wf         |  32 ++++++
>>   ld/testsuite/ld-s390/plt_31_non-pic-1.pd |  54 ++++++++++
>>   ld/testsuite/ld-s390/plt_31_pic-1.pd     |  57 ++++++++++
>>   ld/testsuite/ld-s390/plt_64-1.pd         |  38 +++++++
>>   ld/testsuite/ld-s390/plt_64-1.s          |  26 +++++
>>   ld/testsuite/ld-s390/plt_64-1.wf         |  33 ++++++
>>   ld/testsuite/ld-s390/plt_64-1_eh.wf      |  31 ++++++
>>   ld/testsuite/ld-s390/pltlib.s            |  16 +++
>>   ld/testsuite/ld-s390/s390.exp            |  28 ++++-
>>   14 files changed, 488 insertions(+), 6 deletions(-)
>>   create mode 100644 ld/testsuite/ld-s390/plt_31-1.s
>>   create mode 100644 ld/testsuite/ld-s390/plt_31-1.wf
>>   create mode 100644 ld/testsuite/ld-s390/plt_31_non-pic-1.pd
>>   create mode 100644 ld/testsuite/ld-s390/plt_31_pic-1.pd
>>   create mode 100644 ld/testsuite/ld-s390/plt_64-1.pd
>>   create mode 100644 ld/testsuite/ld-s390/plt_64-1.s
>>   create mode 100644 ld/testsuite/ld-s390/plt_64-1.wf
>>   create mode 100644 ld/testsuite/ld-s390/plt_64-1_eh.wf
>>   create mode 100644 ld/testsuite/ld-s390/pltlib.s
>>

-- 
Jens Remus
Linux on Z Development (D3303)
+49-7031-16-1128 Office
jremus@de.ibm.com

IBM

IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Böblingen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-01-27 15:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-22 14:10 [PATCH 0/3] s390: Generate .eh_frame unwind information for .plt section Jens Remus
2025-01-22 14:10 ` [PATCH 1/3] s390: Fix linker s390 emulation option parsing Jens Remus
2025-01-22 14:10 ` [PATCH 2/3] s390: Add basic PLT generation tests Jens Remus
2025-01-22 14:10 ` [PATCH 3/3] s390: Generate .eh_frame unwind information for .plt section Jens Remus
2025-01-27  9:12 ` [PATCH 0/3] " Andreas Krebbel
2025-01-27 15:48   ` Jens Remus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).