From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31346 invoked by alias); 15 Mar 2012 19:14:44 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 31300 invoked by uid 9079); 15 Mar 2012 19:14:43 -0000 Date: Thu, 15 Mar 2012 19:14:00 -0000 Message-ID: <20120315191443.31285.qmail@sourceware.org> From: kseitz@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-keiths-linespec-rewrite: Merge remote-tracking branch 'gdb/master' into archer-keiths-linespec-rewrite X-Git-Refname: refs/heads/archer-keiths-linespec-rewrite X-Git-Reftype: branch X-Git-Oldrev: 5ee352b2795621dea72001d3b4a5d586b4d8e633 X-Git-Newrev: 53031c1df4ddea9b5f0d44341e062362fcf878e3 X-SW-Source: 2012-q1/txt/msg00063.txt.bz2 List-Id: The branch, archer-keiths-linespec-rewrite has been updated via 53031c1df4ddea9b5f0d44341e062362fcf878e3 (commit) via 778c912278239e4ba44acf2b866023cfb6f8ae13 (commit) via 2037eec927a91e9f939f176ee67556ca48a7f23e (commit) via 8aaf828f00db4415170187f1d9e786bbb916d489 (commit) via 69acdef42f5cff62cf1d069348fcf4ed14305c96 (commit) via cdfae53fa67f5576d6a15500bba8ea3fb7e5aa71 (commit) via de2f714807e42df981348b72164f60ea71b37543 (commit) via 8f255da61a5667b640ee0c5d68d3a5fb380db813 (commit) via d1620965b61cd9a39a766fbb07b8b2681c14f47a (commit) via 7493f930ad532c91f186f7b2fbaacba308f90945 (commit) via 5ba09d5182a185d0b7a1cf686d7808131536d281 (commit) via 89cc5bbe4b835a5b4efa384ef2da9c3ba1b3cac5 (commit) via fe7de29ee44ce25f11b2cd0f5aafa86170d0d867 (commit) via dbc01db95dfa6f9d32e156d13abc437a80b858b9 (commit) via fcbe86bcd4734566694e12e6c0c519364e2ed538 (commit) via ee520d1b19ccd7bd17bf7cb0cb0264b1f5446f2c (commit) via 05dbea72ad0b63e512fcdb94136acf42c6a86f77 (commit) via becc34639008f2a60146735f8fb26ac080edd208 (commit) from 5ee352b2795621dea72001d3b4a5d586b4d8e633 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 53031c1df4ddea9b5f0d44341e062362fcf878e3 Merge: 778c912 8aaf828 Author: Keith Seitz Date: Thu Mar 15 11:34:42 2012 -0700 Merge remote-tracking branch 'gdb/master' into archer-keiths-linespec-rewrite Conflicts: gdb/cp-support.c commit 778c912278239e4ba44acf2b866023cfb6f8ae13 Author: Keith Seitz Date: Thu Mar 15 11:29:00 2012 -0700 More linespec.c cleanups. Deal with functions starting with '$' (remove WHATS_THIS_FOR) and add tests. Test "::foo" and "::n::foo". commit 2037eec927a91e9f939f176ee67556ca48a7f23e Author: Keith Seitz Date: Thu Mar 15 11:27:40 2012 -0700 Add tests for setting breakpoints on labels in methods. commit 8aaf828f00db4415170187f1d9e786bbb916d489 Author: Roland McGrath Date: Thu Mar 15 16:37:21 2012 +0000 * elf64-x86-64.c (struct elf_x86_64_backend_data): New type. (get_elf_x86_64_backend_data, GET_PLT_ENTRY_SIZE): New macros. (elf_x86_64_arch_bed): New variable. (elf_backend_arch_data): New macro. (elf_x86_64_adjust_dynamic_symbol): Use GET_PLT_ENTRY_SIZE. (elf_x86_64_allocate_dynrelocs): Likewise. (elf_x86_64_relocate_section): Likewise. (elf_x86_64_plt_sym_val): Likewise. (elf_x86_64_finish_dynamic_symbol): Use elf_x86_64_backend_data parameters for PLT details. (elf_x86_64_finish_dynamic_sections): Likewise. commit 69acdef42f5cff62cf1d069348fcf4ed14305c96 Author: Tom Tromey Date: Thu Mar 15 16:32:12 2012 +0000 * NEWS: Mention "info vtbl", not "info vtable". * cp-support.c (info_vtbl_command): Fix comment. (_initialize_cp_support): Fix text. commit cdfae53fa67f5576d6a15500bba8ea3fb7e5aa71 Author: Tom Tromey Date: Thu Mar 15 15:49:40 2012 +0000 * cp-valprint.c (cp_print_value_fields): Use print_function_pointer_address for vtable slot. gdb/testsuite * gdb.cp/virtfunc2.exp: Update expected output. * gdb.cp/pr9631.exp: Update expected output. * gdb.cp/member-ptr.exp: Update expected output. * gdb.cp/inherit.exp (test_print_mvi_classes): Update expected output. * gdb.cp/casts.exp: Update expected output. commit de2f714807e42df981348b72164f60ea71b37543 Author: Tom Tromey Date: Thu Mar 15 15:43:05 2012 +0000 * gnu-v3-abi.c (struct value_and_voffset): New. (hash_value_and_voffset, eq_value_and_voffset) (compare_value_and_voffset, compute_vtable_size) (print_one_vtable, gnuv3_print_vtable): New functions. (init_gnuv3_ops): Initialize 'print_vtable' field. * cp-support.c (info_vtbl_command): New function. (_initialize_cp_support): Add "info vtbl". * cp-abi.h (cplus_print_vtable): Declare. (struct cp_abi_ops) : New field. * cp-abi.c (cplus_print_vtable): New function. * NEWS: Update. gdb/testsuite * gdb.cp/virtfunc.exp (make_one_vtable_result): New proc. (test_info_vtbl): Likewise. (do_tests): Call test_info_vtbl. * gdb.cp/virtfunc.cc (va): New global. gdb/doc * gdb.texinfo (Debugging C Plus Plus): Document "info vtbl". commit 8f255da61a5667b640ee0c5d68d3a5fb380db813 Author: Rainer Orth Date: Thu Mar 15 14:13:31 2012 +0000 * configure.ac (enable_libgomp): Remove *-*-irix6*. (unsupported_languages): Remove mips-sgi-irix6.*. (noconfigdirs): Don't add ${libgcj} for mips*-*-irix6*. (with_stabs): Remove. * configure: Regenerate. commit d1620965b61cd9a39a766fbb07b8b2681c14f47a Author: Rainer Orth Date: Thu Mar 15 14:11:37 2012 +0000 * configure.ac (enable_libgomp): Remove *-*-osf*. (with_stabs): Remove alpha*-*-osf*. * configure: Regenerate. commit 7493f930ad532c91f186f7b2fbaacba308f90945 Author: Tom Tromey Date: Thu Mar 15 14:06:17 2012 +0000 * d-lang.c (d_language_defn) : Set to iterate_over_symbols. commit 5ba09d5182a185d0b7a1cf686d7808131536d281 Author: Alan Modra Date: Thu Mar 15 12:58:47 2012 +0000 include/ * dis-asm.h (disassemble_init_powerpc): Declare. opcodes/ * disassemble.c (disassemble_init_for_target): Handle ppc init. * ppc-dis.c (private): New var. (powerpc_init_dialect): Don't return calloc failure, instead use private. (PPC_OPCD_SEGS, PPC_OP_TO_SEG): Define. (powerpc_opcd_indices): New array. (disassemble_init_powerpc): New function. (print_insn_big_powerpc): Don't init dialect here. (print_insn_little_powerpc): Likewise. (print_insn_powerpc): Start search using powerpc_opcd_indices. commit 89cc5bbe4b835a5b4efa384ef2da9c3ba1b3cac5 Author: qiyao Date: Thu Mar 15 12:57:12 2012 +0000 gdb/gdbserver/ * tracepoint.c (install_tracepoint): Move duplicated tracepoint handling to ... (cmd_qtdp): ... here. commit fe7de29ee44ce25f11b2cd0f5aafa86170d0d867 Author: qiyao Date: Thu Mar 15 10:42:38 2012 +0000 gdb/gdbserver/ * tracepoint.c (struct tracepoint_action_ops): New. (struct tracepoint_action) [!IN_PROCESS_AGENT] : New field. (m_tracepoint_action_download): New. (r_tracepoint_action_download): New. (x_tracepoint_action_download): New. (l_tracepoint_action_download): New. (add_tracepoint_action): Install `action->ops' according type. (download_tracepoint_1): Move code `download' function pointer of various tracepoint_action_ops. commit dbc01db95dfa6f9d32e156d13abc437a80b858b9 Author: tschwinge Date: Thu Mar 15 09:08:09 2012 +0000 gdb/testsuite/ * gdb.dwarf2/dw2-ada-ffffffff.S: Use .4byte instead of .long for describing DWARF data structures. * gdb.dwarf2/dw2-bad-parameter-type.S: Likewise. * gdb.dwarf2/dw2-double-set-die-type.S: Likewise. * gdb.dwarf2/dw2-empty-pc-range.S: Likewise. * gdb.dwarf2/dw2-entry-value.S: Likewise. * gdb.dwarf2/dw2-modula2-self-type.S: Likewise. * gdb.dwarf2/dw2-param-error.S: Likewise. * gdb.dwarf2/dw2-skip-prologue.S: Likewise. * gdb.dwarf2/dw2-stack-boundary.S: Likewise. * gdb.dwarf2/dw4-sig-type-unused.S: Likewise. * gdb.dwarf2/implptr-optimized-out.S: Likewise. * gdb.dwarf2/member-ptr-forwardref.S: Likewise. * gdb.dwarf2/pr11465.S: Likewise. commit fcbe86bcd4734566694e12e6c0c519364e2ed538 Author: Doug Evans Date: Thu Mar 15 02:34:47 2012 +0000 * dwarf2read.c (dwarf_stack_op_name): Add DW_OP_GNU_encoded_addr, DW_OP_GNU_parameter_ref. commit ee520d1b19ccd7bd17bf7cb0cb0264b1f5446f2c Author: gdbadmin Date: Thu Mar 15 00:00:32 2012 +0000 *** empty log message *** commit 05dbea72ad0b63e512fcdb94136acf42c6a86f77 Author: Alan Modra Date: Wed Mar 14 23:00:05 2012 +0000 daily update commit becc34639008f2a60146735f8fb26ac080edd208 Author: Roland McGrath Date: Wed Mar 14 19:32:10 2012 +0000 * elf32-i386.c (elf_i386_nacl_pic_plt0_entry): Initialize up to the full size, padding out with nop instructions. ----------------------------------------------------------------------- Summary of changes: ChangeLog | 14 ++ bfd/ChangeLog | 19 ++ bfd/elf32-i386.c | 7 +- bfd/elf64-x86-64.c | 201 +++++++++++------ bfd/version.h | 2 +- configure | 23 +-- configure.ac | 23 +-- gdb/ChangeLog | 35 +++ gdb/NEWS | 3 + gdb/cp-abi.c | 10 + gdb/cp-abi.h | 6 + gdb/cp-support.c | 19 ++ gdb/cp-valprint.c | 11 + gdb/d-lang.c | 2 +- gdb/doc/ChangeLog | 4 + gdb/doc/gdb.texinfo | 6 + gdb/dwarf2read.c | 4 + gdb/gdbserver/ChangeLog | 18 ++ gdb/gdbserver/tracepoint.c | 211 +++++++++++------ gdb/gnu-v3-abi.c | 241 ++++++++++++++++++++ gdb/linespec.c | 127 ++++++----- gdb/testsuite/ChangeLog | 33 +++ gdb/testsuite/gdb.cp/casts.exp | 2 +- gdb/testsuite/gdb.cp/cplabel.cc | 80 +++++++ gdb/testsuite/gdb.cp/cplabel.exp | 38 +++ gdb/testsuite/gdb.cp/inherit.exp | 4 +- gdb/testsuite/gdb.cp/member-ptr.exp | 4 +- gdb/testsuite/gdb.cp/namespace.exp | 10 + gdb/testsuite/gdb.cp/pr9631.exp | 2 +- gdb/testsuite/gdb.cp/virtbase.exp | 2 +- gdb/testsuite/gdb.cp/virtfunc.cc | 1 + gdb/testsuite/gdb.cp/virtfunc.exp | 49 ++++ gdb/testsuite/gdb.cp/virtfunc2.exp | 1 + gdb/testsuite/gdb.dwarf2/dw2-ada-ffffffff.S | 4 +- gdb/testsuite/gdb.dwarf2/dw2-bad-parameter-type.S | 10 +- gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.S | 98 ++++---- gdb/testsuite/gdb.dwarf2/dw2-empty-pc-range.S | 4 +- gdb/testsuite/gdb.dwarf2/dw2-entry-value.S | 16 +- gdb/testsuite/gdb.dwarf2/dw2-modula2-self-type.S | 18 +- gdb/testsuite/gdb.dwarf2/dw2-param-error.S | 12 +- gdb/testsuite/gdb.dwarf2/dw2-skip-prologue.S | 10 +- gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.S | 4 +- gdb/testsuite/gdb.dwarf2/dw4-sig-type-unused.S | 10 +- gdb/testsuite/gdb.dwarf2/implptr-optimized-out.S | 6 +- gdb/testsuite/gdb.dwarf2/member-ptr-forwardref.S | 76 +++--- gdb/testsuite/gdb.dwarf2/pr11465.S | 70 +++--- gdb/testsuite/gdb.linespec/ls-errs.exp | 9 +- gdb/version.in | 2 +- include/ChangeLog | 4 + include/dis-asm.h | 3 +- opcodes/ChangeLog | 14 ++ opcodes/disassemble.c | 13 +- opcodes/ppc-dis.c | 51 +++- 53 files changed, 1207 insertions(+), 439 deletions(-) create mode 100644 gdb/testsuite/gdb.cp/cplabel.cc create mode 100644 gdb/testsuite/gdb.cp/cplabel.exp First 500 lines of diff: diff --git a/ChangeLog b/ChangeLog index a7a08e8..cff1dfb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2012-03-14 Rainer Orth + + * configure.ac (enable_libgomp): Remove *-*-irix6*. + (unsupported_languages): Remove mips-sgi-irix6.*. + (noconfigdirs): Don't add ${libgcj} for mips*-*-irix6*. + (with_stabs): Remove. + * configure: Regenerate. + +2012-03-12 Rainer Orth + + * configure.ac (enable_libgomp): Remove *-*-osf*. + (with_stabs): Remove alpha*-*-osf*. + * configure: Regenerate. + 2012-03-09 Jeff Johnston * COPYING.NEWLIB: Modify DJ Delorie license to include diff --git a/bfd/ChangeLog b/bfd/ChangeLog index eacf84e..0a674b8 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,22 @@ +2012-03-15 Roland McGrath + + * elf64-x86-64.c (struct elf_x86_64_backend_data): New type. + (get_elf_x86_64_backend_data, GET_PLT_ENTRY_SIZE): New macros. + (elf_x86_64_arch_bed): New variable. + (elf_backend_arch_data): New macro. + (elf_x86_64_adjust_dynamic_symbol): Use GET_PLT_ENTRY_SIZE. + (elf_x86_64_allocate_dynrelocs): Likewise. + (elf_x86_64_relocate_section): Likewise. + (elf_x86_64_plt_sym_val): Likewise. + (elf_x86_64_finish_dynamic_symbol): Use elf_x86_64_backend_data + parameters for PLT details. + (elf_x86_64_finish_dynamic_sections): Likewise. + +2012-03-14 Roland McGrath + + * elf32-i386.c (elf_i386_nacl_pic_plt0_entry): Initialize up + to the full size, padding out with nop instructions. + 2012-03-12 Alan Modra * elf-m10300.c (_bfd_mn10300_elf_adjust_dynamic_symbol): Don't warn diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 3014a0a..4ae2166 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -2702,7 +2702,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) it's not incremented, so in order to compute the space reserved for them, it suffices to multiply the reloc count by the jump slot size. - + PR ld/13302: We start next_irelative_index at the end of .rela.plt so that R_386_IRELATIVE entries come last. */ if (htab->elf.srelplt) @@ -5109,7 +5109,10 @@ elf_i386_nacl_pic_plt0_entry[sizeof (elf_i386_nacl_plt0_entry)] = 0x8b, 0x4b, 0x08, /* mov 0x8(%ebx), %ecx */ 0x83, 0xe1, 0xe0, /* and $NACLMASK, %ecx */ 0xff, 0xe1, /* jmp *%ecx */ - 0x90 /* nop */ + + /* This is expected to be the same size as elf_i386_nacl_plt0_entry, + so pad to that size with nop instructions. */ + 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 }; static const bfd_byte elf_i386_nacl_pic_plt_entry[NACL_PLT_ENTRY_SIZE] = diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 88c47f9..c0a4493 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -585,6 +585,70 @@ static const bfd_byte elf_x86_64_eh_frame_plt[] = DW_CFA_nop, DW_CFA_nop, DW_CFA_nop, DW_CFA_nop }; +/* Architecture-specific backend data for x86-64. */ + +struct elf_x86_64_backend_data +{ + /* Templates for the initial PLT entry and for subsequent entries. */ + const bfd_byte *plt0_entry; + const bfd_byte *plt_entry; + unsigned int plt_entry_size; /* Size of each PLT entry. */ + + /* Offsets into plt0_entry that are to be replaced with GOT[1] and GOT[2]. */ + unsigned int plt0_got1_offset; + unsigned int plt0_got2_offset; + + /* Offset of the end of the PC-relative instruction containing + plt0_got2_offset. */ + unsigned int plt0_got2_insn_end; + + /* Offsets into plt_entry that are to be replaced with... */ + unsigned int plt_got_offset; /* ... address of this symbol in .got. */ + unsigned int plt_reloc_offset; /* ... offset into relocation table. */ + unsigned int plt_plt_offset; /* ... offset to start of .plt. */ + + /* Length of the PC-relative instruction containing plt_got_offset. */ + unsigned int plt_got_insn_size; + + /* Offset of the end of the PC-relative jump to plt0_entry. */ + unsigned int plt_plt_insn_end; + + /* Offset into plt_entry where the initial value of the GOT entry points. */ + unsigned int plt_lazy_offset; + + /* .eh_frame covering the .plt section. */ + const bfd_byte *eh_frame_plt; + unsigned int eh_frame_plt_size; +}; + +#define get_elf_x86_64_backend_data(abfd) \ + ((const struct elf_x86_64_backend_data *) \ + get_elf_backend_data (abfd)->arch_data) + +#define GET_PLT_ENTRY_SIZE(abfd) \ + get_elf_x86_64_backend_data (abfd)->plt_entry_size + +/* These are the standard parameters. */ +static const struct elf_x86_64_backend_data elf_x86_64_arch_bed = + { + elf_x86_64_plt0_entry, /* plt0_entry */ + elf_x86_64_plt_entry, /* plt_entry */ + sizeof (elf_x86_64_plt_entry), /* plt_entry_size */ + 2, /* plt0_got1_offset */ + 8, /* plt0_got2_offset */ + 12, /* plt0_got2_insn_end */ + 2, /* plt_got_offset */ + 7, /* plt_reloc_offset */ + 12, /* plt_plt_offset */ + 6, /* plt_got_insn_size */ + PLT_ENTRY_SIZE, /* plt_plt_insn_end */ + 6, /* plt_lazy_offset */ + elf_x86_64_eh_frame_plt, /* eh_frame_plt */ + sizeof (elf_x86_64_eh_frame_plt), /* eh_frame_plt_size */ + }; + +#define elf_backend_arch_data &elf_x86_64_arch_bed + /* x86-64 ELF linker hash entry. */ struct elf_x86_64_link_hash_entry @@ -721,8 +785,8 @@ elf_x86_64_link_hash_newfunc (struct bfd_hash_entry *entry, if (entry == NULL) { entry = (struct bfd_hash_entry *) - bfd_hash_allocate (table, - sizeof (struct elf_x86_64_link_hash_entry)); + bfd_hash_allocate (table, + sizeof (struct elf_x86_64_link_hash_entry)); if (entry == NULL) return entry; } @@ -839,7 +903,7 @@ elf_x86_64_link_hash_table_create (bfd *abfd) ret->tls_ld_got.refcount = 0; ret->sgotplt_jump_table_size = 0; ret->tls_module_base = NULL; - ret->next_jump_slot_index = 0; + ret->next_jump_slot_index = 0; ret->next_irelative_index = 0; if (ABI_64_P (abfd)) @@ -1107,7 +1171,7 @@ elf_x86_64_check_tls_transition (bfd *abfd, h = sym_hashes[r_symndx - symtab_hdr->sh_info]; /* Use strncmp to check __tls_get_addr since __tls_get_addr - may be versioned. */ + may be versioned. */ return (h != NULL && h->root.root.string != NULL && (ELF32_R_TYPE (rel[1].r_info) == R_X86_64_PC32 @@ -2007,7 +2071,7 @@ elf_x86_64_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info, if (h != NULL) { if (r_type == R_X86_64_GOTPLT64 && h->plt.refcount > 0) - h->plt.refcount -= 1; + h->plt.refcount -= 1; if (h->got.refcount > 0) h->got.refcount -= 1; if (h->type == STT_GNU_IFUNC) @@ -2207,6 +2271,7 @@ elf_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) struct elf_x86_64_link_hash_entry *eh; struct elf_dyn_relocs *p; const struct elf_backend_data *bed; + unsigned int plt_entry_size; if (h->root.type == bfd_link_hash_indirect) return TRUE; @@ -2218,6 +2283,7 @@ elf_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) if (htab == NULL) return FALSE; bed = get_elf_backend_data (info->output_bfd); + plt_entry_size = GET_PLT_ENTRY_SIZE (info->output_bfd); /* Since STT_GNU_IFUNC symbol must go through PLT, we handle it here if it is defined and referenced in a non-shared object. */ @@ -2225,7 +2291,7 @@ elf_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) && h->def_regular) return _bfd_elf_allocate_ifunc_dyn_relocs (info, h, &eh->dyn_relocs, - PLT_ENTRY_SIZE, + plt_entry_size, GOT_ENTRY_SIZE); else if (htab->elf.dynamic_sections_created && h->plt.refcount > 0) @@ -2247,7 +2313,7 @@ elf_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) /* If this is the first .plt entry, make room for the special first entry. */ if (s->size == 0) - s->size += PLT_ENTRY_SIZE; + s->size += plt_entry_size; h->plt.offset = s->size; @@ -2264,7 +2330,7 @@ elf_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) } /* Make room for this entry. */ - s->size += PLT_ENTRY_SIZE; + s->size += plt_entry_size; /* We also need to make an entry in the .got.plt section, which will be placed in the .got section by the linker script. */ @@ -2688,9 +2754,9 @@ elf_x86_64_size_dynamic_sections (bfd *output_bfd, /* Reserve room for the initial entry. FIXME: we could probably do away with it in this case. */ if (htab->elf.splt->size == 0) - htab->elf.splt->size += PLT_ENTRY_SIZE; + htab->elf.splt->size += GET_PLT_ENTRY_SIZE (output_bfd); htab->tlsdesc_plt = htab->elf.splt->size; - htab->elf.splt->size += PLT_ENTRY_SIZE; + htab->elf.splt->size += GET_PLT_ENTRY_SIZE (output_bfd); } } @@ -2702,7 +2768,7 @@ elf_x86_64_size_dynamic_sections (bfd *output_bfd, FALSE, FALSE, FALSE); /* Don't allocate .got.plt section if there are no GOT nor PLT - entries and there is no refeence to _GLOBAL_OFFSET_TABLE_. */ + entries and there is no refeence to _GLOBAL_OFFSET_TABLE_. */ if ((got == NULL || !got->ref_regular_nonweak) && (htab->elf.sgotplt->size @@ -2828,7 +2894,7 @@ elf_x86_64_size_dynamic_sections (bfd *output_bfd, /* If any dynamic relocs apply to a read-only section, then we need a DT_TEXTREL entry. */ if ((info->flags & DF_TEXTREL) == 0) - elf_link_hash_traverse (&htab->elf, + elf_link_hash_traverse (&htab->elf, elf_x86_64_readonly_dynrelocs, info); @@ -2981,6 +3047,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, bfd_vma *local_tlsdesc_gotents; Elf_Internal_Rela *rel; Elf_Internal_Rela *relend; + const unsigned int plt_entry_size = GET_PLT_ENTRY_SIZE (info->output_bfd); BFD_ASSERT (is_x86_64_elf (input_bfd)); @@ -3023,7 +3090,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, } if (r_type != (int) R_X86_64_32 - || ABI_64_P (output_bfd)) + || ABI_64_P (output_bfd)) howto = x86_64_elf_howto_table + r_type; else howto = (x86_64_elf_howto_table @@ -3050,7 +3117,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, if (h == NULL) abort (); - /* Set STT_GNU_IFUNC symbol value. */ + /* Set STT_GNU_IFUNC symbol value. */ h->root.u.def.value = sym->st_value; h->root.u.def.section = sec; } @@ -3126,7 +3193,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, if (ABI_64_P (output_bfd)) goto do_relocation; /* FALLTHROUGH */ - case R_X86_64_64: + case R_X86_64_64: if (rel->r_addend != 0) { if (h->root.root.string) @@ -3211,13 +3278,13 @@ elf_x86_64_relocate_section (bfd *output_bfd, if (htab->elf.splt != NULL) { - plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1; + plt_index = h->plt.offset / plt_entry_size - 1; off = (plt_index + 3) * GOT_ENTRY_SIZE; base_got = htab->elf.sgotplt; } else { - plt_index = h->plt.offset / PLT_ENTRY_SIZE; + plt_index = h->plt.offset / plt_entry_size; off = plt_index * GOT_ENTRY_SIZE; base_got = htab->elf.igotplt; } @@ -3226,9 +3293,9 @@ elf_x86_64_relocate_section (bfd *output_bfd, || h->forced_local || info->symbolic) { - /* This references the local defitionion. We must + /* This references the local defitionion. We must initialize this entry in the global offset table. - Since the offset must always be a multiple of 8, + Since the offset must always be a multiple of 8, we use the least significant bit to record whether we have initialized it already. @@ -3284,14 +3351,14 @@ elf_x86_64_relocate_section (bfd *output_bfd, off = h->got.offset; if (h->needs_plt - && h->plt.offset != (bfd_vma)-1 + && h->plt.offset != (bfd_vma)-1 && off == (bfd_vma)-1) { /* We can't use h->got.offset here to save state, or even just remember the offset, as finish_dynamic_symbol would use that as offset into .got. */ - bfd_vma plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1; + bfd_vma plt_index = h->plt.offset / plt_entry_size - 1; off = (plt_index + 3) * GOT_ENTRY_SIZE; base_got = htab->elf.sgotplt; } @@ -3322,7 +3389,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, bfd_put_64 (output_bfd, relocation, base_got->contents + off); /* Note that this is harmless for the GOTPLT64 case, - as -1 | 1 still is -1. */ + as -1 | 1 still is -1. */ h->got.offset |= 1; } } @@ -3420,7 +3487,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, case R_X86_64_PLTOFF64: /* Relocation is PLT entry relative to GOT. For local symbols it's the symbol itself relative to GOT. */ - if (h != NULL + if (h != NULL /* See PLT32 handling. */ && h->plt.offset != (bfd_vma) -1 && htab->elf.splt != NULL) @@ -4154,6 +4221,8 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd, Elf_Internal_Sym *sym) { struct elf_x86_64_link_hash_table *htab; + const struct elf_x86_64_backend_data *const abed + = get_elf_x86_64_backend_data (output_bfd); htab = elf_x86_64_hash_table (info); if (htab == NULL) @@ -4207,39 +4276,38 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd, if (plt == htab->elf.splt) { - got_offset = h->plt.offset / PLT_ENTRY_SIZE - 1; + got_offset = h->plt.offset / abed->plt_entry_size - 1; got_offset = (got_offset + 3) * GOT_ENTRY_SIZE; } else { - got_offset = h->plt.offset / PLT_ENTRY_SIZE; + got_offset = h->plt.offset / abed->plt_entry_size; got_offset = got_offset * GOT_ENTRY_SIZE; } /* Fill in the entry in the procedure linkage table. */ - memcpy (plt->contents + h->plt.offset, elf_x86_64_plt_entry, - PLT_ENTRY_SIZE); - - /* Insert the relocation positions of the plt section. The magic - numbers at the end of the statements are the positions of the - relocations in the plt section. */ - /* Put offset for jmp *name@GOTPCREL(%rip), since the - instruction uses 6 bytes, subtract this value. */ + memcpy (plt->contents + h->plt.offset, abed->plt_entry, + abed->plt_entry_size); + + /* Insert the relocation positions of the plt section. */ + + /* Put offset the PC-relative instruction referring to the GOT entry, + subtracting the size of that instruction. */ bfd_put_32 (output_bfd, - (gotplt->output_section->vma - + gotplt->output_offset - + got_offset - - plt->output_section->vma - - plt->output_offset - - h->plt.offset - - 6), - plt->contents + h->plt.offset + 2); + (gotplt->output_section->vma + + gotplt->output_offset + + got_offset + - plt->output_section->vma + - plt->output_offset + - h->plt.offset + - abed->plt_got_insn_size), + plt->contents + h->plt.offset + abed->plt_got_offset); /* Fill in the entry in the global offset table, initially this - points to the pushq instruction in the PLT which is at offset 6. */ + points to the second part of the PLT entry. */ bfd_put_64 (output_bfd, (plt->output_section->vma + plt->output_offset - + h->plt.offset + 6), + + h->plt.offset + abed->plt_lazy_offset), gotplt->contents + got_offset); /* Fill in the entry in the .rela.plt section. */ @@ -4273,10 +4341,10 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd, { /* Put relocation index. */ bfd_put_32 (output_bfd, plt_index, - plt->contents + h->plt.offset + 7); + plt->contents + h->plt.offset + abed->plt_reloc_offset); /* Put offset for jmp .PLT0. */ - bfd_put_32 (output_bfd, - (h->plt.offset + PLT_ENTRY_SIZE), - plt->contents + h->plt.offset + 12); + bfd_put_32 (output_bfd, - (h->plt.offset + abed->plt_plt_insn_end), + plt->contents + h->plt.offset + abed->plt_plt_offset); } bed = get_elf_backend_data (output_bfd); @@ -4408,7 +4476,7 @@ elf_x86_64_finish_local_dynamic_symbol (void **slot, void *inf) struct elf_link_hash_entry *h = (struct elf_link_hash_entry *) *slot; struct bfd_link_info *info - = (struct bfd_link_info *) inf; + = (struct bfd_link_info *) inf; return elf_x86_64_finish_dynamic_symbol (info->output_bfd, info, h, NULL); @@ -4442,6 +4510,8 @@ elf_x86_64_finish_dynamic_sections (bfd *output_bfd, struct elf_x86_64_link_hash_table *htab; bfd *dynobj; asection *sdyn; + const struct elf_x86_64_backend_data *const abed + = get_elf_x86_64_backend_data (output_bfd); htab = elf_x86_64_hash_table (info); if (htab == NULL) @@ -4524,8 +4594,8 @@ elf_x86_64_finish_dynamic_sections (bfd *output_bfd, if (htab->elf.splt && htab->elf.splt->size > 0) { /* Fill in the first entry in the procedure linkage table. */ - memcpy (htab->elf.splt->contents, elf_x86_64_plt0_entry, - PLT_ENTRY_SIZE); + memcpy (htab->elf.splt->contents, + abed->plt0_entry, abed->plt_entry_size); /* Add offset for pushq GOT+8(%rip), since the instruction uses 6 bytes subtract this value. */ bfd_put_32 (output_bfd, @@ -4535,20 +4605,20 @@ elf_x86_64_finish_dynamic_sections (bfd *output_bfd, - htab->elf.splt->output_section->vma - htab->elf.splt->output_offset - 6), - htab->elf.splt->contents + 2); - /* Add offset for jmp *GOT+16(%rip). The 12 is the offset to - the end of the instruction. */ + htab->elf.splt->contents + abed->plt0_got1_offset); + /* Add offset for the PC-relative instruction accessing GOT+16, + subtracting the offset to the end of that instruction. */ bfd_put_32 (output_bfd, (htab->elf.sgotplt->output_section->vma + htab->elf.sgotplt->output_offset + 16 - htab->elf.splt->output_section->vma - htab->elf.splt->output_offset - - 12), - htab->elf.splt->contents + 8); + - abed->plt0_got2_insn_end), + htab->elf.splt->contents + abed->plt0_got2_offset); - elf_section_data (htab->elf.splt->output_section)->this_hdr.sh_entsize = - PLT_ENTRY_SIZE; + elf_section_data (htab->elf.splt->output_section) + ->this_hdr.sh_entsize = abed->plt_entry_size; if (htab->tlsdesc_plt) { @@ -4556,8 +4626,7 @@ elf_x86_64_finish_dynamic_sections (bfd *output_bfd, htab->elf.sgot->contents + htab->tlsdesc_got); hooks/post-receive -- Repository for Project Archer.