aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2018-08-06 21:43:51 +0930
committerAlan Modra <amodra@gmail.com>2018-08-07 18:43:55 +0930
commitdf136d64fa2fd23052d7a5fcb7059c29d8e6385d (patch)
tree65db6ef9304f194a6587437d099fee80fcbffe1c /ld
parente81b4c933c1b88e29f4b27627dd9ea0bf9189944 (diff)
downloadgdb-df136d64fa2fd23052d7a5fcb7059c29d8e6385d.zip
gdb-df136d64fa2fd23052d7a5fcb7059c29d8e6385d.tar.gz
gdb-df136d64fa2fd23052d7a5fcb7059c29d8e6385d.tar.bz2
PowerPC64 EH info for _notoc linkage stubs
This patch generates EH info for the new _notoc linkage stubs, to support unwinding from asynchronous signal handlers. Unwinding through the __tls_get_addr_opt stub was already supported, but that was just a single stub. With multiple stubs the EH opcodes need to be emitted and sized when iterating over stubs, so this is done when emitting and sizing the stub code. Emitting the CIEs and FDEs is done when sizing the stubs, as we did before in order to have the linker generated FDEs indexed in .eh_frame_hdr. I moved the final tweaks to FDEs from ppc64_elf_finish_dynamic_sections to ppc64_elf_build_stubs simply because it's tidier to be done with them at that point. bfd/ * elf64-ppc.c (struct map_stub): Delete tls_get_addr_opt_bctrl. Add lr_restore, eh_size and eh_base. (eh_advance, eh_advance_size): New functions. (build_tls_get_addr_stub): Emit EH info for stub. (ppc_build_one_stub): Likewise for _notoc stubs. (ppc_size_one_stub): Size EH info for stub. (group_sections): Init new map_stub fields. (stub_eh_frame_size): Delete. (ppc64_elf_size_stubs): Size EH info for stubs. Set up dummy EH program for stubs. (ppc64_elf_build_stubs): Reinit new map_stub fields. Set FDE offset to stub section here.. (ppc64_elf_finish_dynamic_sections): ..rather than here. ld/ * testsuite/ld-powerpc/notoc.s: Generate some cfi. * testsuite/ld-powerpc/notoc.d: Adjust. * testsuite/ld-powerpc/notoc.wf: New file. * testsuite/ld-powerpc/powerpc.exp: Run "ext" and "notoc" tests as run_ld_link_tests rather than run_dump_test.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog8
-rw-r--r--ld/testsuite/ld-powerpc/notoc.d14
-rw-r--r--ld/testsuite/ld-powerpc/notoc.s2
-rw-r--r--ld/testsuite/ld-powerpc/notoc.wf33
-rw-r--r--ld/testsuite/ld-powerpc/powerpc.exp5
5 files changed, 53 insertions, 9 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 98af468..6171d46 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,11 @@
+2018-08-07 Alan Modra <amodra@gmail.com>
+
+ * testsuite/ld-powerpc/notoc.s: Generate some cfi.
+ * testsuite/ld-powerpc/notoc.d: Adjust.
+ * testsuite/ld-powerpc/notoc.wf: New file.
+ * testsuite/ld-powerpc/powerpc.exp: Run "ext" and "notoc" tests
+ as run_ld_link_tests rather than run_dump_test.
+
2018-08-07 Martin Storsjo <martin@martin.st>
* scripttempl/pe.sc: Improve the comment about overriding
diff --git a/ld/testsuite/ld-powerpc/notoc.d b/ld/testsuite/ld-powerpc/notoc.d
index 97e7274..eaafd01 100644
--- a/ld/testsuite/ld-powerpc/notoc.d
+++ b/ld/testsuite/ld-powerpc/notoc.d
@@ -1,7 +1,7 @@
#source: notoc.s
#as: -a64
#ld: --no-plt-localentry -T ext.lnk
-#objdump: -dr
+#objdump: -d
#target: powerpc64*-*-*
.*
@@ -63,8 +63,8 @@ Disassembly of section \.text:
.*: (20 00 80 4e|4e 80 00 20) blr
.* <f2>:
-.*: (02 10 40 3c|3c 40 10 02) lis r2,4098
-.*: (00 90 42 38|38 42 90 00) addi r2,r2,-28672
+.*: (01 10 40 3c|3c 40 10 01) lis r2,4097
+.*: (00 80 42 38|38 42 80 00) addi r2,r2,-32768
.*: (4d ff ff 4b|4b ff ff 4d) bl .* <.*\.long_branch\.f1>
.*: (18 00 41 e8|e8 41 00 18) ld r2,24\(r1\)
.*: (f9 ff ff 4b|4b ff ff f9) bl .* <f2\+0x8>
@@ -78,8 +78,8 @@ Disassembly of section \.text:
.*: (20 00 80 4e|4e 80 00 20) blr
.* <g2>:
-.*: (02 10 40 3c|3c 40 10 02) lis r2,4098
-.*: (00 90 42 38|38 42 90 00) addi r2,r2,-28672
+.*: (01 10 40 3c|3c 40 10 01) lis r2,4097
+.*: (00 80 42 38|38 42 80 00) addi r2,r2,-32768
.*: (cd ff ff 4b|4b ff ff cd) bl .* <f2\+0x8>
.*: (00 00 00 60|60 00 00 00) nop
.*: (11 ff ff 4b|4b ff ff 11) bl .* <.*\.long_branch\.f1>
@@ -96,7 +96,7 @@ Disassembly of section \.text:
Disassembly of section \.text\.ext:
8000000000000000 <ext>:
-8000000000000000: (02 10 40 3c|3c 40 10 02) lis r2,4098
-8000000000000004: (00 90 42 38|38 42 90 00) addi r2,r2,-28672
+8000000000000000: (01 10 40 3c|3c 40 10 01) lis r2,4097
+8000000000000004: (00 80 42 38|38 42 80 00) addi r2,r2,-32768
8000000000000008: (00 00 00 60|60 00 00 00) nop
800000000000000c: (20 00 80 4e|4e 80 00 20) blr
diff --git a/ld/testsuite/ld-powerpc/notoc.s b/ld/testsuite/ld-powerpc/notoc.s
index 8c620df..eb881c8 100644
--- a/ld/testsuite/ld-powerpc/notoc.s
+++ b/ld/testsuite/ld-powerpc/notoc.s
@@ -53,4 +53,6 @@ g2:
blr
_start:
+ .cfi_startproc
b _start
+ .cfi_endproc
diff --git a/ld/testsuite/ld-powerpc/notoc.wf b/ld/testsuite/ld-powerpc/notoc.wf
new file mode 100644
index 0000000..208d676
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/notoc.wf
@@ -0,0 +1,33 @@
+Contents of the \.eh_frame section:
+
+
+00000000 0000000000000010 00000000 CIE
+ Version: 1
+ Augmentation: "zR"
+ Code alignment factor: 4
+ Data alignment factor: -8
+ Return address column: 65
+ Augmentation data: 1b
+ DW_CFA_def_cfa: r1 ofs 0
+
+00000014 0000000000000024 00000018 FDE cie=00000000 pc=00000000100000c0\.\.0000000010000140
+ DW_CFA_advance_loc: 24 to 00000000100000d8
+ DW_CFA_register: r65 in r12
+ DW_CFA_advance_loc: 8 to 00000000100000e0
+ DW_CFA_restore_extended: r65
+ DW_CFA_advance_loc: 40 to 0000000010000108
+ DW_CFA_register: r65 in r12
+ DW_CFA_advance_loc: 8 to 0000000010000110
+ DW_CFA_restore_extended: r65
+ DW_CFA_advance_loc: 16 to 0000000010000120
+ DW_CFA_register: r65 in r12
+ DW_CFA_advance_loc: 8 to 0000000010000128
+ DW_CFA_restore_extended: r65
+ DW_CFA_nop
+ DW_CFA_nop
+
+0000003c 0000000000000010 00000040 FDE cie=00000000 pc=00000000100001cc\.\.00000000100001d0
+ DW_CFA_nop
+ DW_CFA_nop
+ DW_CFA_nop
+
diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp
index c4ab3de..12590f1 100644
--- a/ld/testsuite/ld-powerpc/powerpc.exp
+++ b/ld/testsuite/ld-powerpc/powerpc.exp
@@ -257,6 +257,9 @@ set ppc64elftests {
{{objdump -dr tocsave2a.d}} "tocsave2a"}
{"ambig shared v1" "-shared -melf64ppc" "" "-a64" {funv1.s} {} "funv1.so"}
{"ambig shared v2" "-shared -melf64ppc" "" "-a64" {funv2.s} {} "funv2.so"}
+ {"notoc ext" "" "" "-a64" {ext.s} {} ""}
+ {"notoc" "-melf64ppc --no-plt-localentry -T ext.lnk" "" "-a64" {notoc.s}
+ {{objdump -d notoc.d} {readelf {-wf -W} notoc.wf}} "notoc"}
}
set ppceabitests {
@@ -331,8 +334,6 @@ if [ supports_ppc64 ] then {
run_dump_test "dotsym2"
run_dump_test "dotsym3"
run_dump_test "dotsym4"
- run_dump_test "ext"
- run_dump_test "notoc"
}
run_dump_test "tlsld32"