x86-64: Correct unwind info for the BND PLT
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 11 Jan 2017 17:16:44 +0000 (09:16 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 11 Jan 2017 17:17:05 +0000 (09:17 -0800)
commit9e65917652e994b0864b344bfa47014155d93100
tree2180a62221f443eede5958412d0978f98359ec2b
parent4ad2da7317c11fbf09e8feb9948b446d30ba9ec2
x86-64: Correct unwind info for the BND PLT

Since the BND PLT has

 230: 68 00 00 00 00        pushq  $0x0
 235: f2 e9 e5 ff ff ff     bnd jmpq 220 <.plt>
 23b: 0f 1f 44 00 00        nopl   0x0(%rax,%rax,1)

instead of

 230: ff 25 e2 0d 20 00     jmpq   *0x200de2(%rip)        # 201018
<func>
 236: 68 00 00 00 00        pushq  $0x0
 23b: e9 e0 ff ff ff        jmpq   220 <.plt>

its unwind info should be

DW_CFA_def_cfa_expression (DW_OP_breg7 (rsp): 8; DW_OP_breg16 (rip): 0;
DW_OP_lit15; DW_OP_and; DW_OP_lit5; DW_OP_ge; DW_OP_lit3; DW_OP_shl;
DW_OP_plus)

bfd/

PR ld/21038
* elf64-x86-64.c (elf_x86_64_eh_frame_bnd_plt): New.
(elf_x86_64_bnd_arch_bed): Use elf_x86_64_eh_frame_bnd_plt and
elf_x86_64_eh_frame_plt_got.
(elf_x86_64_size_dynamic_sections): Get unwind info from
elf_x86_64_bnd_arch_bed for the BND PLT.

ld/

PR ld/21038
* testsuite/ld-x86-64/pr21038a.d: New file.
* testsuite/ld-x86-64/pr21038a.s: Likewise.
* testsuite/ld-x86-64/pr21038b.d: Likewise.
* testsuite/ld-x86-64/pr21038b.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run pr21038a and pr21038b.
bfd/ChangeLog
bfd/elf64-x86-64.c
ld/ChangeLog
ld/testsuite/ld-x86-64/pr21038a.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr21038a.s [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr21038b.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr21038b.s [new file with mode: 0644]
ld/testsuite/ld-x86-64/x86-64.exp