From: H.J. Lu Date: Thu, 11 May 2017 14:42:30 +0000 (-0700) Subject: x86: Generate PLT relocations for -z now X-Git-Tag: binutils-2_29~552 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dc2be3d2f6de530aac40983e79e29e050f40e759;p=external%2Fbinutils.git x86: Generate PLT relocations for -z now This patch partially reverses: commit 25070364b0ce33eed46aa5d78ebebbec6accec7e Author: H.J. Lu Date: Sat May 16 07:00:21 2015 -0700 Don't generate PLT relocations for now binding to support LD_AUDIT and LD_PROFILE with -z now. If there is an existing GOT relocation, it is still used to avoid PLT relocation against the same function symbol. bfd/ * elf32-i386.c (elf_i386_allocate_dynrelocs): Partially revert commit 25070364b0ce33eed46aa5d78ebebbec6accec7e. * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewse. ld/ * testsuite/ld-i386/plt-pic2.dd: Updated. * testsuite/ld-i386/plt2.dd: Likewise. * testsuite/ld-i386/plt2.rd: Likewise. * testsuite/ld-i386/pr17689now.rd: Likewise. * testsuite/ld-ifunc/ifunc-16-i386-now.d: Likewise. * testsuite/ld-ifunc/ifunc-16-x86-64-now.d: Likewise. * testsuite/ld-ifunc/pr17154-i386-now.d: Likewise. * testsuite/ld-ifunc/pr17154-x86-64-now.d: Likewise. * testsuite/ld-x86-64/bnd-branch-1-now.d: Likewise. * testsuite/ld-x86-64/bnd-ifunc-2-now.d: Likewise. * testsuite/ld-x86-64/bnd-plt-1-now.d: Likewise. * testsuite/ld-x86-64/plt2.dd: Likewise. * testsuite/ld-x86-64/plt2.rd: Likewise. * testsuite/ld-x86-64/pr17689now.rd: Likewise. * testsuite/ld-x86-64/pr21038b-now.d: Likewise. * testsuite/ld-x86-64/pr21038c-now.d: Likewise. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 713614d..05c3837 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2017-05-11 H.J. Lu + + * elf32-i386.c (elf_i386_allocate_dynrelocs): Partially revert + commit 25070364b0ce33eed46aa5d78ebebbec6accec7e. + * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewse. + 2017-05-10 Jose E. Marchesi * elf64-sparc.c (elf64_sparc_set_reloc): New function. diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 227cd25..6f59fb7 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -2657,26 +2657,12 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) && (h->plt.refcount > eh->func_pointer_refcount || eh->plt_got.refcount > 0)) { - bfd_boolean use_plt_got; + bfd_boolean use_plt_got = eh->plt_got.refcount > 0; /* Clear the reference count of function pointer relocations if PLT is used. */ eh->func_pointer_refcount = 0; - if (htab->plt_got != NULL - && (info->flags & DF_BIND_NOW) - && !h->pointer_equality_needed) - { - /* Don't use the regular PLT for DF_BIND_NOW. */ - h->plt.offset = (bfd_vma) -1; - - /* Use the GOT PLT. */ - h->got.refcount = 1; - eh->plt_got.refcount = 1; - } - - use_plt_got = eh->plt_got.refcount > 0; - /* Make sure this symbol is output as a dynamic symbol. Undefined weak syms won't yet be marked as dynamic. */ if (h->dynindx == -1 diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index fb9336d..8b217b4 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -3057,26 +3057,12 @@ elf_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) && (h->plt.refcount > eh->func_pointer_refcount || eh->plt_got.refcount > 0)) { - bfd_boolean use_plt_got; + bfd_boolean use_plt_got = eh->plt_got.refcount > 0; /* Clear the reference count of function pointer relocations if PLT is used. */ eh->func_pointer_refcount = 0; - if (htab->plt_got != NULL - && (info->flags & DF_BIND_NOW) - && !h->pointer_equality_needed) - { - /* Don't use the regular PLT for DF_BIND_NOW. */ - h->plt.offset = (bfd_vma) -1; - - /* Use the GOT PLT. */ - h->got.refcount = 1; - eh->plt_got.refcount = 1; - } - - use_plt_got = eh->plt_got.refcount > 0; - /* Make sure this symbol is output as a dynamic symbol. Undefined weak syms won't yet be marked as dynamic. */ if (h->dynindx == -1 diff --git a/ld/ChangeLog b/ld/ChangeLog index eb1fa7d..aac1840 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,22 @@ +2017-05-11 H.J. Lu + + * testsuite/ld-i386/plt-pic2.dd: Updated. + * testsuite/ld-i386/plt2.dd: Likewise. + * testsuite/ld-i386/plt2.rd: Likewise. + * testsuite/ld-i386/pr17689now.rd: Likewise. + * testsuite/ld-ifunc/ifunc-16-i386-now.d: Likewise. + * testsuite/ld-ifunc/ifunc-16-x86-64-now.d: Likewise. + * testsuite/ld-ifunc/pr17154-i386-now.d: Likewise. + * testsuite/ld-ifunc/pr17154-x86-64-now.d: Likewise. + * testsuite/ld-x86-64/bnd-branch-1-now.d: Likewise. + * testsuite/ld-x86-64/bnd-ifunc-2-now.d: Likewise. + * testsuite/ld-x86-64/bnd-plt-1-now.d: Likewise. + * testsuite/ld-x86-64/plt2.dd: Likewise. + * testsuite/ld-x86-64/plt2.rd: Likewise. + * testsuite/ld-x86-64/pr17689now.rd: Likewise. + * testsuite/ld-x86-64/pr21038b-now.d: Likewise. + * testsuite/ld-x86-64/pr21038c-now.d: Likewise. + 2017-05-10 H.J. Lu * emulparams/i386lynx.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Set diff --git a/ld/testsuite/ld-i386/plt-pic2.dd b/ld/testsuite/ld-i386/plt-pic2.dd index aa311fe..4047db5 100644 --- a/ld/testsuite/ld-i386/plt-pic2.dd +++ b/ld/testsuite/ld-i386/plt-pic2.dd @@ -15,19 +15,19 @@ Disassembly of section .plt: +[a-f0-9]+: 00 00 add %al,\(%eax\) ... -Disassembly of section .plt.got: - 0+190 : - +[a-f0-9]+: ff a3 f8 ff ff ff jmp \*-0x8\(%ebx\) - +[a-f0-9]+: 66 90 xchg %ax,%ax + +[a-f0-9]+: ff a3 0c 00 00 00 jmp \*0xc\(%ebx\) + +[a-f0-9]+: 68 00 00 00 00 push \$0x0 + +[a-f0-9]+: e9 e0 ff ff ff jmp 180 <.plt> -0+198 : - +[a-f0-9]+: ff a3 fc ff ff ff jmp \*-0x4\(%ebx\) - +[a-f0-9]+: 66 90 xchg %ax,%ax +0+1a0 : + +[a-f0-9]+: ff a3 10 00 00 00 jmp \*0x10\(%ebx\) + +[a-f0-9]+: 68 08 00 00 00 push \$0x8 + +[a-f0-9]+: e9 d0 ff ff ff jmp 180 <.plt> Disassembly of section .text: -0+1a0 : - +[a-f0-9]+: e8 eb ff ff ff call 190 - +[a-f0-9]+: e9 ee ff ff ff jmp 198 +0+1b0 : + +[a-f0-9]+: e8 db ff ff ff call 190 + +[a-f0-9]+: e9 e6 ff ff ff jmp 1a0 #pass diff --git a/ld/testsuite/ld-i386/plt2.dd b/ld/testsuite/ld-i386/plt2.dd index 1a5ea6f..9f8e11d 100644 --- a/ld/testsuite/ld-i386/plt2.dd +++ b/ld/testsuite/ld-i386/plt2.dd @@ -10,26 +10,25 @@ Disassembly of section .plt: 0+80481c0 <.plt>: - +[a-f0-9]+: ff 35 b4 92 04 08 pushl 0x80492b4 - +[a-f0-9]+: ff 25 b8 92 04 08 jmp \*0x80492b8 + +[a-f0-9]+: ff 35 a0 92 04 08 pushl 0x80492a0 + +[a-f0-9]+: ff 25 a4 92 04 08 jmp \*0x80492a4 +[a-f0-9]+: 00 00 add %al,\(%eax\) ... 0+80481d0 : - +[a-f0-9]+: ff 25 bc 92 04 08 jmp \*0x80492bc + +[a-f0-9]+: ff 25 a8 92 04 08 jmp \*0x80492a8 +[a-f0-9]+: 68 00 00 00 00 push \$0x0 +[a-f0-9]+: e9 e0 ff ff ff jmp 80481c0 <.plt> -Disassembly of section .plt.got: - 0+80481e0 : +[a-f0-9]+: ff 25 ac 92 04 08 jmp \*0x80492ac - +[a-f0-9]+: 66 90 xchg %ax,%ax + +[a-f0-9]+: 68 08 00 00 00 push \$0x8 + +[a-f0-9]+: e9 d0 ff ff ff jmp 80481c0 <.plt> Disassembly of section .text: -0+80481e8 <_start>: - +[a-f0-9]+: e8 e3 ff ff ff call 80481d0 - +[a-f0-9]+: e8 ee ff ff ff call 80481e0 +0+80481f0 <_start>: + +[a-f0-9]+: e8 db ff ff ff call 80481d0 + +[a-f0-9]+: e8 e6 ff ff ff call 80481e0 +[a-f0-9]+: 81 7c 24 04 d0 81 04 08 cmpl \$0x80481d0,0x4\(%esp\) #pass diff --git a/ld/testsuite/ld-i386/plt2.rd b/ld/testsuite/ld-i386/plt2.rd index 11952b4..8233a9a 100644 --- a/ld/testsuite/ld-i386/plt2.rd +++ b/ld/testsuite/ld-i386/plt2.rd @@ -5,5 +5,5 @@ #target: i?86-*-* #... - +\[ *[0-9]+\] \.plt +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+20 +.* +AX +0 +0 +16 + +\[ *[0-9]+\] \.plt +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+30 +.* +AX +0 +0 +16 #pass diff --git a/ld/testsuite/ld-i386/pr17689now.rd b/ld/testsuite/ld-i386/pr17689now.rd index 9741df8..594c424 100644 --- a/ld/testsuite/ld-i386/pr17689now.rd +++ b/ld/testsuite/ld-i386/pr17689now.rd @@ -1,4 +1,3 @@ -#failif #... [0-9a-f ]+R_386_JUMP_SLOT +0+.* -#... +#pass diff --git a/ld/testsuite/ld-ifunc/ifunc-16-i386-now.d b/ld/testsuite/ld-ifunc/ifunc-16-i386-now.d index 088b1f3..b72f077 100644 --- a/ld/testsuite/ld-ifunc/ifunc-16-i386-now.d +++ b/ld/testsuite/ld-ifunc/ifunc-16-i386-now.d @@ -3,12 +3,8 @@ #as: --32 #readelf: -r --wide #target: x86_64-*-* i?86-*-* -#notarget: x86_64-*-nacl* i?86-*-nacl* - -Relocation section '.rel.dyn' at .* -[ ]+Offset[ ]+Info[ ]+Type[ ]+.* -[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_386_GLOB_DAT[ ]+0+[ ]+ifunc Relocation section '.rel.plt' at .* [ ]+Offset[ ]+Info[ ]+Type[ ]+.* +[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_386_JUMP_SLOT[ ]+0+[ ]+ifunc [0-9a-f]+[ ]+[0-9a-f]+[ ]+R_386_IRELATIVE[ ]* diff --git a/ld/testsuite/ld-ifunc/ifunc-16-x86-64-now.d b/ld/testsuite/ld-ifunc/ifunc-16-x86-64-now.d index acc5093..db6c0e2 100644 --- a/ld/testsuite/ld-ifunc/ifunc-16-x86-64-now.d +++ b/ld/testsuite/ld-ifunc/ifunc-16-x86-64-now.d @@ -3,12 +3,8 @@ #ld: -z now -shared -melf_x86_64 #readelf: -r --wide #target: x86_64-*-* -#notarget: x86_64-*-nacl* - -Relocation section '.rela.dyn' at .* -[ ]+Offset[ ]+Info[ ]+Type[ ]+.* -[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_X86_64_GLOB_DAT[ ]+0+[ ]+ifunc \+ 0 Relocation section '.rela.plt' at .* [ ]+Offset[ ]+Info[ ]+Type[ ]+.* +[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_X86_64_JUMP_SLOT[ ]+0+[ ]+ifunc \+ 0 [0-9a-f]+[ ]+[0-9a-f]+[ ]+R_X86_64_IRELATIVE[ ]+[0-9a-f]* diff --git a/ld/testsuite/ld-ifunc/pr17154-i386-now.d b/ld/testsuite/ld-ifunc/pr17154-i386-now.d index 006af67..cb70b27 100644 --- a/ld/testsuite/ld-ifunc/pr17154-i386-now.d +++ b/ld/testsuite/ld-ifunc/pr17154-i386-now.d @@ -18,35 +18,35 @@ Disassembly of section .plt: 0+1e0 <\*ABS\*@plt>: +[a-f0-9]+: ff a3 0c 00 00 00 jmp \*0xc\(%ebx\) - +[a-f0-9]+: 68 08 00 00 00 push \$0x8 + +[a-f0-9]+: 68 18 00 00 00 push \$0x18 +[a-f0-9]+: e9 e0 ff ff ff jmp 1d0 <.plt> -0+1f0 <\*ABS\*@plt>: +0+1f0 : +[a-f0-9]+: ff a3 10 00 00 00 jmp \*0x10\(%ebx\) +[a-f0-9]+: 68 00 00 00 00 push \$0x0 +[a-f0-9]+: e9 d0 ff ff ff jmp 1d0 <.plt> -Disassembly of section .plt.got: - -0+200 : - +[a-f0-9]+: ff a3 f8 ff ff ff jmp \*-0x8\(%ebx\) - +[a-f0-9]+: 66 90 xchg %ax,%ax +0+200 : + +[a-f0-9]+: ff a3 14 00 00 00 jmp \*0x14\(%ebx\) + +[a-f0-9]+: 68 08 00 00 00 push \$0x8 + +[a-f0-9]+: e9 c0 ff ff ff jmp 1d0 <.plt> -0+208 : - +[a-f0-9]+: ff a3 fc ff ff ff jmp \*-0x4\(%ebx\) - +[a-f0-9]+: 66 90 xchg %ax,%ax +0+210 <\*ABS\*@plt>: + +[a-f0-9]+: ff a3 18 00 00 00 jmp \*0x18\(%ebx\) + +[a-f0-9]+: 68 10 00 00 00 push \$0x10 + +[a-f0-9]+: e9 b0 ff ff ff jmp 1d0 <.plt> Disassembly of section .text: -0+210 : - +[a-f0-9]+: e8 eb ff ff ff call 200 +0+220 : + +[a-f0-9]+: e8 cb ff ff ff call 1f0 -0+215 : - +[a-f0-9]+: e9 d6 ff ff ff jmp 1f0 <\*ABS\*@plt> +0+225 : + +[a-f0-9]+: e9 e6 ff ff ff jmp 210 <\*ABS\*@plt> -0+21a : - +[a-f0-9]+: e8 e9 ff ff ff call 208 +0+22a : + +[a-f0-9]+: e8 d1 ff ff ff call 200 -0+21f : - +[a-f0-9]+: e9 bc ff ff ff jmp 1e0 <\*ABS\*@plt> +0+22f : + +[a-f0-9]+: e9 ac ff ff ff jmp 1e0 <\*ABS\*@plt> #pass diff --git a/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d b/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d index 8c19571..f099575 100644 --- a/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d +++ b/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d @@ -11,41 +11,41 @@ Disassembly of section .plt: 0+2b0 <.plt>: - +[a-f0-9]+: ff 35 aa 01 20 00 pushq 0x2001aa\(%rip\) # 200460 <_GLOBAL_OFFSET_TABLE_\+0x8> - +[a-f0-9]+: ff 25 ac 01 20 00 jmpq \*0x2001ac\(%rip\) # 200468 <_GLOBAL_OFFSET_TABLE_\+0x10> + +[a-f0-9]+: ff 35 7a 01 20 00 pushq 0x20017a\(%rip\) # 200430 <_GLOBAL_OFFSET_TABLE_\+0x8> + +[a-f0-9]+: ff 25 7c 01 20 00 jmpq \*0x20017c\(%rip\) # 200438 <_GLOBAL_OFFSET_TABLE_\+0x10> +[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) -0+2c0 <\*ABS\*\+0x2fa@plt>: - +[a-f0-9]+: ff 25 aa 01 20 00 jmpq \*0x2001aa\(%rip\) # 200470 <_GLOBAL_OFFSET_TABLE_\+0x18> - +[a-f0-9]+: 68 01 00 00 00 pushq \$0x1 +0+2c0 <\*ABS\*\+0x30a@plt>: + +[a-f0-9]+: ff 25 7a 01 20 00 jmpq \*0x20017a\(%rip\) # 200440 <_GLOBAL_OFFSET_TABLE_\+0x18> + +[a-f0-9]+: 68 03 00 00 00 pushq \$0x3 +[a-f0-9]+: e9 e0 ff ff ff jmpq 2b0 <.plt> -0+2d0 <\*ABS\*\+0x2f0@plt>: - +[a-f0-9]+: ff 25 a2 01 20 00 jmpq \*0x2001a2\(%rip\) # 200478 <_GLOBAL_OFFSET_TABLE_\+0x20> +0+2d0 : + +[a-f0-9]+: ff 25 72 01 20 00 jmpq \*0x200172\(%rip\) # 200448 +[a-f0-9]+: 68 00 00 00 00 pushq \$0x0 +[a-f0-9]+: e9 d0 ff ff ff jmpq 2b0 <.plt> -Disassembly of section .plt.got: - -0+2e0 : - +[a-f0-9]+: ff 25 62 01 20 00 jmpq \*0x200162\(%rip\) # 200448 - +[a-f0-9]+: 66 90 xchg %ax,%ax +0+2e0 : + +[a-f0-9]+: ff 25 6a 01 20 00 jmpq \*0x20016a\(%rip\) # 200450 + +[a-f0-9]+: 68 01 00 00 00 pushq \$0x1 + +[a-f0-9]+: e9 c0 ff ff ff jmpq 2b0 <.plt> -0+2e8 : - +[a-f0-9]+: ff 25 62 01 20 00 jmpq \*0x200162\(%rip\) # 200450 - +[a-f0-9]+: 66 90 xchg %ax,%ax +0+2f0 <\*ABS\*\+0x300@plt>: + +[a-f0-9]+: ff 25 62 01 20 00 jmpq \*0x200162\(%rip\) # 200458 <_GLOBAL_OFFSET_TABLE_\+0x30> + +[a-f0-9]+: 68 02 00 00 00 pushq \$0x2 + +[a-f0-9]+: e9 b0 ff ff ff jmpq 2b0 <.plt> Disassembly of section .text: -0+2f0 : - +[a-f0-9]+: e8 eb ff ff ff callq 2e0 +0+300 : + +[a-f0-9]+: e8 cb ff ff ff callq 2d0 -0+2f5 : - +[a-f0-9]+: e9 d6 ff ff ff jmpq 2d0 <\*ABS\*\+0x2f0@plt> +0+305 : + +[a-f0-9]+: e9 e6 ff ff ff jmpq 2f0 <\*ABS\*\+0x300@plt> -0+2fa : - +[a-f0-9]+: e8 e9 ff ff ff callq 2e8 +0+30a : + +[a-f0-9]+: e8 d1 ff ff ff callq 2e0 -0+2ff : - +[a-f0-9]+: e9 bc ff ff ff jmpq 2c0 <\*ABS\*\+0x2fa@plt> +0+30f : + +[a-f0-9]+: e9 ac ff ff ff jmpq 2c0 <\*ABS\*\+0x30a@plt> #pass diff --git a/ld/testsuite/ld-x86-64/bnd-branch-1-now.d b/ld/testsuite/ld-x86-64/bnd-branch-1-now.d index b4cd71f..50ddf74 100644 --- a/ld/testsuite/ld-x86-64/bnd-branch-1-now.d +++ b/ld/testsuite/ld-x86-64/bnd-branch-1-now.d @@ -13,31 +13,33 @@ Disassembly of section .plt: +[a-f0-9]+: ff 25 84 01 20 00 jmpq \*0x200184\(%rip\) # 200420 <_GLOBAL_OFFSET_TABLE_\+0x10> +[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) -Disassembly of section .plt.got: - 0+2a0 : - +[a-f0-9]+: ff 25 4a 01 20 00 jmpq \*0x20014a\(%rip\) # 2003f0 - +[a-f0-9]+: 66 90 xchg %ax,%ax + +[a-f0-9]+: ff 25 82 01 20 00 jmpq \*0x200182\(%rip\) # 200428 + +[a-f0-9]+: 68 00 00 00 00 pushq \$0x0 + +[a-f0-9]+: e9 e0 ff ff ff jmpq 290 <.plt> -0+2a8 : - +[a-f0-9]+: ff 25 4a 01 20 00 jmpq \*0x20014a\(%rip\) # 2003f8 - +[a-f0-9]+: 66 90 xchg %ax,%ax +0+2b0 : + +[a-f0-9]+: ff 25 7a 01 20 00 jmpq \*0x20017a\(%rip\) # 200430 + +[a-f0-9]+: 68 01 00 00 00 pushq \$0x1 + +[a-f0-9]+: e9 d0 ff ff ff jmpq 290 <.plt> -0+2b0 : - +[a-f0-9]+: ff 25 4a 01 20 00 jmpq \*0x20014a\(%rip\) # 200400 - +[a-f0-9]+: 66 90 xchg %ax,%ax +0+2c0 : + +[a-f0-9]+: ff 25 72 01 20 00 jmpq \*0x200172\(%rip\) # 200438 + +[a-f0-9]+: 68 02 00 00 00 pushq \$0x2 + +[a-f0-9]+: e9 c0 ff ff ff jmpq 290 <.plt> -0+2b8 : - +[a-f0-9]+: ff 25 4a 01 20 00 jmpq \*0x20014a\(%rip\) # 200408 - +[a-f0-9]+: 66 90 xchg %ax,%ax +0+2d0 : + +[a-f0-9]+: ff 25 6a 01 20 00 jmpq \*0x20016a\(%rip\) # 200440 + +[a-f0-9]+: 68 03 00 00 00 pushq \$0x3 + +[a-f0-9]+: e9 b0 ff ff ff jmpq 290 <.plt> Disassembly of section .text: -0+2c0 <_start>: - +[a-f0-9]+: f2 e9 ea ff ff ff bnd jmpq 2b0 - +[a-f0-9]+: e8 d5 ff ff ff callq 2a0 - +[a-f0-9]+: e9 d8 ff ff ff jmpq 2a8 - +[a-f0-9]+: e8 e3 ff ff ff callq 2b8 - +[a-f0-9]+: f2 e8 cd ff ff ff bnd callq 2a8 - +[a-f0-9]+: e9 d8 ff ff ff jmpq 2b8 +0+2e0 <_start>: + +[a-f0-9]+: f2 e9 da ff ff ff bnd jmpq 2c0 + +[a-f0-9]+: e8 b5 ff ff ff callq 2a0 + +[a-f0-9]+: e9 c0 ff ff ff jmpq 2b0 + +[a-f0-9]+: e8 db ff ff ff callq 2d0 + +[a-f0-9]+: f2 e8 b5 ff ff ff bnd callq 2b0 + +[a-f0-9]+: e9 d0 ff ff ff jmpq 2d0 #pass diff --git a/ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d b/ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d index a9dd968..e36a928 100644 --- a/ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d +++ b/ld/testsuite/ld-x86-64/bnd-ifunc-2-now.d @@ -9,47 +9,51 @@ Disassembly of section .plt: 0+2b0 <.plt>: - +[a-f0-9]+: ff 35 ba 01 20 00 pushq 0x2001ba\(%rip\) # 200470 <_GLOBAL_OFFSET_TABLE_\+0x8> - +[a-f0-9]+: f2 ff 25 bb 01 20 00 bnd jmpq \*0x2001bb\(%rip\) # 200478 <_GLOBAL_OFFSET_TABLE_\+0x10> + +[a-f0-9]+: ff 35 9a 01 20 00 pushq 0x20019a\(%rip\) # 200450 <_GLOBAL_OFFSET_TABLE_\+0x8> + +[a-f0-9]+: f2 ff 25 9b 01 20 00 bnd jmpq \*0x20019b\(%rip\) # 200458 <_GLOBAL_OFFSET_TABLE_\+0x10> +[a-f0-9]+: 0f 1f 00 nopl \(%rax\) - +[a-f0-9]+: 68 01 00 00 00 pushq \$0x1 + +[a-f0-9]+: 68 03 00 00 00 pushq \$0x3 +[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmpq 2b0 <.plt> +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) +[a-f0-9]+: 68 00 00 00 00 pushq \$0x0 +[a-f0-9]+: f2 e9 d5 ff ff ff bnd jmpq 2b0 <.plt> +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) + +[a-f0-9]+: 68 01 00 00 00 pushq \$0x1 + +[a-f0-9]+: f2 e9 c5 ff ff ff bnd jmpq 2b0 <.plt> + +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) + +[a-f0-9]+: 68 02 00 00 00 pushq \$0x2 + +[a-f0-9]+: f2 e9 b5 ff ff ff bnd jmpq 2b0 <.plt> + +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) -Disassembly of section .plt.got: +Disassembly of section .plt.bnd: -0+2e0 : - +[a-f0-9]+: f2 ff 25 71 01 20 00 bnd jmpq \*0x200171\(%rip\) # 200458 +0+300 <\*ABS\*\+0x32c@plt>: + +[a-f0-9]+: f2 ff 25 59 01 20 00 bnd jmpq \*0x200159\(%rip\) # 200460 <_GLOBAL_OFFSET_TABLE_\+0x18> +[a-f0-9]+: 90 nop -0+2e8 : - +[a-f0-9]+: f2 ff 25 71 01 20 00 bnd jmpq \*0x200171\(%rip\) # 200460 +0+308 : + +[a-f0-9]+: f2 ff 25 59 01 20 00 bnd jmpq \*0x200159\(%rip\) # 200468 +[a-f0-9]+: 90 nop -Disassembly of section .plt.bnd: - -0+2f0 <\*ABS\*\+0x30c@plt>: - +[a-f0-9]+: f2 ff 25 89 01 20 00 bnd jmpq \*0x200189\(%rip\) # 200480 <_GLOBAL_OFFSET_TABLE_\+0x18> +0+310 : + +[a-f0-9]+: f2 ff 25 59 01 20 00 bnd jmpq \*0x200159\(%rip\) # 200470 +[a-f0-9]+: 90 nop -0+2f8 <\*ABS\*\+0x300@plt>: - +[a-f0-9]+: f2 ff 25 89 01 20 00 bnd jmpq \*0x200189\(%rip\) # 200488 <_GLOBAL_OFFSET_TABLE_\+0x20> +0+318 <\*ABS\*\+0x320@plt>: + +[a-f0-9]+: f2 ff 25 59 01 20 00 bnd jmpq \*0x200159\(%rip\) # 200478 <_GLOBAL_OFFSET_TABLE_\+0x30> +[a-f0-9]+: 90 nop Disassembly of section .text: -0+300 : - +[a-f0-9]+: f2 e8 da ff ff ff bnd callq 2e0 +0+320 : + +[a-f0-9]+: f2 e8 e2 ff ff ff bnd callq 308 -0+306 : - +[a-f0-9]+: f2 e9 ec ff ff ff bnd jmpq 2f8 <\*ABS\*\+0x300@plt> +0+326 : + +[a-f0-9]+: f2 e9 ec ff ff ff bnd jmpq 318 <\*ABS\*\+0x320@plt> -0+30c : - +[a-f0-9]+: f2 e8 d6 ff ff ff bnd callq 2e8 +0+32c : + +[a-f0-9]+: f2 e8 de ff ff ff bnd callq 310 -0+312 : - +[a-f0-9]+: f2 e9 d8 ff ff ff bnd jmpq 2f0 <\*ABS\*\+0x30c@plt> +0+332 : + +[a-f0-9]+: f2 e9 c8 ff ff ff bnd jmpq 300 <\*ABS\*\+0x32c@plt> #pass diff --git a/ld/testsuite/ld-x86-64/bnd-plt-1-now.d b/ld/testsuite/ld-x86-64/bnd-plt-1-now.d index f2932c7..65462cd 100644 --- a/ld/testsuite/ld-x86-64/bnd-plt-1-now.d +++ b/ld/testsuite/ld-x86-64/bnd-plt-1-now.d @@ -9,35 +9,47 @@ Disassembly of section .plt: 0+290 <.plt>: - +[a-f0-9]+: ff 35 82 01 20 00 pushq 0x200182\(%rip\) # 200418 <_GLOBAL_OFFSET_TABLE_\+0x8> - +[a-f0-9]+: f2 ff 25 83 01 20 00 bnd jmpq \*0x200183\(%rip\) # 200420 <_GLOBAL_OFFSET_TABLE_\+0x10> + +[a-f0-9]+: ff 35 a2 01 20 00 pushq 0x2001a2\(%rip\) # 200438 <_GLOBAL_OFFSET_TABLE_\+0x8> + +[a-f0-9]+: f2 ff 25 a3 01 20 00 bnd jmpq \*0x2001a3\(%rip\) # 200440 <_GLOBAL_OFFSET_TABLE_\+0x10> +[a-f0-9]+: 0f 1f 00 nopl \(%rax\) - -Disassembly of section .plt.got: - -0+2a0 : - +[a-f0-9]+: f2 ff 25 49 01 20 00 bnd jmpq \*0x200149\(%rip\) # 2003f0 + +[a-f0-9]+: 68 00 00 00 00 pushq \$0x0 + +[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmpq 290 <.plt> + +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) + +[a-f0-9]+: 68 01 00 00 00 pushq \$0x1 + +[a-f0-9]+: f2 e9 d5 ff ff ff bnd jmpq 290 <.plt> + +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) + +[a-f0-9]+: 68 02 00 00 00 pushq \$0x2 + +[a-f0-9]+: f2 e9 c5 ff ff ff bnd jmpq 290 <.plt> + +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) + +[a-f0-9]+: 68 03 00 00 00 pushq \$0x3 + +[a-f0-9]+: f2 e9 b5 ff ff ff bnd jmpq 290 <.plt> + +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) + +Disassembly of section .plt.bnd: + +0+2e0 : + +[a-f0-9]+: f2 ff 25 61 01 20 00 bnd jmpq \*0x200161\(%rip\) # 200448 +[a-f0-9]+: 90 nop -0+2a8 : - +[a-f0-9]+: f2 ff 25 49 01 20 00 bnd jmpq \*0x200149\(%rip\) # 2003f8 +0+2e8 : + +[a-f0-9]+: f2 ff 25 61 01 20 00 bnd jmpq \*0x200161\(%rip\) # 200450 +[a-f0-9]+: 90 nop -0+2b0 : - +[a-f0-9]+: f2 ff 25 49 01 20 00 bnd jmpq \*0x200149\(%rip\) # 200400 +0+2f0 : + +[a-f0-9]+: f2 ff 25 61 01 20 00 bnd jmpq \*0x200161\(%rip\) # 200458 +[a-f0-9]+: 90 nop -0+2b8 : - +[a-f0-9]+: f2 ff 25 49 01 20 00 bnd jmpq \*0x200149\(%rip\) # 200408 +0+2f8 : + +[a-f0-9]+: f2 ff 25 61 01 20 00 bnd jmpq \*0x200161\(%rip\) # 200460 +[a-f0-9]+: 90 nop Disassembly of section .text: -0+2c0 <_start>: - +[a-f0-9]+: f2 e9 ea ff ff ff bnd jmpq 2b0 - +[a-f0-9]+: e8 d5 ff ff ff callq 2a0 - +[a-f0-9]+: e9 d8 ff ff ff jmpq 2a8 - +[a-f0-9]+: e8 e3 ff ff ff callq 2b8 - +[a-f0-9]+: f2 e8 cd ff ff ff bnd callq 2a8 - +[a-f0-9]+: e9 d8 ff ff ff jmpq 2b8 +0+300 <_start>: + +[a-f0-9]+: f2 e9 ea ff ff ff bnd jmpq 2f0 + +[a-f0-9]+: e8 d5 ff ff ff callq 2e0 + +[a-f0-9]+: e9 d8 ff ff ff jmpq 2e8 + +[a-f0-9]+: e8 e3 ff ff ff callq 2f8 + +[a-f0-9]+: f2 e8 cd ff ff ff bnd callq 2e8 + +[a-f0-9]+: e9 d8 ff ff ff jmpq 2f8 #pass diff --git a/ld/testsuite/ld-x86-64/plt2.dd b/ld/testsuite/ld-x86-64/plt2.dd index a89e5ba..0321428 100644 --- a/ld/testsuite/ld-x86-64/plt2.dd +++ b/ld/testsuite/ld-x86-64/plt2.dd @@ -10,25 +10,24 @@ Disassembly of section .plt: 0+400290 <.plt>: - +[a-f0-9]+: ff 35 aa 01 20 00 pushq 0x2001aa\(%rip\) # 600440 <_GLOBAL_OFFSET_TABLE_\+0x8> - +[a-f0-9]+: ff 25 ac 01 20 00 jmpq \*0x2001ac\(%rip\) # 600448 <_GLOBAL_OFFSET_TABLE_\+0x10> + +[a-f0-9]+: ff 35 7a 01 20 00 pushq 0x20017a\(%rip\) # 600410 <_GLOBAL_OFFSET_TABLE_\+0x8> + +[a-f0-9]+: ff 25 7c 01 20 00 jmpq \*0x20017c\(%rip\) # 600418 <_GLOBAL_OFFSET_TABLE_\+0x10> +[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\) 0+4002a0 : - +[a-f0-9]+: ff 25 aa 01 20 00 jmpq \*0x2001aa\(%rip\) # 600450 + +[a-f0-9]+: ff 25 7a 01 20 00 jmpq \*0x20017a\(%rip\) # 600420 +[a-f0-9]+: 68 00 00 00 00 pushq \$0x0 +[a-f0-9]+: e9 e0 ff ff ff jmpq 400290 <.plt> -Disassembly of section .plt.got: - 0+4002b0 : - +[a-f0-9]+: ff 25 7a 01 20 00 jmpq \*0x20017a\(%rip\) # 600430 - +[a-f0-9]+: 66 90 xchg %ax,%ax + +[a-f0-9]+: ff 25 72 01 20 00 jmpq \*0x200172\(%rip\) # 600428 + +[a-f0-9]+: 68 01 00 00 00 pushq \$0x1 + +[a-f0-9]+: e9 d0 ff ff ff jmpq 400290 <.plt> Disassembly of section .text: -0+4002b8 <_start>: - +[a-f0-9]+: e8 e3 ff ff ff callq 4002a0 - +[a-f0-9]+: e8 ee ff ff ff callq 4002b0 +0+4002c0 <_start>: + +[a-f0-9]+: e8 db ff ff ff callq 4002a0 + +[a-f0-9]+: e8 e6 ff ff ff callq 4002b0 +[a-f0-9]+: 81 7c 24 08 a0 02 40 00 cmpl \$0x4002a0,0x8\(%rsp\) #pass diff --git a/ld/testsuite/ld-x86-64/plt2.rd b/ld/testsuite/ld-x86-64/plt2.rd index fa93f2a..6b6c8a6 100644 --- a/ld/testsuite/ld-x86-64/plt2.rd +++ b/ld/testsuite/ld-x86-64/plt2.rd @@ -5,5 +5,5 @@ #target: i?86-*-* #... - +\[ *[0-9]+\] \.plt +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+20 +.* +AX +0 +0 +16 + +\[ *[0-9]+\] \.plt +PROGBITS +[0-9a-f]+ +[0-9a-f]+ +0+30 +.* +AX +0 +0 +16 #pass diff --git a/ld/testsuite/ld-x86-64/pr17689now.rd b/ld/testsuite/ld-x86-64/pr17689now.rd index 8fd9371..c7f7065 100644 --- a/ld/testsuite/ld-x86-64/pr17689now.rd +++ b/ld/testsuite/ld-x86-64/pr17689now.rd @@ -1,4 +1,3 @@ -#failif #... [0-9a-f ]+R_X86_64_JUMP_SLOT +0+ +.* -#... +#pass diff --git a/ld/testsuite/ld-x86-64/pr21038b-now.d b/ld/testsuite/ld-x86-64/pr21038b-now.d index 562c7f1..2bafb8d 100644 --- a/ld/testsuite/ld-x86-64/pr21038b-now.d +++ b/ld/testsuite/ld-x86-64/pr21038b-now.d @@ -21,7 +21,7 @@ Contents of the .eh_frame section: DW_CFA_nop DW_CFA_nop -0+18 0000000000000014 0000001c FDE cie=00000000 pc=0000000000000238..000000000000023d +0+18 0000000000000014 0000001c FDE cie=00000000 pc=0000000000000248..000000000000024d DW_CFA_nop DW_CFA_nop DW_CFA_nop @@ -30,7 +30,7 @@ Contents of the .eh_frame section: DW_CFA_nop DW_CFA_nop -0+30 0000000000000024 00000034 FDE cie=00000000 pc=0000000000000220..0000000000000230 +0+30 0000000000000024 00000034 FDE cie=00000000 pc=0000000000000220..0000000000000240 DW_CFA_def_cfa_offset: 16 DW_CFA_advance_loc: 6 to 0000000000000226 DW_CFA_def_cfa_offset: 24 @@ -41,11 +41,7 @@ Contents of the .eh_frame section: DW_CFA_nop DW_CFA_nop -0+58 0000000000000014 0000005c FDE cie=00000000 pc=0000000000000230..0000000000000238 - DW_CFA_nop - DW_CFA_nop - DW_CFA_nop - DW_CFA_nop +0+58 0000000000000010 0000005c FDE cie=00000000 pc=0000000000000240..0000000000000248 DW_CFA_nop DW_CFA_nop DW_CFA_nop @@ -57,15 +53,18 @@ Disassembly of section .plt: +[a-f0-9]+: ff 35 c2 0d 20 00 pushq 0x200dc2\(%rip\) # 200fe8 <_GLOBAL_OFFSET_TABLE_\+0x8> +[a-f0-9]+: f2 ff 25 c3 0d 20 00 bnd jmpq \*0x200dc3\(%rip\) # 200ff0 <_GLOBAL_OFFSET_TABLE_\+0x10> +[a-f0-9]+: 0f 1f 00 nopl \(%rax\) + +[a-f0-9]+: 68 00 00 00 00 pushq \$0x0 + +[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmpq 220 <.plt> + +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) -Disassembly of section .plt.got: +Disassembly of section .plt.bnd: -0+230 : - +[a-f0-9]+: f2 ff 25 c1 0d 20 00 bnd jmpq \*0x200dc1\(%rip\) # 200ff8 +0+240 : + +[a-f0-9]+: f2 ff 25 b1 0d 20 00 bnd jmpq \*0x200db1\(%rip\) # 200ff8 +[a-f0-9]+: 90 nop Disassembly of section .text: -0+238 : - +[a-f0-9]+: e8 f3 ff ff ff callq 230 +0+248 : + +[a-f0-9]+: e8 f3 ff ff ff callq 240 #pass diff --git a/ld/testsuite/ld-x86-64/pr21038c-now.d b/ld/testsuite/ld-x86-64/pr21038c-now.d index ca24335..bdce4e0 100644 --- a/ld/testsuite/ld-x86-64/pr21038c-now.d +++ b/ld/testsuite/ld-x86-64/pr21038c-now.d @@ -21,7 +21,7 @@ Contents of the .eh_frame section: DW_CFA_nop DW_CFA_nop -0+18 0000000000000014 0000001c FDE cie=00000000 pc=0000000000000280..0000000000000291 +0+18 0000000000000014 0000001c FDE cie=00000000 pc=0000000000000290..00000000000002a1 DW_CFA_nop DW_CFA_nop DW_CFA_nop @@ -30,7 +30,7 @@ Contents of the .eh_frame section: DW_CFA_nop DW_CFA_nop -0+30 0000000000000024 00000034 FDE cie=00000000 pc=0000000000000260..0000000000000270 +0+30 0000000000000024 00000034 FDE cie=00000000 pc=0000000000000260..0000000000000280 DW_CFA_def_cfa_offset: 16 DW_CFA_advance_loc: 6 to 0000000000000266 DW_CFA_def_cfa_offset: 24 @@ -41,7 +41,7 @@ Contents of the .eh_frame section: DW_CFA_nop DW_CFA_nop -0+58 0000000000000014 0000005c FDE cie=00000000 pc=0000000000000270..0000000000000280 +0+58 0000000000000014 0000005c FDE cie=00000000 pc=0000000000000280..0000000000000288 DW_CFA_nop DW_CFA_nop DW_CFA_nop @@ -50,6 +50,11 @@ Contents of the .eh_frame section: DW_CFA_nop DW_CFA_nop +0+70 0000000000000010 00000074 FDE cie=00000000 pc=0000000000000288..0000000000000290 + DW_CFA_nop + DW_CFA_nop + DW_CFA_nop + Disassembly of section .plt: @@ -57,21 +62,26 @@ Disassembly of section .plt: +[a-f0-9]+: ff 35 7a 0d 20 00 pushq 0x200d7a\(%rip\) # 200fe0 <_GLOBAL_OFFSET_TABLE_\+0x8> +[a-f0-9]+: f2 ff 25 7b 0d 20 00 bnd jmpq \*0x200d7b\(%rip\) # 200fe8 <_GLOBAL_OFFSET_TABLE_\+0x10> +[a-f0-9]+: 0f 1f 00 nopl \(%rax\) + +[a-f0-9]+: 68 00 00 00 00 pushq \$0x0 + +[a-f0-9]+: f2 e9 e5 ff ff ff bnd jmpq 260 <.plt> + +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\) Disassembly of section .plt.got: -0+270 : - +[a-f0-9]+: f2 ff 25 79 0d 20 00 bnd jmpq \*0x200d79\(%rip\) # 200ff0 +0+280 : + +[a-f0-9]+: f2 ff 25 71 0d 20 00 bnd jmpq \*0x200d71\(%rip\) # 200ff8 +[a-f0-9]+: 90 nop -0+278 : - +[a-f0-9]+: f2 ff 25 79 0d 20 00 bnd jmpq \*0x200d79\(%rip\) # 200ff8 +Disassembly of section .plt.bnd: + +0+288 : + +[a-f0-9]+: f2 ff 25 61 0d 20 00 bnd jmpq \*0x200d61\(%rip\) # 200ff0 +[a-f0-9]+: 90 nop Disassembly of section .text: -0+280 : - +[a-f0-9]+: e8 eb ff ff ff callq 270 - +[a-f0-9]+: e8 ee ff ff ff callq 278 - +[a-f0-9]+: 48 8b 05 5f 0d 20 00 mov 0x200d5f\(%rip\),%rax # 200ff0 +0+290 : + +[a-f0-9]+: e8 eb ff ff ff callq 280 + +[a-f0-9]+: e8 ee ff ff ff callq 288 + +[a-f0-9]+: 48 8b 05 57 0d 20 00 mov 0x200d57\(%rip\),%rax # 200ff8 #pass