source:
patches/binutils-2.20-branch_update-1.patch@
b2d1ead
Last change on this file since b2d1ead was 206bb97, checked in by , 15 years ago | |
---|---|
|
|
File size: 116.3 KB |
-
bfd/ChangeLog
Submitted By: Joe Ciccone <jciccone@gmail.com> Date: 01-01-2010 Initial Package Version: 2.20 Origin: Upstream Upstream Status: From Upstream Description: Diff against current 2.20 branch. This patch was created on 20100101 diff -Naur binutils-2.20.orig/bfd/ChangeLog binutils-2.20/bfd/ChangeLog
old new 1 2009-12-21 Alan Modra <amodra@gmail.com> 2 3 * elf64-ppc.c: Delete my email address. 4 5 2009-12-17 Alan Modra <amodra@bigpond.net.au> 6 7 PR ld/11088 8 * elf32-ppc.c (update_plt_info): Clear sec here when addend is 9 less than 32768.. 10 (ppc_elf_check_relocs): ..rather than doing so here. Ignore new 11 relax relocs. 12 (ppc_elf_gc_sweep_hook): Don't segfault when symbol hiding has 13 removed plt_entry records. 14 (ppc_elf_tls_setup): Handle PIE calls to __tls_get_addr correctly. 15 (ppc_elf_tls_optimize): Likewise. Also dec __tls_get_addr refcount 16 when optimizing code using new tlsgd and tlsld marker relocs. 17 (ppc_elf_relax_section): Differentiate relaxed PLTREL24 relocs 18 from ADDR24 relocs using plt or glink. Don't clear the addend 19 for R_PPC_RELAX_PLTREL24. 20 (ppc_elf_relocate_section): Correctly handle addends on relaxed 21 PLTREL24 relocs. 22 23 2009-12-17 Alan Modra <amodra@bigpond.net.au> 24 25 PR ld/11088 26 * elf64-ppc.c (ppc64_elf_gc_sweep_hook): Don't abort if symbol 27 hiding has nulled out plt.plist. 28 29 2009-12-03 Alan Modra <amodra@bigpond.net.au> 30 31 PR ld/11047 32 * elf32-ppc.c (ppc_elf_relocate_section): Delete __tls_get_addr 33 symbol reference from relocs belonging to calls that are 34 optimized away. 35 * elf64-ppc.c (ppc64_elf_relocate_section): Likewise. 36 37 2009-11-17 Ulrich Weigand <uweigand@de.ibm.com> 38 39 * elf32-spu.c (struct spu_link_hash_table): Remove overlay_fixed, 40 reserved, and extra_stack_space members. 41 (spu_elf_auto_overlay): Use auto_overlay_fixed, auto_overlay_reserved, 42 and extra_stack_space members of htab->params instead. 43 44 2009-11-03 Alan Modra <amodra@bigpond.net.au> 45 Ulrich Weigand <uweigand@de.ibm.com> 46 47 * elf32-spu.c (mark_functions_via_relocs): Handle non-branch relocs 48 (jump tables or other references to code labels) as well. 49 50 2009-10-20 Alan Modra <amodra@bigpond.net.au> 51 52 PR binutils/10802 53 * opncls.c (_maybe_make_executable): Make DYNAMIC files executable. 54 55 2009-10-19 Hans-Peter Nilsson <hp@axis.com> 56 57 * elf32-cris.c (cris_elf_relocate_section) <case R_CRIS_32_DTPREL>: 58 Don't subtract the size of the TLS block for non-shared objects 59 from the relocation. 60 61 2009-10-16 Tristan Gingold <gingold@adacore.com> 62 63 * configure.in: Bump version to 2.20.0 64 * Makefile.am (RELEASE): Unset. 65 * configure, Makefile.in: Regenerate. 66 1 67 2009-10-16 Tristan Gingold <gingold@adacore.com> 2 68 3 69 * configure.in: Bump version to 2.20 -
bfd/configure
diff -Naur binutils-2.20.orig/bfd/configure binutils-2.20/bfd/configure
old new 4116 4116 4117 4117 # Define the identity of the package. 4118 4118 PACKAGE=bfd 4119 VERSION=2.20 4119 VERSION=2.20.0 4120 4120 4121 4121 4122 4122 cat >>confdefs.h <<_ACEOF -
bfd/configure.in
diff -Naur binutils-2.20.orig/bfd/configure.in binutils-2.20/bfd/configure.in
old new 8 8 AC_CANONICAL_TARGET 9 9 AC_ISC_POSIX 10 10 11 AM_INIT_AUTOMAKE(bfd, 2.20 )11 AM_INIT_AUTOMAKE(bfd, 2.20.0) 12 12 13 13 dnl These must be called before LT_INIT, because it may want 14 14 dnl to call AC_CHECK_PROG. -
bfd/elf32-cris.c
diff -Naur binutils-2.20.orig/bfd/elf32-cris.c binutils-2.20/bfd/elf32-cris.c
old new 1690 1690 = -elf_cris_hash_table (info)->dtpmod_refcount; 1691 1691 } 1692 1692 1693 /* The thread-based offset to the local symbol is the 1694 relocation. 1695 For the executable, TLS data begins at the thread pointer plus 1696 the negative size of the TLS data. For a DSO, that's part of 1697 the module TLS offset. */ 1693 /* The relocation is the offset from the start of the module 1694 TLS block to the (local) symbol. */ 1698 1695 relocation -= elf_hash_table (info)->tls_sec == NULL 1699 ? 0 : (elf_hash_table (info)->tls_sec->vma 1700 + (info->shared 1701 ? 0 : elf_hash_table (info)->tls_size)); 1696 ? 0 : elf_hash_table (info)->tls_sec->vma; 1702 1697 break; 1703 1698 1704 1699 case R_CRIS_32_GD: -
bfd/elf32-ppc.c
diff -Naur binutils-2.20.orig/bfd/elf32-ppc.c binutils-2.20/bfd/elf32-ppc.c
old new 3323 3323 { 3324 3324 struct plt_entry *ent; 3325 3325 3326 if (addend < 32768) 3327 sec = NULL; 3326 3328 for (ent = *plist; ent != NULL; ent = ent->next) 3327 3329 if (ent->sec == sec && ent->addend == addend) 3328 3330 break; … … 3508 3510 if (info->shared) 3509 3511 addend = rel->r_addend; 3510 3512 } 3511 if (!update_plt_info (abfd, ifunc, 3512 addend < 32768 ? NULL : got2, addend)) 3513 if (!update_plt_info (abfd, ifunc, got2, addend)) 3513 3514 return FALSE; 3514 3515 } 3515 3516 } … … 3748 3749 addend = rel->r_addend; 3749 3750 } 3750 3751 h->needs_plt = 1; 3751 if (!update_plt_info (abfd, &h->plt.plist, 3752 addend < 32768 ? NULL : got2, addend)) 3752 if (!update_plt_info (abfd, &h->plt.plist, got2, addend)) 3753 3753 return FALSE; 3754 3754 } 3755 3755 break; … … 3780 3780 case R_PPC_EMB_MRKREF: 3781 3781 case R_PPC_NONE: 3782 3782 case R_PPC_max: 3783 case R_PPC_RELAX32: 3784 case R_PPC_RELAX32PC: 3785 case R_PPC_RELAX32_PLT: 3786 case R_PPC_RELAX32PC_PLT: 3783 case R_PPC_RELAX: 3784 case R_PPC_RELAX_PLT: 3785 case R_PPC_RELAX_PLTREL24: 3787 3786 break; 3788 3787 3789 3788 /* These should only appear in dynamic objects. */ … … 4486 4485 struct plt_entry *ent; 4487 4486 4488 4487 ent = find_plt_ent (&h->plt.plist, NULL, 0); 4489 if (ent ->plt.refcount > 0)4488 if (ent != NULL && ent->plt.refcount > 0) 4490 4489 ent->plt.refcount -= 1; 4491 4490 } 4492 4491 } … … 4534 4533 if (r_type == R_PPC_PLTREL24 && info->shared) 4535 4534 addend = rel->r_addend; 4536 4535 ent = find_plt_ent (&h->plt.plist, got2, addend); 4537 if (ent ->plt.refcount > 0)4536 if (ent != NULL && ent->plt.refcount > 0) 4538 4537 ent->plt.refcount -= 1; 4539 4538 } 4540 4539 break; … … 4582 4581 && tga->root.type == bfd_link_hash_undefweak))) 4583 4582 { 4584 4583 struct plt_entry *ent; 4585 ent = find_plt_ent (&tga->plt.plist, NULL, 0); 4586 if (ent != NULL 4587 && ent->plt.refcount > 0) 4584 for (ent = tga->plt.plist; ent != NULL; ent = ent->next) 4585 if (ent->plt.refcount > 0) 4586 break; 4587 if (ent != NULL) 4588 4588 { 4589 4589 tga->root.type = bfd_link_hash_indirect; 4590 4590 tga->root.u.i.link = &opt->root; … … 4669 4669 { 4670 4670 Elf_Internal_Sym *locsyms = NULL; 4671 4671 Elf_Internal_Shdr *symtab_hdr = &elf_symtab_hdr (ibfd); 4672 asection *got2 = bfd_get_section_by_name (ibfd, ".got2"); 4672 4673 4673 4674 for (sec = ibfd->sections; sec != NULL; sec = sec->next) 4674 4675 if (sec->has_tls_reloc && !bfd_is_abs_section (sec->output_section)) … … 4762 4763 else 4763 4764 continue; 4764 4765 4766 case R_PPC_TLSGD: 4767 case R_PPC_TLSLD: 4768 expecting_tls_get_addr = 2; 4769 tls_set = 0; 4770 tls_clear = 0; 4771 break; 4772 4765 4773 default: 4766 4774 continue; 4767 4775 } … … 4769 4777 if (pass == 0) 4770 4778 { 4771 4779 if (!expecting_tls_get_addr 4772 || !sec->has_tls_get_addr_call) 4780 || (expecting_tls_get_addr == 1 4781 && !sec->has_tls_get_addr_call)) 4773 4782 continue; 4774 4783 4775 4784 if (rel + 1 < relend … … 4785 4794 break; 4786 4795 } 4787 4796 4797 if (expecting_tls_get_addr) 4798 { 4799 struct plt_entry *ent; 4800 bfd_vma addend = 0; 4801 4802 if (info->shared 4803 && ELF32_R_TYPE (rel[1].r_info) == R_PPC_PLTREL24) 4804 addend = rel[1].r_addend; 4805 ent = find_plt_ent (&htab->tls_get_addr->plt.plist, 4806 got2, addend); 4807 if (ent != NULL && ent->plt.refcount > 0) 4808 ent->plt.refcount -= 1; 4809 4810 if (expecting_tls_get_addr == 2) 4811 continue; 4812 } 4813 4788 4814 if (h != NULL) 4789 4815 { 4790 4816 tls_mask = &ppc_elf_hash_entry (h)->tls_mask; … … 4829 4855 *got_count -= 1; 4830 4856 } 4831 4857 4832 if (expecting_tls_get_addr)4833 {4834 struct plt_entry *ent;4835 4836 ent = find_plt_ent (&htab->tls_get_addr->plt.plist,4837 NULL, 0);4838 if (ent != NULL && ent->plt.refcount > 0)4839 ent->plt.refcount -= 1;4840 }4841 4842 4858 *tls_mask |= tls_set; 4843 4859 *tls_mask &= ~tls_clear; 4844 4860 } … … 6239 6255 { 6240 6256 size = 4 * ARRAY_SIZE (shared_stub_entry); 6241 6257 insn_offset = 12; 6242 stub_rtype = R_PPC_RELAX32PC;6243 6258 } 6244 6259 else 6245 6260 { 6246 6261 size = 4 * ARRAY_SIZE (stub_entry); 6247 6262 insn_offset = 0; 6248 stub_rtype = R_PPC_RELAX32;6249 6263 } 6250 6251 if (R_PPC_RELAX32_PLT - R_PPC_RELAX32 6252 != R_PPC_RELAX32PC_PLT - R_PPC_RELAX32PC) 6253 abort (); 6264 stub_rtype = R_PPC_RELAX; 6254 6265 if (tsec == htab->plt 6255 6266 || tsec == htab->glink) 6256 stub_rtype += R_PPC_RELAX32_PLT - R_PPC_RELAX32; 6267 { 6268 stub_rtype = R_PPC_RELAX_PLT; 6269 if (r_type == R_PPC_PLTREL24) 6270 stub_rtype = R_PPC_RELAX_PLTREL24; 6271 } 6257 6272 6258 6273 /* Hijack the old relocation. Since we need two 6259 6274 relocations for this use a "composite" reloc. */ 6260 6275 irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info), 6261 6276 stub_rtype); 6262 6277 irel->r_offset = trampoff + insn_offset; 6263 if (r_type == R_PPC_PLTREL24) 6278 if (r_type == R_PPC_PLTREL24 6279 && stub_rtype != R_PPC_RELAX_PLTREL24) 6264 6280 irel->r_addend = 0; 6265 6281 6266 6282 /* Record the fixup so we don't do it again this section. */ … … 6430 6446 { 6431 6447 /* Convert the internal relax relocs to external form. */ 6432 6448 for (irel = internal_relocs; irel < irelend; irel++) 6433 if (ELF32_R_TYPE (irel->r_info) == R_PPC_RELAX 32)6449 if (ELF32_R_TYPE (irel->r_info) == R_PPC_RELAX) 6434 6450 { 6435 6451 unsigned long r_symndx = ELF32_R_SYM (irel->r_info); 6436 6452 … … 6914 6930 insn1 |= 32 << 26; /* lwz */ 6915 6931 if (offset != (bfd_vma) -1) 6916 6932 { 6917 rel[1].r_info 6918 = ELF32_R_INFO (ELF32_R_SYM (rel[1].r_info), 6919 R_PPC_NONE); 6933 rel[1].r_info = ELF32_R_INFO (STN_UNDEF, R_PPC_NONE); 6920 6934 insn2 = 0x7c631214; /* add 3,3,2 */ 6921 6935 bfd_put_32 (output_bfd, insn2, contents + offset); 6922 6936 } … … 6990 7004 bfd_put_32 (output_bfd, insn2, contents + offset); 6991 7005 /* Zap the reloc on the _tls_get_addr call too. */ 6992 7006 BFD_ASSERT (offset == rel[1].r_offset); 6993 rel[1].r_info = ELF32_R_INFO (ELF32_R_SYM (rel[1].r_info), 6994 R_PPC_NONE); 7007 rel[1].r_info = ELF32_R_INFO (STN_UNDEF, R_PPC_NONE); 6995 7008 } 6996 7009 break; 6997 7010 … … 7020 7033 contents + rel->r_offset - d_offset); 7021 7034 /* Zap the reloc on the _tls_get_addr call too. */ 7022 7035 BFD_ASSERT (rel->r_offset - d_offset == rel[1].r_offset); 7023 rel[1].r_info = ELF32_R_INFO (ELF32_R_SYM (rel[1].r_info), 7024 R_PPC_NONE); 7036 rel[1].r_info = ELF32_R_INFO (STN_UNDEF, R_PPC_NONE); 7025 7037 rel--; 7026 7038 continue; 7027 7039 } … … 7653 7665 } 7654 7666 break; 7655 7667 7656 case R_PPC_RELAX 32PC_PLT:7657 case R_PPC_RELAX 32_PLT:7668 case R_PPC_RELAX_PLT: 7669 case R_PPC_RELAX_PLTREL24: 7658 7670 if (h != NULL) 7659 7671 { 7660 struct plt_entry *ent = find_plt_ent (&h->plt.plist, got2, 7661 info->shared ? addend : 0); 7672 struct plt_entry *ent; 7673 bfd_vma got2_addend = 0; 7674 7675 if (r_type == R_PPC_RELAX_PLTREL24) 7676 { 7677 if (info->shared) 7678 got2_addend = addend; 7679 addend = 0; 7680 } 7681 ent = find_plt_ent (&h->plt.plist, got2, got2_addend); 7662 7682 if (htab->plt_type == PLT_NEW) 7663 7683 relocation = (htab->glink->output_section->vma 7664 7684 + htab->glink->output_offset … … 7668 7688 + htab->plt->output_offset 7669 7689 + ent->plt.offset); 7670 7690 } 7671 if (r_type == R_PPC_RELAX32_PLT)7672 goto relax32;7673 7691 /* Fall thru */ 7674 7692 7675 case R_PPC_RELAX 32PC:7676 relocation -= (input_section->output_section->vma7677 + input_section->output_offset7678 + rel->r_offset - 4);7679 /* Fall thru */7693 case R_PPC_RELAX: 7694 if (info->shared) 7695 relocation -= (input_section->output_section->vma 7696 + input_section->output_offset 7697 + rel->r_offset - 4); 7680 7698 7681 case R_PPC_RELAX32:7682 relax32:7683 7699 { 7684 7700 unsigned long t0; 7685 7701 unsigned long t1; -
bfd/elf32-spu.c
diff -Naur binutils-2.20.orig/bfd/elf32-spu.c binutils-2.20/bfd/elf32-spu.c
old new 331 331 332 332 /* How much memory we have. */ 333 333 unsigned int local_store; 334 /* Local store --auto-overlay should reserve for non-overlay 335 functions and data. */ 336 unsigned int overlay_fixed; 337 /* Local store --auto-overlay should reserve for stack and heap. */ 338 unsigned int reserved; 339 /* If reserved is not specified, stack analysis will calculate a value 340 for the stack. This parameter adjusts that value to allow for 341 negative sp access (the ABI says 2000 bytes below sp are valid, 342 and the overlay manager uses some of this area). */ 343 int extra_stack_space; 334 344 335 /* Count of overlay stubs needed in non-overlay area. */ 345 336 unsigned int non_ovly_stub; 346 337 … … 2692 2683 Elf_Internal_Sym *sym; 2693 2684 struct elf_link_hash_entry *h; 2694 2685 bfd_vma val; 2695 bfd_boolean reject, is_call;2686 bfd_boolean nonbranch, is_call; 2696 2687 struct function_info *caller; 2697 2688 struct call_info *callee; 2698 2689 2699 reject = FALSE;2700 2690 r_type = ELF32_R_TYPE (irela->r_info); 2701 if (r_type != R_SPU_REL16 2702 && r_type != R_SPU_ADDR16) 2703 { 2704 reject = TRUE; 2705 if (!(call_tree && spu_hash_table (info)->params->auto_overlay)) 2706 continue; 2707 } 2691 nonbranch = r_type != R_SPU_REL16 && r_type != R_SPU_ADDR16; 2708 2692 2709 2693 r_indx = ELF32_R_SYM (irela->r_info); 2710 2694 if (!get_sym_h (&h, &sym, &sym_sec, psyms, r_indx, sec->owner)) … … 2715 2699 continue; 2716 2700 2717 2701 is_call = FALSE; 2718 if (! reject)2702 if (!nonbranch) 2719 2703 { 2720 2704 unsigned char insn[4]; 2721 2705 … … 2746 2730 } 2747 2731 else 2748 2732 { 2749 reject = TRUE; 2750 if (!(call_tree && spu_hash_table (info)->params->auto_overlay) 2751 || is_hint (insn)) 2733 nonbranch = TRUE; 2734 if (is_hint (insn)) 2752 2735 continue; 2753 2736 } 2754 2737 } 2755 2738 2756 if ( reject)2739 if (nonbranch) 2757 2740 { 2758 2741 /* For --auto-overlay, count possible stubs we need for 2759 2742 function pointer references. */ … … 2763 2746 else 2764 2747 sym_type = ELF_ST_TYPE (sym->st_info); 2765 2748 if (sym_type == STT_FUNC) 2766 spu_hash_table (info)->non_ovly_stub += 1; 2767 continue; 2749 { 2750 if (call_tree && spu_hash_table (info)->params->auto_overlay) 2751 spu_hash_table (info)->non_ovly_stub += 1; 2752 /* If the symbol type is STT_FUNC then this must be a 2753 function pointer initialisation. */ 2754 continue; 2755 } 2756 /* Ignore data references. */ 2757 if ((sym_sec->flags & (SEC_ALLOC | SEC_LOAD | SEC_CODE)) 2758 != (SEC_ALLOC | SEC_LOAD | SEC_CODE)) 2759 continue; 2760 /* Otherwise we probably have a jump table reloc for 2761 a switch statement or some other reference to a 2762 code label. */ 2768 2763 } 2769 2764 2770 2765 if (h) … … 2813 2808 callee->is_pasted = FALSE; 2814 2809 callee->broken_cycle = FALSE; 2815 2810 callee->priority = priority; 2816 callee->count = 1;2811 callee->count = nonbranch? 0 : 1; 2817 2812 if (callee->fun->last_caller != sec) 2818 2813 { 2819 2814 callee->fun->last_caller = sec; … … 4159 4154 bfd **bfd_arr; 4160 4155 struct elf_segment_map *m; 4161 4156 unsigned int fixed_size, lo, hi; 4157 unsigned int reserved; 4162 4158 struct spu_link_hash_table *htab; 4163 4159 unsigned int base, i, count, bfd_count; 4164 4160 unsigned int region, ovlynum; … … 4194 4190 goto err_exit; 4195 4191 4196 4192 htab = spu_hash_table (info); 4197 if (htab->reserved == 0) 4193 reserved = htab->params->auto_overlay_reserved; 4194 if (reserved == 0) 4198 4195 { 4199 4196 struct _sum_stack_param sum_stack_param; 4200 4197 … … 4202 4199 sum_stack_param.overall_stack = 0; 4203 4200 if (!for_each_node (sum_stack, info, &sum_stack_param, TRUE)) 4204 4201 goto err_exit; 4205 htab->reserved = sum_stack_param.overall_stack + htab->extra_stack_space; 4202 reserved = (sum_stack_param.overall_stack 4203 + htab->params->extra_stack_space); 4206 4204 } 4207 4205 4208 4206 /* No need for overlays if everything already fits. */ 4209 if (fixed_size + htab->reserved <= htab->local_store4207 if (fixed_size + reserved <= htab->local_store 4210 4208 && htab->params->ovly_flavour != ovly_soft_icache) 4211 4209 { 4212 4210 htab->params->auto_overlay = 0; … … 4319 4317 } 4320 4318 free (bfd_arr); 4321 4319 4322 fixed_size += htab->reserved;4320 fixed_size += reserved; 4323 4321 fixed_size += htab->non_ovly_stub * ovl_stub_size (htab->params); 4324 4322 if (fixed_size + mos_param.max_overlay_size <= htab->local_store) 4325 4323 { … … 4358 4356 (bfd_vma) mos_param.max_overlay_size); 4359 4357 4360 4358 /* Now see if we should put some functions in the non-overlay area. */ 4361 else if (fixed_size < htab-> overlay_fixed)4359 else if (fixed_size < htab->params->auto_overlay_fixed) 4362 4360 { 4363 4361 unsigned int max_fixed, lib_size; 4364 4362 4365 4363 max_fixed = htab->local_store - mos_param.max_overlay_size; 4366 if (max_fixed > htab-> overlay_fixed)4367 max_fixed = htab-> overlay_fixed;4364 if (max_fixed > htab->params->auto_overlay_fixed) 4365 max_fixed = htab->params->auto_overlay_fixed; 4368 4366 lib_size = max_fixed - fixed_size; 4369 4367 lib_size = auto_ovl_lib_functions (info, lib_size); 4370 4368 if (lib_size == (unsigned int) -1) -
bfd/elf64-ppc.c
diff -Naur binutils-2.20.orig/bfd/elf64-ppc.c binutils-2.20/bfd/elf64-ppc.c
old new 3 3 2009 Free Software Foundation, Inc. 4 4 Written by Linus Nordberg, Swox AB <info@swox.com>, 5 5 based on elf32-ppc.c by Ian Lance Taylor. 6 Largely rewritten by Alan Modra <amodra@bigpond.net.au>6 Largely rewritten by Alan Modra. 7 7 8 8 This file is part of BFD, the Binary File Descriptor library. 9 9 … … 5866 5866 for (ent = h->plt.plist; ent != NULL; ent = ent->next) 5867 5867 if (ent->addend == rel->r_addend) 5868 5868 break; 5869 if (ent == NULL) 5870 abort (); 5871 if (ent->plt.refcount > 0) 5869 if (ent != NULL && ent->plt.refcount > 0) 5872 5870 ent->plt.refcount -= 1; 5873 5871 } 5874 5872 break; … … 11129 11127 insn1 |= 58 << 26; /* ld */ 11130 11128 insn2 = 0x7c636a14; /* add 3,3,13 */ 11131 11129 if (offset != (bfd_vma) -1) 11132 rel[1].r_info = ELF64_R_INFO (ELF64_R_SYM (rel[1].r_info), 11133 R_PPC64_NONE); 11130 rel[1].r_info = ELF64_R_INFO (STN_UNDEF, R_PPC64_NONE); 11134 11131 if ((tls_mask & TLS_EXPLICIT) == 0) 11135 11132 r_type = (((r_type - (R_PPC64_GOT_TLSGD16 & 3)) & 3) 11136 11133 + R_PPC64_GOT_TPREL16_DS); … … 11229 11226 rel->r_info = ELF64_R_INFO (r_symndx, r_type); 11230 11227 /* Zap the reloc on the _tls_get_addr call too. */ 11231 11228 BFD_ASSERT (offset == rel[1].r_offset); 11232 rel[1].r_info = ELF64_R_INFO (ELF64_R_SYM (rel[1].r_info), 11233 R_PPC64_NONE); 11229 rel[1].r_info = ELF64_R_INFO (STN_UNDEF, R_PPC64_NONE); 11234 11230 insn3 = bfd_get_32 (output_bfd, 11235 11231 contents + offset + 4); 11236 11232 if (insn3 == NOP … … 11275 11271 rel->r_offset = offset + d_offset; 11276 11272 /* Zap the reloc on the _tls_get_addr call too. */ 11277 11273 BFD_ASSERT (offset == rel[1].r_offset); 11278 rel[1].r_info = ELF64_R_INFO (ELF64_R_SYM (rel[1].r_info), 11279 R_PPC64_NONE); 11274 rel[1].r_info = ELF64_R_INFO (STN_UNDEF, R_PPC64_NONE); 11280 11275 insn2 = 0x38630000; /* addi 3,3,0 */ 11281 11276 insn3 = bfd_get_32 (output_bfd, 11282 11277 contents + offset + 4); -
bfd/Makefile.in
diff -Naur binutils-2.20.orig/bfd/Makefile.in binutils-2.20/bfd/Makefile.in
old new 224 224 PACKAGE_URL = @PACKAGE_URL@ 225 225 PACKAGE_VERSION = @PACKAGE_VERSION@ 226 226 PATH_SEPARATOR = @PATH_SEPARATOR@ 227 PKGVERSION = @PKGVERSION@227 PKGVERSION = (GNU Binutils for Cross-LFS - Retrieved on 20100101) 228 228 POSUB = @POSUB@ 229 229 RANLIB = @RANLIB@ 230 230 REPORT_BUGS_TEXI = @REPORT_BUGS_TEXI@ … … 317 317 ACLOCAL_AMFLAGS = -I . -I .. -I ../config 318 318 319 319 # Uncomment the following line when doing a release. 320 RELEASE =y320 RELEASE=y 321 321 INCDIR = $(srcdir)/../include 322 322 CSEARCH = -I. -I$(srcdir) -I$(INCDIR) 323 323 SUBDIRS = doc po -
bfd/opncls.c
diff -Naur binutils-2.20.orig/bfd/opncls.c binutils-2.20/bfd/opncls.c
old new 635 635 /* If the file was open for writing and is now executable, 636 636 make it so. */ 637 637 if (abfd->direction == write_direction 638 && abfd->flags & EXEC_P)638 && (abfd->flags & (EXEC_P | DYNAMIC)) != 0) 639 639 { 640 640 struct stat buf; 641 641 -
bfd/version.h
diff -Naur binutils-2.20.orig/bfd/version.h binutils-2.20/bfd/version.h
old new 1 #define BFD_VERSION_DATE 20 0910161 #define BFD_VERSION_DATE 20100101 2 2 #define BFD_VERSION @bfd_version@ 3 3 #define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@ 4 4 #define REPORT_BUGS_TO @report_bugs_to@ -
binutils/ChangeLog
diff -Naur binutils-2.20.orig/binutils/ChangeLog binutils-2.20/binutils/ChangeLog
old new 1 2009-12-31 Eirik Byrkjeflot Anonsen <eirik@opera.com> 2 Nick Clifton <nickc@redhat.com> 3 4 * objcopy.c (add_redefine_syms_file): Avoid symbol buffer 5 overrun. 6 7 2009-10-23 Thomas Cougnard <thomas.cougnard@gmail.com> 8 9 * readelf.c (dynamic_info): Correct size of array. 10 11 2009-10-19 Jerker BÀck <jerker.back@gmail.com> 12 13 PR binutils/10793 14 * prdbg.c (tg_end_struct_type): Warning fix. 15 16 PR binutils/10792 17 * dlltool.c (dll_name_list_append): Declare variable at start 18 of block. 19 (dll_name_list_count, dll_name-list_print): Likewise. 20 1 21 2009-10-01 Alan Modra <amodra@bigpond.net.au> 2 22 3 23 * addr2line.c (slurp_symtab): Don't use bfd_read_minisymbols. -
binutils/dlltool.c
diff -Naur binutils-2.20.orig/binutils/dlltool.c binutils-2.20/binutils/dlltool.c
old new 3162 3162 static void 3163 3163 dll_name_list_append (dll_name_list_type * list, bfd_byte * data) 3164 3164 { 3165 dll_name_list_node_type * entry; 3166 3165 3167 /* Error checking. */ 3166 3168 if (! list || ! list->tail) 3167 3169 return; 3168 3170 3169 3171 /* Allocate new node. */ 3170 dll_name_list_node_type * entry =3171 (dll_name_list_node_type *) xmalloc (sizeof (dll_name_list_node_type));3172 entry = ((dll_name_list_node_type *) 3173 xmalloc (sizeof (dll_name_list_node_type))); 3172 3174 3173 3175 /* Initialize its values. */ 3174 3176 entry->dllname = xstrdup ((char *) data); … … 3184 3186 static int 3185 3187 dll_name_list_count (dll_name_list_type * list) 3186 3188 { 3189 dll_name_list_node_type * p; 3190 int count = 0; 3191 3187 3192 /* Error checking. */ 3188 3193 if (! list || ! list->head) 3189 3194 return 0; 3190 3195 3191 int count = 0; 3192 dll_name_list_node_type * p = list->head; 3196 p = list->head; 3193 3197 3194 3198 while (p && p->next) 3195 3199 { … … 3204 3208 static void 3205 3209 dll_name_list_print (dll_name_list_type * list) 3206 3210 { 3211 dll_name_list_node_type * p; 3212 3207 3213 /* Error checking. */ 3208 3214 if (! list || ! list->head) 3209 3215 return; 3210 3216 3211 dll_name_list_node_type *p = list->head;3217 p = list->head; 3212 3218 3213 3219 while (p && p->next && p->next->dllname && *(p->next->dllname)) 3214 3220 { -
binutils/MAINTAINERS
diff -Naur binutils-2.20.orig/binutils/MAINTAINERS binutils-2.20/binutils/MAINTAINERS
old new 38 38 Jeff Law <law@redhat.com> 39 39 Jim Wilson <wilson@tuliptree.org> 40 40 DJ Delorie <dj@redhat.com> 41 Alan Modra <amodra@ bigpond.net.au>41 Alan Modra <amodra@gmail.com> 42 42 Michael Meissner <gnu@the-meissners.org> 43 43 Daniel Jacobowitz <dan@debian.org> 44 44 Richard Sandiford <rdsandiford@googlemail.com> … … 77 77 FRV Alexandre Oliva <aoliva@redhat.com> 78 78 H8300 Prafulla Thakare <prafulla.thakare@kpitcummins.com> 79 79 HPPA Dave Anglin <dave.anglin@nrc.ca> 80 HPPA elf32 Alan Modra <amodra@ bigpond.net.au>80 HPPA elf32 Alan Modra <amodra@gmail.com> 81 81 HPPA elf64 Jeff Law <law@redhat.com> [Basic maintainance only] 82 82 IA-64 Jim Wilson <wilson@tuliptree.org> 83 83 IQ2000 Stan Cox <scox@redhat.com> … … 102 102 MSP430 Dmitry Diky <diwil@spec.ru> 103 103 NetBSD support Matt Thomas <matt@netbsd.org> 104 104 PPC Geoff Keating <geoffk@geoffk.org> 105 PPC Alan Modra <amodra@ bigpond.net.au>105 PPC Alan Modra <amodra@gmail.com> 106 106 PPC vector ext Aldy Hernandez <aldyh@redhat.com> 107 107 s390, s390x Martin Schwidefsky <schwidefsky@de.ibm.com> 108 108 SCORE Mei Ligang <ligang@sunnorth.com.cn> 109 109 SH Alexandre Oliva <aoliva@redhat.com> 110 110 SH Kaz Kojima <kkojima@rr.iij4u.or.jp> 111 111 SPARC Jakub Jelinek <jakub@redhat.com> 112 SPU Alan Modra <amodra@ bigpond.net.au>112 SPU Alan Modra <amodra@gmail.com> 113 113 TESTSUITES Ben Elliston <bje@gnu.org> 114 114 TIC4X Svein Seldal <svein@dev.seldal.com> 115 115 TIC54X Timothy Wall <twall@alum.mit.edu> -
binutils/objcopy.c
diff -Naur binutils-2.20.orig/binutils/objcopy.c binutils-2.20/binutils/objcopy.c
old new 1237 1237 filename, strerror (errno)); 1238 1238 1239 1239 bufsize = 100; 1240 buf = (char *) xmalloc (bufsize );1240 buf = (char *) xmalloc (bufsize + 1 /* For the terminating NUL. */); 1241 1241 1242 1242 lineno = 1; 1243 1243 c = getc (file); … … 1254 1254 if (len >= bufsize) 1255 1255 { 1256 1256 bufsize *= 2; 1257 buf = (char *) xrealloc (buf, bufsize );1257 buf = (char *) xrealloc (buf, bufsize + 1); 1258 1258 } 1259 1259 c = getc (file); 1260 1260 } … … 1280 1280 if (len >= bufsize) 1281 1281 { 1282 1282 bufsize *= 2; 1283 buf = (char *) xrealloc (buf, bufsize );1283 buf = (char *) xrealloc (buf, bufsize + 1); 1284 1284 } 1285 1285 c = getc (file); 1286 1286 } -
binutils/prdbg.c
diff -Naur binutils-2.20.orig/binutils/prdbg.c binutils-2.20/binutils/prdbg.c
old new 2088 2088 static bfd_boolean 2089 2089 tg_end_struct_type (void *p ATTRIBUTE_UNUSED) 2090 2090 { 2091 struct pr_handle *info = (struct pr_handle *) p; 2092 assert (info->stack != NULL); 2091 assert (((struct pr_handle *) p)->stack != NULL); 2093 2092 2094 2093 return TRUE; 2095 2094 } -
binutils/readelf.c
diff -Naur binutils-2.20.orig/binutils/readelf.c binutils-2.20/binutils/readelf.c
old new 165 165 static unsigned long dynamic_syminfo_offset; 166 166 static unsigned int dynamic_syminfo_nent; 167 167 static char program_interpreter[PATH_MAX]; 168 static bfd_vma dynamic_info[DT_ JMPREL + 1];168 static bfd_vma dynamic_info[DT_ENCODING]; 169 169 static bfd_vma dynamic_info_DT_GNU_HASH; 170 170 static bfd_vma version_info[16]; 171 171 static Elf_Internal_Ehdr elf_header; -
configure.ac
diff -Naur binutils-2.20.orig/configure.ac binutils-2.20/configure.ac
old new 169 169 # binutils, gas and ld appear in that order because it makes sense to run 170 170 # "make check" in that particular order. 171 171 # If --enable-gold is used, "gold" will replace "ld". 172 host_tools=" byacc flex bison binutils gas ld fixincludes gcc cgen sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar gnattools"172 host_tools="texinfo byacc flex bison binutils gas ld fixincludes gcc cgen sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar gnattools" 173 173 174 174 # libgcj represents the runtime libraries only used by gcj. 175 175 libgcj="target-libffi \ -
binutils-2.20
diff -Naur binutils-2.20.orig/gas/as.h binutils-2.20/gas/as.h
old new 238 238 #define know(p) gas_assert(p) /* Verify our assumptions! */ 239 239 #endif /* not yet defined */ 240 240 #else 241 #define know(p) 241 #define know(p) do {} while (0) /* know() checks are no-op.ed */ 242 242 #endif 243 243 244 244 -
gas/ChangeLog
/* input_scrub.c */ diff -Naur binutils-2.20.orig/gas/ChangeLog binutils-2.20/gas/ChangeLog
old new 1 2009-12-24 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> 2 3 Backport from trunk: 4 2009-12-21 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> 5 Richard Earnshaw <richard.earnshaw@arm.com> 6 7 * config/tc-arm.c (encode_thumb2_b_bl_offset): New. Refactored 8 from md_apply_fix. 9 (md_apply_fix): Fixup range checks for Thumb2 version 10 of unconditional calls. Call encode_thumb2_b_bl_offset for 11 unconditional branches / function calls. 12 13 2009-12-15 H.J. Lu <hongjiu.lu@intel.com> 14 15 Backport from trunk: 16 2009-12-07 H.J. Lu <hongjiu.lu@intel.com> 17 18 PR gas/11037 19 * expr.c (resolve_expression): Call symbol_same_p to check 20 if 2 symbols are the same. 21 22 * symbols.c (symbol_same_p): New. 23 * symbols.h (symbol_same_p): Likewise. 24 25 2009-12-03 Nick Clifton <nickc@redhat.com> 26 27 PR gas/11011 28 Import this patch from the mainline: 29 2009-10-18 Alan Modra <amodra@bigpond.net.au> 30 31 * as.h (know): Don't define as empty. 32 33 2009-10-28 Alan Modra <amodra@bigpond.net.au> 34 35 PR gas/10856 36 * expr.c (resolve_expression): Only add "left" value to O_symbol 37 expression when the symbol is undefined and different from the 38 original symbol. Simplify negative logic. 39 40 2009-10-18 Matthias Klose <doko@ubuntu.com> 41 42 * config/tc-arm.c (make_mapping_symbol): Add braces to avoid empty body 43 in release builds. 44 1 45 2009-10-13 Alan Modra <amodra@bigpond.net.au> 2 46 H.J. Lu <hongjiu.lu@intel.com> 3 47 -
gas/config/tc-arm.c
diff -Naur binutils-2.20.orig/gas/config/tc-arm.c binutils-2.20/gas/config/tc-arm.c
old new 2486 2486 frag->tc_frag_data.first_map = symbolP; 2487 2487 } 2488 2488 if (frag->tc_frag_data.last_map != NULL) 2489 know (S_GET_VALUE (frag->tc_frag_data.last_map) < S_GET_VALUE (symbolP)); 2489 { 2490 know (S_GET_VALUE (frag->tc_frag_data.last_map) < S_GET_VALUE (symbolP)); 2491 } 2490 2492 frag->tc_frag_data.last_map = symbolP; 2491 2493 } 2492 2494 … … 19381 19383 return FALSE; 19382 19384 } 19383 19385 19386 /* Encode Thumb2 unconditional branches and calls. The encoding 19387 for the 2 are identical for the immediate values. */ 19388 19389 static void 19390 encode_thumb2_b_bl_offset (char * buf, offsetT value) 19391 { 19392 #define T2I1I2MASK ((1 << 13) | (1 << 11)) 19393 offsetT newval; 19394 offsetT newval2; 19395 addressT S, I1, I2, lo, hi; 19396 19397 S = (value >> 24) & 0x01; 19398 I1 = (value >> 23) & 0x01; 19399 I2 = (value >> 22) & 0x01; 19400 hi = (value >> 12) & 0x3ff; 19401 lo = (value >> 1) & 0x7ff; 19402 newval = md_chars_to_number (buf, THUMB_SIZE); 19403 newval2 = md_chars_to_number (buf + THUMB_SIZE, THUMB_SIZE); 19404 newval |= (S << 10) | hi; 19405 newval2 &= ~T2I1I2MASK; 19406 newval2 |= (((I1 ^ S) << 13) | ((I2 ^ S) << 11) | lo) ^ T2I1I2MASK; 19407 md_number_to_chars (buf, newval, THUMB_SIZE); 19408 md_number_to_chars (buf + THUMB_SIZE, newval2, THUMB_SIZE); 19409 } 19410 19384 19411 void 19385 19412 md_apply_fix (fixS * fixP, 19386 19413 valueT * valP, … … 20073 20100 fixP->fx_r_type = BFD_RELOC_THUMB_PCREL_BRANCH23; 20074 20101 #endif 20075 20102 20076 if ((value & ~0x3fffff) && ((value & ~0x3fffff) != ~0x3fffff))20077 as_bad_where (fixP->fx_file, fixP->fx_line,20078 _("branch out of range"));20079 20080 20103 if (fixP->fx_r_type == BFD_RELOC_THUMB_PCREL_BLX) 20081 20104 /* For a BLX instruction, make sure that the relocation is rounded up 20082 20105 to a word boundary. This follows the semantics of the instruction … … 20084 20107 1 of the base address. */ 20085 20108 value = (value + 1) & ~ 1; 20086 20109 20110 if ((value & ~0x3fffff) && ((value & ~0x3fffff) != ~0x3fffff)) 20111 { 20112 if (!(ARM_CPU_HAS_FEATURE (cpu_variant, arm_arch_t2))) 20113 { 20114 as_bad_where (fixP->fx_file, fixP->fx_line, 20115 _("branch out of range")); 20116 } 20117 else if ((value & ~0x1ffffff) 20118 && ((value & ~0x1ffffff) != ~0x1ffffff)) 20119 { 20120 as_bad_where (fixP->fx_file, fixP->fx_line, 20121 _("Thumb2 branch out of range")); 20122 } 20123 } 20124 20125 if (fixP->fx_done || !seg->use_rela_p) 20126 encode_thumb2_b_bl_offset (buf, value); 20127 20087 20128 if (fixP->fx_done || !seg->use_rela_p) 20088 20129 { 20089 20130 offsetT newval2; … … 20104 20145 20105 20146 if (fixP->fx_done || !seg->use_rela_p) 20106 20147 { 20107 offsetT newval2; 20108 addressT S, I1, I2, lo, hi; 20109 20110 S = (value & 0x01000000) >> 24; 20111 I1 = (value & 0x00800000) >> 23; 20112 I2 = (value & 0x00400000) >> 22; 20113 hi = (value & 0x003ff000) >> 12; 20114 lo = (value & 0x00000ffe) >> 1; 20115 20116 I1 = !(I1 ^ S); 20117 I2 = !(I2 ^ S); 20118 20119 newval = md_chars_to_number (buf, THUMB_SIZE); 20120 newval2 = md_chars_to_number (buf + THUMB_SIZE, THUMB_SIZE); 20121 newval |= (S << 10) | hi; 20122 newval2 |= (I1 << 13) | (I2 << 11) | lo; 20123 md_number_to_chars (buf, newval, THUMB_SIZE); 20124 md_number_to_chars (buf + THUMB_SIZE, newval2, THUMB_SIZE); 20148 encode_thumb2_b_bl_offset (buf, value); 20125 20149 } 20126 20150 break; 20127 20151 -
binutils-2.20
diff -Naur binutils-2.20.orig/gas/expr.c binutils-2.20/gas/expr.c
old new 1997 1997 /* Help out with CSE. */ 1998 1998 valueT final_val = expressionP->X_add_number; 1999 1999 symbolS *add_symbol = expressionP->X_add_symbol; 2000 symbolS *orig_add_symbol = add_symbol; 2000 2001 symbolS *op_symbol = expressionP->X_op_symbol; 2001 2002 operatorT op = expressionP->X_op; 2002 2003 valueT left, right; … … 2078 2079 left = right; 2079 2080 seg_left = seg_right; 2080 2081 add_symbol = op_symbol; 2082 orig_add_symbol = expressionP->X_op_symbol; 2081 2083 op = O_symbol; 2082 2084 break; 2083 2085 } … … 2122 2124 { 2123 2125 if (op == O_bit_exclusive_or || op == O_bit_inclusive_or) 2124 2126 { 2125 if ( seg_right != absolute_section || right != 0)2127 if (!(seg_right == absolute_section && right == 0)) 2126 2128 { 2127 2129 seg_left = seg_right; 2128 2130 left = right; 2129 2131 add_symbol = op_symbol; 2132 orig_add_symbol = expressionP->X_op_symbol; 2130 2133 } 2131 2134 op = O_symbol; 2132 2135 break; 2133 2136 } 2134 2137 else if (op == O_left_shift || op == O_right_shift) 2135 2138 { 2136 if ( seg_left != absolute_section || left != 0)2139 if (!(seg_left == absolute_section && left == 0)) 2137 2140 { 2138 2141 op = O_symbol; 2139 2142 break; … … 2149 2152 seg_left = seg_right; 2150 2153 left = right; 2151 2154 add_symbol = op_symbol; 2155 orig_add_symbol = expressionP->X_op_symbol; 2152 2156 op = O_symbol; 2153 2157 break; 2154 2158 } … … 2158 2162 op = O_symbol; 2159 2163 break; 2160 2164 } 2161 else if ( left != right2162 || ((seg_left != reg_section || seg_right != reg_section)2163 && (seg_left != undefined_section2164 || seg_right != undefined_section2165 || add_symbol != op_symbol)))2165 else if (!(left == right 2166 && ((seg_left == reg_section && seg_right == reg_section) 2167 || (seg_left == undefined_section 2168 && seg_right == undefined_section 2169 && add_symbol == op_symbol)))) 2166 2170 return 0; 2167 2171 else if (op == O_bit_and || op == O_bit_inclusive_or) 2168 2172 { … … 2233 2237 op = O_constant; 2234 2238 else if (seg_left == reg_section && final_val == 0) 2235 2239 op = O_register; 2236 else if ( add_symbol != expressionP->X_add_symbol)2240 else if (!symbol_same_p (add_symbol, orig_add_symbol)) 2237 2241 final_val += left; 2238 2242 expressionP->X_add_symbol = add_symbol; 2239 2243 } -
gas/symbols.c
diff -Naur binutils-2.20.orig/gas/symbols.c binutils-2.20/gas/symbols.c
old new 2385 2385 S_CLEAR_WEAKREFR (s); 2386 2386 } 2387 2387 2388 /* Return whether 2 symbols are the same. */ 2389 2390 int 2391 symbol_same_p (symbolS *s1, symbolS *s2) 2392 { 2393 if (s1->bsym == NULL 2394 && local_symbol_converted_p ((struct local_symbol *) s1)) 2395 s1 = local_symbol_get_real_symbol ((struct local_symbol *) s1); 2396 if (s2->bsym == NULL 2397 && local_symbol_converted_p ((struct local_symbol *) s2)) 2398 s2 = local_symbol_get_real_symbol ((struct local_symbol *) s2); 2399 return s1 == s2; 2400 } 2401 2388 2402 /* Return a pointer to the X_add_number component of a symbol. */ 2389 2403 2390 2404 offsetT * -
gas/symbols.h
diff -Naur binutils-2.20.orig/gas/symbols.h binutils-2.20/gas/symbols.h
old new 198 198 extern int symbol_shadow_p (symbolS *); 199 199 extern asymbol *symbol_get_bfdsym (symbolS *); 200 200 extern void symbol_set_bfdsym (symbolS *, asymbol *); 201 extern int symbol_same_p (symbolS *, symbolS *); 201 202 202 203 #ifdef OBJ_SYMFIELD_TYPE 203 204 OBJ_SYMFIELD_TYPE *symbol_get_obj (symbolS *); -
gas/testsuite/ChangeLog
diff -Naur binutils-2.20.orig/gas/testsuite/ChangeLog binutils-2.20/gas/testsuite/ChangeLog
old new 1 2009-12-15 H.J. Lu <hongjiu.lu@intel.com> 2 3 Backport from trunk: 4 2009-12-07 H.J. Lu <hongjiu.lu@intel.com> 5 6 PR gas/11037 7 * gas/i386/intelpic.s: Add testcases. 8 * gas/i386/intelpic.d: Updated. 9 10 2009-10-28 Alan Modra <amodra@bigpond.net.au> 11 12 * gas/i386/intelpic.d: Correct. 13 14 2009-10-08 H.J. Lu <hongjiu.lu@intel.com> 15 16 PR gas/10704 17 * gas/i386/intelpic.s: Add 2 new tests. 18 * gas/i386/intelpic.d: Updated. 19 1 20 2009-10-02 Peter Bergner <bergner@vnet.ibm.com> 2 21 3 22 * gas/ppc/476.s: New test. -
gas/testsuite/gas/i386/intelpic.d
diff -Naur binutils-2.20.orig/gas/testsuite/gas/i386/intelpic.d binutils-2.20/gas/testsuite/gas/i386/intelpic.d
old new 6 6 7 7 Disassembly of section .text: 8 8 9 0+ 000<gs_foo>:10 0: c3 [ ]*ret9 0+ <gs_foo>: 10 [ ]*[a-f0-9]+: c3 ret 11 11 12 0+001 <bar>: 13 1: 8d 83 00 00 00 00 [ ]*lea 0x0\(%ebx\),%eax 14 7: 8b 83 00 00 00 00 [ ]*mov 0x0\(%ebx\),%eax 15 d: 90 [ ]*nop 16 [ ]*... 12 0+1 <bar>: 13 [ ]*[a-f0-9]+: 8d 83 14 00 00 00 lea 0x14\(%ebx\),%eax 14 [ ]*[a-f0-9]+: 8b 83 00 00 00 00 mov 0x0\(%ebx\),%eax 15 [ ]*[a-f0-9]+: ff 24 85 0d 00 00 00 jmp \*0xd\(,%eax,4\) 16 [ ]*[a-f0-9]+: 8d 83 14 00 00 00 lea 0x14\(%ebx\),%eax 17 [ ]*[a-f0-9]+: ff 24 85 0d 10 00 00 jmp \*0x100d\(,%eax,4\) 18 [ ]*[a-f0-9]+: ff 24 85 28 10 00 00 jmp \*0x1028\(,%eax,4\) 19 [ ]*[a-f0-9]+: 90 nop 20 21 0+29 <L11>: 22 [ ]*[a-f0-9]+: ff 24 85 29 10 00 00 jmp \*0x1029\(,%eax,4\) 23 [ ]*[a-f0-9]+: ff 24 85 37 10 00 00 jmp \*0x1037\(,%eax,4\) 24 25 0+37 <L12>: 26 [ ]*[a-f0-9]+: 90 nop 27 #pass -
gas/testsuite/gas/i386/intelpic.s
diff -Naur binutils-2.20.orig/gas/testsuite/gas/i386/intelpic.s binutils-2.20/gas/testsuite/gas/i386/intelpic.s
old new 7 7 bar: 8 8 lea eax, .LC0@GOTOFF[ebx] 9 9 mov eax, DWORD PTR gs_foo@GOT[ebx] 10 nop 11 .p2align 4,0 10 11 .L11: 12 jmp DWORD PTR[ .L11 + eax * 4 ] 13 .LC0: 14 lea eax, DWORD PTR[ .LC0@GOTOFF + ebx ] 15 jmp DWORD PTR[ .L11 + eax * 4 + 0x1000 ] 16 jmp DWORD PTR[ .L12 + eax * 4 + 0x1000 ] 17 .L12: 18 nop 19 L11: 20 jmp DWORD PTR[ L11 + eax * 4 + 0x1000 ] 21 jmp DWORD PTR[ L12 + eax * 4 + 0x1000 ] 22 L12: 23 nop -
binutils-2.20
diff -Naur binutils-2.20.orig/gold/arm.cc binutils-2.20/gold/arm.cc
old new 1075 1075 os = layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS, 1076 1076 (elfcpp::SHF_ALLOC 1077 1077 | elfcpp::SHF_WRITE), 1078 this->got_ );1078 this->got_, false); 1079 1079 os->set_is_relro(); 1080 1080 1081 1081 // The old GNU linker creates a .got.plt section. We just … … 1086 1086 os = layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS, 1087 1087 (elfcpp::SHF_ALLOC 1088 1088 | elfcpp::SHF_WRITE), 1089 this->got_plt_ );1089 this->got_plt_, false); 1090 1090 os->set_is_relro(); 1091 1091 1092 1092 // The first three entries are reserved. … … 1114 1114 gold_assert(layout != NULL); 1115 1115 this->rel_dyn_ = new Reloc_section(parameters->options().combreloc()); 1116 1116 layout->add_output_section_data(".rel.dyn", elfcpp::SHT_REL, 1117 elfcpp::SHF_ALLOC, this->rel_dyn_ );1117 elfcpp::SHF_ALLOC, this->rel_dyn_, true); 1118 1118 } 1119 1119 return this->rel_dyn_; 1120 1120 } … … 1186 1186 { 1187 1187 this->rel_ = new Reloc_section(false); 1188 1188 layout->add_output_section_data(".rel.plt", elfcpp::SHT_REL, 1189 elfcpp::SHF_ALLOC, this->rel_ );1189 elfcpp::SHF_ALLOC, this->rel_, true); 1190 1190 } 1191 1191 1192 1192 template<bool big_endian> … … 1348 1348 layout->add_output_section_data(".plt", elfcpp::SHT_PROGBITS, 1349 1349 (elfcpp::SHF_ALLOC 1350 1350 | elfcpp::SHF_EXECINSTR), 1351 this->plt_ );1351 this->plt_, false); 1352 1352 } 1353 1353 this->plt_->add_entry(gsym); 1354 1354 } … … 1831 1831 Output_data_dynamic* const odyn = layout->dynamic_data(); 1832 1832 if (odyn != NULL) 1833 1833 { 1834 if (this->got_plt_ != NULL) 1834 if (this->got_plt_ != NULL 1835 && this->got_plt_->output_section() != NULL) 1835 1836 odyn->add_section_address(elfcpp::DT_PLTGOT, this->got_plt_); 1836 1837 1837 if (this->plt_ != NULL) 1838 if (this->plt_ != NULL 1839 && this->plt_->output_section() != NULL) 1838 1840 { 1839 1841 const Output_data* od = this->plt_->rel_plt(); 1840 1842 odyn->add_section_size(elfcpp::DT_PLTRELSZ, od); … … 1842 1844 odyn->add_constant(elfcpp::DT_PLTREL, elfcpp::DT_REL); 1843 1845 } 1844 1846 1845 if (this->rel_dyn_ != NULL) 1847 if (this->rel_dyn_ != NULL 1848 && this->rel_dyn_->output_section() != NULL) 1846 1849 { 1847 1850 const Output_data* od = this->rel_dyn_; 1848 1851 odyn->add_section_address(elfcpp::DT_REL, od); … … 1879 1882 == NULL); 1880 1883 Output_segment* exidx_segment = 1881 1884 layout->make_output_segment(elfcpp::PT_ARM_EXIDX, elfcpp::PF_R); 1882 exidx_segment->add_output_section(exidx_section, elfcpp::PF_R); 1885 exidx_segment->add_output_section(exidx_section, elfcpp::PF_R, 1886 false); 1883 1887 } 1884 1888 } 1885 1889 } -
gold/ChangeLog
diff -Naur binutils-2.20.orig/gold/ChangeLog binutils-2.20/gold/ChangeLog
old new 1 2009-11-06 Ian Lance Taylor <iant@google.com> 2 3 Bring over from mainline: 4 2009-10-16 Doug Kwan <dougkwan@google.com> 5 6 * dynobj.cc (Versions::Versions): Initialize version_script_. 7 Only insert base version symbol definition for a shared object 8 if version script defines any version versions. 9 (Versions::define_base_version): New method definition. 10 (Versions::add_def): Check that base version is not needed. 11 (Versions::add_need): Define base version lazily. 12 * dynobj.h (Versions::define_base_version): New method declaration. 13 (Versions::needs_base_version_): New data member declaration. 14 15 2009-11-06 Ian Lance Taylor <iant@google.com> 16 17 PR 10876 18 * defstd.cc (in_segment): Set only_if_ref true for "end". 19 20 2009-11-05 Ian Lance Taylor <iant@google.com> 21 22 PR 10910 23 * output.cc (Output_segment::add_output_section): Add missing 24 return statement. 25 26 2009-11-04 Ian Lance Taylor <iant@google.com> 27 28 PR 10880 29 * object.h (class Object): Add is_needed and set_is_needed 30 methods. Add is_needed_ field. Make bool fields into bitfields. 31 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is 32 defined in a dynamic object and referenced by a regular object, 33 set is_needed for the dynamic object. 34 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED 35 if the file is marked with as_needed and it is not needed. 36 37 2009-11-04 Ian Lance Taylor <iant@google.com> 38 39 PR 10887 40 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic 41 tags if data is discarded by linker script. 42 * i386.cc (Target_i386::do_finalize_sections): Likewise. 43 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise. 44 * sparc.cc (Target_sparc::do_finalize_sections): Likewise. 45 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise. 46 47 2009-11-04 Ian Lance Taylor <iant@google.com> 48 49 * layout.cc (Layout::get_output_section): Add is_interp and 50 is_dynamic_linker_section parameters. Change all callers. 51 (Layout::choose_output_section): Likewise. 52 (Layout::make_output_section): Likewise. 53 (Layout::add_output_section_data): Add is_dynamic_linker_section 54 parameter. Change all callers. 55 * layout.h (class Layout): Update declarations. 56 * output.h (class Output_section): Add is_interp, set_is_interp, 57 is_dynamic_linker_section, set_is_dynamic_linker_section methods. 58 Add is_interp_, is_dynamic_linker_section_ fields. Change 59 generate_code_fills_at_write_ to a bitfield. 60 * output.cc (Output_section::Output_sections): Initialize new 61 fields. 62 (Output_segment::add_output_section): Add do_sort parameter. 63 Change all callers. 64 65 2009-11-03 Ian Lance Taylor <iant@google.com> 66 67 PR 10860 68 * options.h (class General_options): Add --warn-common. 69 * resolve.cc (Symbol_table::resolve): Handle --warn-common when 70 merging two common symbols. 71 (Symbol_table::should_override): Handle --warn-common when merging 72 a common symbol with a defined symbol. Use report_resolve_problem 73 for multiple definitions. 74 (Symbol_table::report_resolve_problem): New function. 75 * symtab.h (class Symbol_table): Declare report_resolve_problem. 76 77 2009-11-03 Ian Lance Taylor <iant@google.com> 78 79 PR 10893 80 * defstd.cc (in_section): Add entries for __rel_iplt_start, 81 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack. 82 83 2009-11-03 Ian Lance Taylor <iant@google.com> 84 85 PR 10895 86 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and 87 --msgid-bugs-address. 88 (install-pdf): New target. 89 (install-data_yes): Look up one directory to find mkinstalldirs. 90 91 2009-10-16 Doug Kwan <dougkwan@google.com> 92 93 * output.cc (Output_segment::set_section_list_address): Cast 94 expressions to unsigned long long type to avoid format warnings. 95 1 96 2009-10-15 Ian Lance Taylor <iant@google.com> 2 97 3 98 * script.cc (Script_options::add_symbol_assignment): Always add a -
gold/common.cc
diff -Naur binutils-2.20.orig/gold/common.cc binutils-2.20/gold/common.cc
old new 239 239 Output_data_space *poc = new Output_data_space(addralign, ds_name); 240 240 Output_section *os = layout->add_output_section_data(name, 241 241 elfcpp::SHT_NOBITS, 242 flags, poc );242 flags, poc, false); 243 243 if (os != NULL) 244 244 { 245 245 if (commons_section_type == COMMONS_SMALL) -
gold/copy-relocs.cc
diff -Naur binutils-2.20.orig/gold/copy-relocs.cc binutils-2.20/gold/copy-relocs.cc
old new 138 138 layout->add_output_section_data(".bss", 139 139 elfcpp::SHT_NOBITS, 140 140 elfcpp::SHF_ALLOC | elfcpp::SHF_WRITE, 141 this->dynbss_ );141 this->dynbss_, false); 142 142 } 143 143 144 144 Output_data_space* dynbss = this->dynbss_; -
gold/defstd.cc
diff -Naur binutils-2.20.orig/gold/defstd.cc binutils-2.20/gold/defstd.cc
old new 107 107 0, // nonvis 108 108 true, // offset_is_from_end 109 109 true // only_if_ref 110 } 110 }, 111 { 112 "__rel_iplt_start", // name 113 ".rel.iplt", // output_section 114 0, // value 115 0, // size 116 elfcpp::STT_NOTYPE, // type 117 elfcpp::STB_GLOBAL, // binding 118 elfcpp::STV_HIDDEN, // visibility 119 0, // nonvis 120 false, // offset_is_from_end 121 true // only_if_ref 122 }, 123 { 124 "__rel_iplt_end", // name 125 ".rel.iplt", // output_section 126 0, // value 127 0, // size 128 elfcpp::STT_NOTYPE, // type 129 elfcpp::STB_GLOBAL, // binding 130 elfcpp::STV_HIDDEN, // visibility 131 0, // nonvis 132 true, // offset_is_from_end 133 true // only_if_ref 134 }, 135 { 136 "__rela_iplt_start", // name 137 ".rela.iplt", // output_section 138 0, // value 139 0, // size 140 elfcpp::STT_NOTYPE, // type 141 elfcpp::STB_GLOBAL, // binding 142 elfcpp::STV_HIDDEN, // visibility 143 0, // nonvis 144 false, // offset_is_from_end 145 true // only_if_ref 146 }, 147 { 148 "__rela_iplt_end", // name 149 ".rela.iplt", // output_section 150 0, // value 151 0, // size 152 elfcpp::STT_NOTYPE, // type 153 elfcpp::STB_GLOBAL, // binding 154 elfcpp::STV_HIDDEN, // visibility 155 0, // nonvis 156 true, // offset_is_from_end 157 true // only_if_ref 158 }, 159 { 160 "__stack", // name 161 ".stack", // output_section 162 0, // value 163 0, // size 164 elfcpp::STT_NOTYPE, // type 165 elfcpp::STB_GLOBAL, // binding 166 elfcpp::STV_DEFAULT, // visibility 167 0, // nonvis 168 false, // offset_is_from_end 169 true // only_if_ref 170 }, 111 171 }; 112 172 113 173 const int in_section_count = sizeof in_section / sizeof in_section[0]; … … 238 298 elfcpp::STV_DEFAULT, // visibility 239 299 0, // nonvis 240 300 Symbol::SEGMENT_END, // offset_from_base 241 false // only_if_ref301 true // only_if_ref 242 302 } 243 303 }; 244 304 -
gold/dynobj.cc
diff -Naur binutils-2.20.orig/gold/dynobj.cc binutils-2.20/gold/dynobj.cc
old new 1300 1300 Versions::Versions(const Version_script_info& version_script, 1301 1301 Stringpool* dynpool) 1302 1302 : defs_(), needs_(), version_table_(), 1303 is_finalized_(false), version_script_(version_script) 1303 is_finalized_(false), version_script_(version_script), 1304 needs_base_version_(parameters->options().shared()) 1304 1305 { 1305 // We always need a base version, so define that first. Nothing1306 // explicitly declares itself as part of base, so it doesn't need to1307 // be in version_table_.1308 if (parameters->options().shared())1309 {1310 const char* name = parameters->options().soname();1311 if (name == NULL)1312 name = parameters->options().output_file_name();1313 name = dynpool->add(name, false, NULL);1314 Verdef* vdbase = new Verdef(name, std::vector<std::string>(),1315 true, false, true);1316 this->defs_.push_back(vdbase);1317 }1318 1319 1306 if (!this->version_script_.empty()) 1320 1307 { 1321 1308 // Parse the version script, and insert each declared version into 1322 1309 // defs_ and version_table_. 1323 1310 std::vector<std::string> versions = this->version_script_.get_versions(); 1311 1312 if (this->needs_base_version_ && !versions.empty()) 1313 this->define_base_version(dynpool); 1314 1324 1315 for (size_t k = 0; k < versions.size(); ++k) 1325 1316 { 1326 1317 Stringpool::Key version_key; … … 1350 1341 delete *p; 1351 1342 } 1352 1343 1344 // Define the base version of a shared library. The base version definition 1345 // must be the first entry in defs_. We insert it lazily so that defs_ is 1346 // empty if no symbol versioning is used. Then layout can just drop the 1347 // version sections. 1348 1349 void 1350 Versions::define_base_version(Stringpool* dynpool) 1351 { 1352 // If we do any versioning at all, we always need a base version, so 1353 // define that first. Nothing explicitly declares itself as part of base, 1354 // so it doesn't need to be in version_table_. 1355 gold_assert(this->defs_.empty()); 1356 const char* name = parameters->options().soname(); 1357 if (name == NULL) 1358 name = parameters->options().output_file_name(); 1359 name = dynpool->add(name, false, NULL); 1360 Verdef* vdbase = new Verdef(name, std::vector<std::string>(), 1361 true, false, true); 1362 this->defs_.push_back(vdbase); 1363 this->needs_base_version_ = false; 1364 } 1365 1353 1366 // Return the dynamic object which a symbol refers to. 1354 1367 1355 1368 Dynobj* … … 1421 1434 if (parameters->options().shared()) 1422 1435 gold_error(_("symbol %s has undefined version %s"), 1423 1436 sym->demangled_name().c_str(), version); 1424 1437 else 1438 // We only insert a base version for shared library. 1439 gold_assert(!this->needs_base_version_); 1440 1425 1441 // When creating a regular executable, automatically define 1426 1442 // a new version. 1427 1443 Verdef* vd = new Verdef(version, std::vector<std::string>(), … … 1468 1484 1469 1485 if (vn == NULL) 1470 1486 { 1487 // Create base version definition lazily for shared library. 1488 if (this->needs_base_version_) 1489 this->define_base_version(dynpool); 1490 1471 1491 // We have a new filename. 1472 1492 vn = new Verneed(filename); 1473 1493 this->needs_.push_back(vn); -
gold/dynobj.h
diff -Naur binutils-2.20.orig/gold/dynobj.h binutils-2.20/gold/dynobj.h
old new 584 584 version_index(const Symbol_table*, const Stringpool*, 585 585 const Symbol* sym) const; 586 586 587 // Define the base version of a shared library. 588 void 589 define_base_version(Stringpool* dynpool); 590 587 591 // We keep a hash table mapping canonicalized name/version pairs to 588 592 // a version base. 589 593 typedef std::pair<Stringpool::Key, Stringpool::Key> Key; … … 616 620 bool is_finalized_; 617 621 // Contents of --version-script, if passed, or NULL. 618 622 const Version_script_info& version_script_; 623 // Whether we need to insert a base version. This is only used for 624 // shared libaries and is cleared when the base version is defined. 625 bool needs_base_version_; 619 626 }; 620 627 621 628 } // End namespace gold. -
gold/i386.cc
diff -Naur binutils-2.20.orig/gold/i386.cc binutils-2.20/gold/i386.cc
old new 464 464 os = layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS, 465 465 (elfcpp::SHF_ALLOC 466 466 | elfcpp::SHF_WRITE), 467 this->got_ );467 this->got_, false); 468 468 os->set_is_relro(); 469 469 470 470 // The old GNU linker creates a .got.plt section. We just … … 475 475 os = layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS, 476 476 (elfcpp::SHF_ALLOC 477 477 | elfcpp::SHF_WRITE), 478 this->got_plt_ );478 this->got_plt_, false); 479 479 os->set_is_relro(); 480 480 481 481 // The first three entries are reserved. … … 503 503 gold_assert(layout != NULL); 504 504 this->rel_dyn_ = new Reloc_section(parameters->options().combreloc()); 505 505 layout->add_output_section_data(".rel.dyn", elfcpp::SHT_REL, 506 elfcpp::SHF_ALLOC, this->rel_dyn_ );506 elfcpp::SHF_ALLOC, this->rel_dyn_, true); 507 507 } 508 508 return this->rel_dyn_; 509 509 } … … 578 578 { 579 579 this->rel_ = new Reloc_section(false); 580 580 layout->add_output_section_data(".rel.plt", elfcpp::SHT_REL, 581 elfcpp::SHF_ALLOC, this->rel_ );581 elfcpp::SHF_ALLOC, this->rel_, true); 582 582 } 583 583 584 584 void … … 763 763 layout->add_output_section_data(".plt", elfcpp::SHT_PROGBITS, 764 764 (elfcpp::SHF_ALLOC 765 765 | elfcpp::SHF_EXECINSTR), 766 this->plt_ );766 this->plt_, false); 767 767 } 768 768 769 769 this->plt_->add_entry(gsym); … … 1569 1569 Output_data_dynamic* const odyn = layout->dynamic_data(); 1570 1570 if (odyn != NULL) 1571 1571 { 1572 if (this->got_plt_ != NULL) 1572 if (this->got_plt_ != NULL 1573 && this->got_plt_->output_section() != NULL) 1573 1574 odyn->add_section_address(elfcpp::DT_PLTGOT, this->got_plt_); 1574 1575 1575 if (this->plt_ != NULL) 1576 if (this->plt_ != NULL 1577 && this->plt_->output_section() != NULL) 1576 1578 { 1577 1579 const Output_data* od = this->plt_->rel_plt(); 1578 1580 odyn->add_section_size(elfcpp::DT_PLTRELSZ, od); … … 1580 1582 odyn->add_constant(elfcpp::DT_PLTREL, elfcpp::DT_REL); 1581 1583 } 1582 1584 1583 if (this->rel_dyn_ != NULL) 1585 if (this->rel_dyn_ != NULL 1586 && this->rel_dyn_->output_section() != NULL) 1584 1587 { 1585 1588 const Output_data* od = this->rel_dyn_; 1586 1589 odyn->add_section_address(elfcpp::DT_REL, od); -
gold/layout.cc
diff -Naur binutils-2.20.orig/gold/layout.cc binutils-2.20/gold/layout.cc
old new 388 388 389 389 // Return the output section to use for section NAME with type TYPE 390 390 // and section flags FLAGS. NAME must be canonicalized in the string 391 // pool, and NAME_KEY is the key. 391 // pool, and NAME_KEY is the key. IS_INTERP is true if this is the 392 // .interp section. IS_DYNAMIC_LINKER_SECTION is true if this section 393 // is used by the dynamic linker. 392 394 393 395 Output_section* 394 396 Layout::get_output_section(const char* name, Stringpool::Key name_key, 395 elfcpp::Elf_Word type, elfcpp::Elf_Xword flags) 397 elfcpp::Elf_Word type, elfcpp::Elf_Xword flags, 398 bool is_interp, bool is_dynamic_linker_section) 396 399 { 397 400 elfcpp::Elf_Xword lookup_flags = flags; 398 401 … … 441 444 } 442 445 443 446 if (os == NULL) 444 os = this->make_output_section(name, type, flags); 447 os = this->make_output_section(name, type, flags, is_interp, 448 is_dynamic_linker_section); 445 449 ins.first->second = os; 446 450 return os; 447 451 } … … 451 455 // RELOBJ, with type TYPE and flags FLAGS. RELOBJ may be NULL for a 452 456 // linker created section. IS_INPUT_SECTION is true if we are 453 457 // choosing an output section for an input section found in a input 454 // file. This will return NULL if the input section should be 455 // discarded. 458 // file. IS_INTERP is true if this is the .interp section. 459 // IS_DYNAMIC_LINKER_SECTION is true if this section is used by the 460 // dynamic linker. This will return NULL if the input section should 461 // be discarded. 456 462 457 463 Output_section* 458 464 Layout::choose_output_section(const Relobj* relobj, const char* name, 459 465 elfcpp::Elf_Word type, elfcpp::Elf_Xword flags, 460 bool is_input_section) 466 bool is_input_section, bool is_interp, 467 bool is_dynamic_linker_section) 461 468 { 462 469 // We should not see any input sections after we have attached 463 470 // sections to segments. … … 505 512 506 513 name = this->namepool_.add(name, false, NULL); 507 514 508 Output_section* os = this->make_output_section(name, type, flags); 515 Output_section* os = 516 this->make_output_section(name, type, flags, is_interp, 517 is_dynamic_linker_section); 509 518 os->set_found_in_sections_clause(); 510 519 *output_section_slot = os; 511 520 return os; … … 528 537 529 538 // Find or make the output section. The output section is selected 530 539 // based on the section name, type, and flags. 531 return this->get_output_section(name, name_key, type, flags); 540 return this->get_output_section(name, name_key, type, flags, is_interp, 541 is_dynamic_linker_section); 532 542 } 533 543 534 544 // Return the output section to use for input section SHNDX, with name … … 561 571 { 562 572 name = this->namepool_.add(name, true, NULL); 563 573 os = this->make_output_section(name, shdr.get_sh_type(), 564 shdr.get_sh_flags() );574 shdr.get_sh_flags(), false, false); 565 575 } 566 576 else 567 577 { 568 578 os = this->choose_output_section(object, name, shdr.get_sh_type(), 569 shdr.get_sh_flags(), true); 579 shdr.get_sh_flags(), true, false, 580 false); 570 581 if (os == NULL) 571 582 return NULL; 572 583 } … … 617 628 Output_section* os = this->choose_output_section(object, name.c_str(), 618 629 sh_type, 619 630 shdr.get_sh_flags(), 620 false );631 false, false, false); 621 632 622 633 os->set_should_link_to_symtab(); 623 634 os->set_info_section(data_section); … … 664 675 group_section_name = this->namepool_.add(group_section_name, true, NULL); 665 676 Output_section* os = this->make_output_section(group_section_name, 666 677 elfcpp::SHT_GROUP, 667 shdr.get_sh_flags()); 678 shdr.get_sh_flags(), 679 false, false); 668 680 669 681 // We need to find a symbol with the signature in the symbol table. 670 682 // If we don't find one now, we need to look again later. … … 718 730 name, 719 731 elfcpp::SHT_PROGBITS, 720 732 elfcpp::SHF_ALLOC, 721 false );733 false, false, false); 722 734 if (os == NULL) 723 735 return NULL; 724 736 … … 734 746 ".eh_frame_hdr", 735 747 elfcpp::SHT_PROGBITS, 736 748 elfcpp::SHF_ALLOC, 737 false );749 false, false, false); 738 750 739 751 if (hdr_os != NULL) 740 752 { … … 749 761 Output_segment* hdr_oseg; 750 762 hdr_oseg = this->make_output_segment(elfcpp::PT_GNU_EH_FRAME, 751 763 elfcpp::PF_R); 752 hdr_oseg->add_output_section(hdr_os, elfcpp::PF_R );764 hdr_oseg->add_output_section(hdr_os, elfcpp::PF_R, false); 753 765 } 754 766 755 767 this->eh_frame_data_->set_eh_frame_hdr(hdr_posd); … … 800 812 Output_section* 801 813 Layout::add_output_section_data(const char* name, elfcpp::Elf_Word type, 802 814 elfcpp::Elf_Xword flags, 803 Output_section_data* posd) 815 Output_section_data* posd, 816 bool is_dynamic_linker_section) 804 817 { 805 818 Output_section* os = this->choose_output_section(NULL, name, type, flags, 806 false); 819 false, false, 820 is_dynamic_linker_section); 807 821 if (os != NULL) 808 822 os->add_output_section_data(posd); 809 823 return os; … … 838 852 } 839 853 840 854 // Make a new Output_section, and attach it to segments as 841 // appropriate. 855 // appropriate. IS_INTERP is true if this is the .interp section. 856 // IS_DYNAMIC_LINKER_SECTION is true if this section is used by the 857 // dynamic linker. 842 858 843 859 Output_section* 844 860 Layout::make_output_section(const char* name, elfcpp::Elf_Word type, 845 elfcpp::Elf_Xword flags) 861 elfcpp::Elf_Xword flags, bool is_interp, 862 bool is_dynamic_linker_section) 846 863 { 847 864 Output_section* os; 848 865 if ((flags & elfcpp::SHF_ALLOC) == 0 … … 850 867 && is_compressible_debug_section(name)) 851 868 os = new Output_compressed_section(¶meters->options(), name, type, 852 869 flags); 853 854 870 else if ((flags & elfcpp::SHF_ALLOC) == 0 855 871 && parameters->options().strip_debug_non_line() 856 872 && strcmp(".debug_abbrev", name) == 0) … … 876 892 os = target->make_output_section(name, type, flags); 877 893 } 878 894 895 if (is_interp) 896 os->set_is_interp(); 897 if (is_dynamic_linker_section) 898 os->set_is_dynamic_linker_section(); 899 879 900 parameters->target().new_output_section(os); 880 901 881 902 this->section_list_.push_back(os); … … 971 992 972 993 elfcpp::Elf_Word seg_flags = Layout::section_flags_to_segment(flags); 973 994 995 bool sort_sections = !this->script_options_->saw_sections_clause(); 996 974 997 // In general the only thing we really care about for PT_LOAD 975 998 // segments is whether or not they are writable, so that is how we 976 999 // search for them. Large data sections also go into their own … … 998 1021 if (os->is_large_data_section() && !(*p)->is_large_data_segment()) 999 1022 continue; 1000 1023 1001 (*p)->add_output_section(os, seg_flags );1024 (*p)->add_output_section(os, seg_flags, sort_sections); 1002 1025 break; 1003 1026 } 1004 1027 … … 1008 1031 seg_flags); 1009 1032 if (os->is_large_data_section()) 1010 1033 oseg->set_is_large_data_segment(); 1011 oseg->add_output_section(os, seg_flags );1034 oseg->add_output_section(os, seg_flags, sort_sections); 1012 1035 } 1013 1036 1014 1037 // If we see a loadable SHT_NOTE section, we create a PT_NOTE … … 1024 1047 && (((*p)->flags() & elfcpp::PF_W) 1025 1048 == (seg_flags & elfcpp::PF_W))) 1026 1049 { 1027 (*p)->add_output_section(os, seg_flags );1050 (*p)->add_output_section(os, seg_flags, false); 1028 1051 break; 1029 1052 } 1030 1053 } … … 1033 1056 { 1034 1057 Output_segment* oseg = this->make_output_segment(elfcpp::PT_NOTE, 1035 1058 seg_flags); 1036 oseg->add_output_section(os, seg_flags );1059 oseg->add_output_section(os, seg_flags, false); 1037 1060 } 1038 1061 } 1039 1062 … … 1043 1066 { 1044 1067 if (this->tls_segment_ == NULL) 1045 1068 this->make_output_segment(elfcpp::PT_TLS, seg_flags); 1046 this->tls_segment_->add_output_section(os, seg_flags );1069 this->tls_segment_->add_output_section(os, seg_flags, false); 1047 1070 } 1048 1071 1049 1072 // If -z relro is in effect, and we see a relro section, we create a … … 1053 1076 gold_assert(seg_flags == (elfcpp::PF_R | elfcpp::PF_W)); 1054 1077 if (this->relro_segment_ == NULL) 1055 1078 this->make_output_segment(elfcpp::PT_GNU_RELRO, seg_flags); 1056 this->relro_segment_->add_output_section(os, seg_flags );1079 this->relro_segment_->add_output_section(os, seg_flags, false); 1057 1080 } 1058 1081 } 1059 1082 … … 1064 1087 { 1065 1088 name = this->namepool_.add(name, false, NULL); 1066 1089 Output_section* os = this->make_output_section(name, elfcpp::SHT_PROGBITS, 1067 elfcpp::SHF_ALLOC); 1090 elfcpp::SHF_ALLOC, false, 1091 false); 1068 1092 os->set_found_in_sections_clause(); 1069 1093 return os; 1070 1094 } … … 1134 1158 elfcpp::SHT_DYNAMIC, 1135 1159 (elfcpp::SHF_ALLOC 1136 1160 | elfcpp::SHF_WRITE), 1137 false );1161 false, false, true); 1138 1162 this->dynamic_section_->set_is_relro(); 1139 1163 1140 1164 symtab->define_in_output_data("_DYNAMIC", NULL, this->dynamic_section_, 0, 0, … … 1732 1756 flags = elfcpp::SHF_ALLOC; 1733 1757 Output_section* os = this->choose_output_section(NULL, section_name, 1734 1758 elfcpp::SHT_NOTE, 1735 flags, false); 1759 flags, false, false, 1760 false); 1736 1761 if (os == NULL) 1737 1762 return NULL; 1738 1763 … … 1811 1836 elfcpp::Elf_Xword flags = 0; 1812 1837 if (is_stack_executable) 1813 1838 flags |= elfcpp::SHF_EXECINSTR; 1814 this->make_output_section(name, elfcpp::SHT_PROGBITS, flags); 1839 this->make_output_section(name, elfcpp::SHT_PROGBITS, flags, false, 1840 false); 1815 1841 } 1816 1842 else 1817 1843 { … … 1971 1997 this->namepool_.add(".gnu_incremental_inputs", false, NULL); 1972 1998 Output_section* inputs_os = 1973 1999 this->make_output_section(incremental_inputs_name, 1974 elfcpp::SHT_GNU_INCREMENTAL_INPUTS, 0); 2000 elfcpp::SHT_GNU_INCREMENTAL_INPUTS, 0, 2001 false, false); 1975 2002 Output_section_data* posd = 1976 2003 this->incremental_inputs_->create_incremental_inputs_section_data(); 1977 2004 inputs_os->add_output_section_data(posd); … … 1981 2008 this->namepool_.add(".gnu_incremental_strtab", false, NULL); 1982 2009 Output_section* strtab_os = this->make_output_section(incremental_strtab_name, 1983 2010 elfcpp::SHT_STRTAB, 1984 0 );2011 0, false, false); 1985 2012 Output_data_strtab* strtab_data = 1986 2013 new Output_data_strtab(this->incremental_inputs_->get_stringpool()); 1987 2014 strtab_os->add_output_section_data(strtab_data); … … 2593 2620 const char* symtab_name = this->namepool_.add(".symtab", false, NULL); 2594 2621 Output_section* osymtab = this->make_output_section(symtab_name, 2595 2622 elfcpp::SHT_SYMTAB, 2596 0 );2623 0, false, false); 2597 2624 this->symtab_section_ = osymtab; 2598 2625 2599 2626 Output_section_data* pos = new Output_data_fixed_space(off - startoff, … … 2614 2641 false, NULL); 2615 2642 Output_section* osymtab_xindex = 2616 2643 this->make_output_section(symtab_xindex_name, 2617 elfcpp::SHT_SYMTAB_SHNDX, 0); 2644 elfcpp::SHT_SYMTAB_SHNDX, 0, false, 2645 false); 2618 2646 2619 2647 size_t symcount = (off - startoff) / symsize; 2620 2648 this->symtab_xindex_ = new Output_symtab_xindex(symcount); … … 2636 2664 const char* strtab_name = this->namepool_.add(".strtab", false, NULL); 2637 2665 Output_section* ostrtab = this->make_output_section(strtab_name, 2638 2666 elfcpp::SHT_STRTAB, 2639 0 );2667 0, false, false); 2640 2668 2641 2669 Output_section_data* pstr = new Output_data_strtab(&this->sympool_); 2642 2670 ostrtab->add_output_section_data(pstr); … … 2663 2691 2664 2692 const char* name = this->namepool_.add(".shstrtab", false, NULL); 2665 2693 2666 Output_section* os = this->make_output_section(name, elfcpp::SHT_STRTAB, 0); 2694 Output_section* os = this->make_output_section(name, elfcpp::SHT_STRTAB, 0, 2695 false, false); 2667 2696 2668 2697 // We can't write out this section until we've set all the section 2669 2698 // names, and we don't set the names of compressed output sections … … 2776 2805 Output_section* dynsym = this->choose_output_section(NULL, ".dynsym", 2777 2806 elfcpp::SHT_DYNSYM, 2778 2807 elfcpp::SHF_ALLOC, 2779 false );2808 false, false, true); 2780 2809 2781 2810 Output_section_data* odata = new Output_data_fixed_space(index * symsize, 2782 2811 align, … … 2806 2835 this->choose_output_section(NULL, ".dynsym_shndx", 2807 2836 elfcpp::SHT_SYMTAB_SHNDX, 2808 2837 elfcpp::SHF_ALLOC, 2809 false );2838 false, false, true); 2810 2839 2811 2840 this->dynsym_xindex_ = new Output_symtab_xindex(index); 2812 2841 … … 2829 2858 Output_section* dynstr = this->choose_output_section(NULL, ".dynstr", 2830 2859 elfcpp::SHT_STRTAB, 2831 2860 elfcpp::SHF_ALLOC, 2832 false );2861 false, false, true); 2833 2862 2834 2863 Output_section_data* strdata = new Output_data_strtab(&this->dynpool_); 2835 2864 dynstr->add_output_section_data(strdata); … … 2855 2884 Output_section* hashsec = this->choose_output_section(NULL, ".hash", 2856 2885 elfcpp::SHT_HASH, 2857 2886 elfcpp::SHF_ALLOC, 2858 false );2887 false, false, true); 2859 2888 2860 2889 Output_section_data* hashdata = new Output_data_const_buffer(phash, 2861 2890 hashlen, … … 2880 2909 Output_section* hashsec = this->choose_output_section(NULL, ".gnu.hash", 2881 2910 elfcpp::SHT_GNU_HASH, 2882 2911 elfcpp::SHF_ALLOC, 2883 false );2912 false, false, true); 2884 2913 2885 2914 Output_section_data* hashdata = new Output_data_const_buffer(phash, 2886 2915 hashlen, … … 2978 3007 Output_section* vsec = this->choose_output_section(NULL, ".gnu.version", 2979 3008 elfcpp::SHT_GNU_versym, 2980 3009 elfcpp::SHF_ALLOC, 2981 false );3010 false, false, true); 2982 3011 2983 3012 unsigned char* vbuf; 2984 3013 unsigned int vsize; … … 3003 3032 vdsec= this->choose_output_section(NULL, ".gnu.version_d", 3004 3033 elfcpp::SHT_GNU_verdef, 3005 3034 elfcpp::SHF_ALLOC, 3006 false );3035 false, false, true); 3007 3036 3008 3037 unsigned char* vdbuf; 3009 3038 unsigned int vdsize; … … 3028 3057 vnsec = this->choose_output_section(NULL, ".gnu.version_r", 3029 3058 elfcpp::SHT_GNU_verneed, 3030 3059 elfcpp::SHF_ALLOC, 3031 false );3060 false, false, true); 3032 3061 3033 3062 unsigned char* vnbuf; 3034 3063 unsigned int vnsize; … … 3068 3097 Output_section* osec = this->choose_output_section(NULL, ".interp", 3069 3098 elfcpp::SHT_PROGBITS, 3070 3099 elfcpp::SHF_ALLOC, 3071 false );3100 false, true, true); 3072 3101 osec->add_output_section_data(odata); 3073 3102 3074 3103 if (!this->script_options_->saw_phdrs_clause()) 3075 3104 { 3076 3105 Output_segment* oseg = this->make_output_segment(elfcpp::PT_INTERP, 3077 3106 elfcpp::PF_R); 3078 oseg->add_output_section(osec, elfcpp::PF_R );3107 oseg->add_output_section(osec, elfcpp::PF_R, false); 3079 3108 } 3080 3109 } 3081 3110 … … 3091 3120 (elfcpp::PF_R 3092 3121 | elfcpp::PF_W)); 3093 3122 oseg->add_output_section(this->dynamic_section_, 3094 elfcpp::PF_R | elfcpp::PF_W); 3123 elfcpp::PF_R | elfcpp::PF_W, 3124 false); 3095 3125 } 3096 3126 3097 3127 Output_data_dynamic* const odyn = this->dynamic_data_; … … 3100 3130 p != input_objects->dynobj_end(); 3101 3131 ++p) 3102 3132 { 3103 // FIXME: Handle --as-needed. 3133 if (!(*p)->is_needed() 3134 && (*p)->input_file()->options().as_needed()) 3135 { 3136 // This dynamic object was linked with --as-needed, but it 3137 // is not needed. 3138 continue; 3139 } 3140 3104 3141 odyn->add_string(elfcpp::DT_NEEDED, (*p)->soname()); 3105 3142 } 3106 3143 -
gold/layout.h
diff -Naur binutils-2.20.orig/gold/layout.h binutils-2.20/gold/layout.h
old new 360 360 layout_gnu_stack(bool seen_gnu_stack, uint64_t gnu_stack_flags); 361 361 362 362 // Add an Output_section_data to the layout. This is used for 363 // special sections like the GOT section. 363 // special sections like the GOT section. IS_DYNAMIC_LINKER_SECTION 364 // is true for sections which are used by the dynamic linker, such 365 // as dynamic reloc sections. 364 366 Output_section* 365 367 add_output_section_data(const char* name, elfcpp::Elf_Word type, 366 368 elfcpp::Elf_Xword flags, 367 Output_section_data* );369 Output_section_data*, bool is_dynamic_linker_section); 368 370 369 371 // Create dynamic sections if necessary. 370 372 void … … 745 747 // Return the output section for NAME, TYPE and FLAGS. 746 748 Output_section* 747 749 get_output_section(const char* name, Stringpool::Key name_key, 748 elfcpp::Elf_Word type, elfcpp::Elf_Xword flags); 750 elfcpp::Elf_Word type, elfcpp::Elf_Xword flags, 751 bool is_interp, bool is_dynamic_linker_section); 749 752 750 753 // Choose the output section for NAME in RELOBJ. 751 754 Output_section* 752 755 choose_output_section(const Relobj* relobj, const char* name, 753 756 elfcpp::Elf_Word type, elfcpp::Elf_Xword flags, 754 bool is_input_section); 757 bool is_input_section, bool is_interp, 758 bool is_dynamic_linker_section); 755 759 756 760 // Create a new Output_section. 757 761 Output_section* 758 762 make_output_section(const char* name, elfcpp::Elf_Word type, 759 elfcpp::Elf_Xword flags); 763 elfcpp::Elf_Xword flags, bool is_interp, 764 bool is_dynamic_linker_section); 760 765 761 766 // Attach a section to a segment. 762 767 void -
gold/object.h
diff -Naur binutils-2.20.orig/gold/object.h binutils-2.20/gold/object.h
old new 195 195 Object(const std::string& name, Input_file* input_file, bool is_dynamic, 196 196 off_t offset = 0) 197 197 : name_(name), input_file_(input_file), offset_(offset), shnum_(-1U), 198 is_dynamic_(is_dynamic), uses_split_stack_(false),199 has_no_split_stack_(false), xindex_(NULL), no_export_(false)198 is_dynamic_(is_dynamic), is_needed_(false), uses_split_stack_(false), 199 has_no_split_stack_(false), no_export_(false), xindex_(NULL) 200 200 { input_file->file().add_object(); } 201 201 202 202 virtual ~Object() … … 217 217 is_dynamic() const 218 218 { return this->is_dynamic_; } 219 219 220 // Return whether this object is needed--true if it is a dynamic 221 // object which defines some symbol referenced by a regular object. 222 // We keep the flag here rather than in Dynobj for convenience when 223 // setting it. 224 bool 225 is_needed() const 226 { return this->is_needed_; } 227 228 // Record that this object is needed. 229 void 230 set_is_needed() 231 { this->is_needed_ = true; } 232 220 233 // Return whether this object was compiled with -fsplit-stack. 221 234 bool 222 235 uses_split_stack() const … … 589 602 // Number of input sections. 590 603 unsigned int shnum_; 591 604 // Whether this is a dynamic object. 592 bool is_dynamic_; 605 bool is_dynamic_ : 1; 606 // Whether this object is needed. This is only set for dynamic 607 // objects, and means that the object defined a symbol which was 608 // used by a reference from a regular object. 609 bool is_needed_ : 1; 593 610 // Whether this object was compiled with -fsplit-stack. 594 bool uses_split_stack_ ;611 bool uses_split_stack_ : 1; 595 612 // Whether this object contains any functions compiled with the 596 613 // no_split_stack attribute. 597 bool has_no_split_stack_; 598 // Many sections for objects with more than SHN_LORESERVE sections. 599 Xindex* xindex_; 614 bool has_no_split_stack_ : 1; 600 615 // True if exclude this object from automatic symbol export. 601 616 // This is used only for archive objects. 602 bool no_export_; 617 bool no_export_ : 1; 618 // Many sections for objects with more than SHN_LORESERVE sections. 619 Xindex* xindex_; 603 620 }; 604 621 605 622 // A regular object (ET_REL). This is an abstract base class itself. -
gold/options.h
diff -Naur binutils-2.20.orig/gold/options.h binutils-2.20/gold/options.h
old new 912 912 DEFINE_special(version_script, options::TWO_DASHES, '\0', 913 913 N_("Read version script"), N_("FILE")); 914 914 915 DEFINE_bool(warn_common, options::TWO_DASHES, '\0', false, 916 N_("Warn about duplicate common symbols"), 917 N_("Do not warn about duplicate common symbols (default)")); 918 915 919 DEFINE_bool(warn_search_mismatch, options::TWO_DASHES, '\0', true, 916 920 N_("Warn when skipping an incompatible library"), 917 921 N_("Don't warn when skipping an incompatible library")); -
gold/output.cc
diff -Naur binutils-2.20.orig/gold/output.cc binutils-2.20/gold/output.cc
old new 1800 1800 is_relro_local_(false), 1801 1801 is_small_section_(false), 1802 1802 is_large_section_(false), 1803 is_interp_(false), 1804 is_dynamic_linker_section_(false), 1805 generate_code_fills_at_write_(false), 1803 1806 tls_offset_(0), 1804 1807 checkpoint_(NULL), 1805 1808 merge_section_map_(), 1806 1809 merge_section_by_properties_map_(), 1807 1810 relaxed_input_section_map_(), 1808 is_relaxed_input_section_map_valid_(true), 1809 generate_code_fills_at_write_(false) 1811 is_relaxed_input_section_map_valid_(true) 1810 1812 { 1811 1813 // An unallocated section has no address. Forcing this means that 1812 1814 // we don't need special treatment for symbols defined in debug … … 3045 3047 3046 3048 void 3047 3049 Output_segment::add_output_section(Output_section* os, 3048 elfcpp::Elf_Word seg_flags) 3050 elfcpp::Elf_Word seg_flags, 3051 bool do_sort) 3049 3052 { 3050 3053 gold_assert((os->flags() & elfcpp::SHF_ALLOC) != 0); 3051 3054 gold_assert(!this->is_max_align_known_); 3052 3055 gold_assert(os->is_large_data_section() == this->is_large_data_segment()); 3056 gold_assert(this->type() == elfcpp::PT_LOAD || !do_sort); 3053 3057 3054 3058 // Update the segment flags. 3055 3059 this->flags_ |= seg_flags; … … 3060 3064 else 3061 3065 pdl = &this->output_data_; 3062 3066 3063 // So that PT_NOTE segments will work correctly, we need to ensure3064 // that all SHT_NOTE sections are adjacent. This will normally3065 // happen automatically, because all the SHT_NOTE input sections3066 // will wind up in the same output section. However, it is possible3067 // for multiple SHT_NOTE input sections to have different section3068 // flags, and thus be in different output sections, but for the3069 // different section flags to map into the same segment flags and3070 // thus the same output segment.3071 3072 3067 // Note that while there may be many input sections in an output 3073 3068 // section, there are normally only a few output sections in an 3074 // output segment. Th is loop isexpected to be fast.3069 // output segment. The loops below are expected to be fast. 3075 3070 3071 // So that PT_NOTE segments will work correctly, we need to ensure 3072 // that all SHT_NOTE sections are adjacent. 3076 3073 if (os->type() == elfcpp::SHT_NOTE && !pdl->empty()) 3077 3074 { 3078 3075 Output_segment::Output_data_list::iterator p = pdl->end(); … … 3094 3091 // case: we group the SHF_TLS/SHT_NOBITS sections right after the 3095 3092 // SHF_TLS/SHT_PROGBITS sections. This lets us set up PT_TLS 3096 3093 // correctly. SHF_TLS sections get added to both a PT_LOAD segment 3097 // and the PT_TLS segment -- we do this grouping only for the3098 // PT_LOADsegment.3094 // and the PT_TLS segment; we do this grouping only for the PT_LOAD 3095 // segment. 3099 3096 if (this->type_ != elfcpp::PT_TLS 3100 3097 && (os->flags() & elfcpp::SHF_TLS) != 0) 3101 3098 { … … 3225 3222 gold_unreachable(); 3226 3223 } 3227 3224 3225 // We do some further output section sorting in order to make the 3226 // generated program run more efficiently. We should only do this 3227 // when not using a linker script, so it is controled by the DO_SORT 3228 // parameter. 3229 if (do_sort) 3230 { 3231 // FreeBSD requires the .interp section to be in the first page 3232 // of the executable. That is a more efficient location anyhow 3233 // for any OS, since it means that the kernel will have the data 3234 // handy after it reads the program headers. 3235 if (os->is_interp() && !pdl->empty()) 3236 { 3237 pdl->insert(pdl->begin(), os); 3238 return; 3239 } 3240 3241 // Put loadable non-writable notes immediately after the .interp 3242 // sections, so that the PT_NOTE segment is on the first page of 3243 // the executable. 3244 if (os->type() == elfcpp::SHT_NOTE 3245 && (os->flags() & elfcpp::SHF_WRITE) == 0 3246 && !pdl->empty()) 3247 { 3248 Output_segment::Output_data_list::iterator p = pdl->begin(); 3249 if ((*p)->is_section() && (*p)->output_section()->is_interp()) 3250 ++p; 3251 pdl->insert(p, os); 3252 return; 3253 } 3254 3255 // If this section is used by the dynamic linker, and it is not 3256 // writable, then put it first, after the .interp section and 3257 // any loadable notes. This makes it more likely that the 3258 // dynamic linker will have to read less data from the disk. 3259 if (os->is_dynamic_linker_section() 3260 && !pdl->empty() 3261 && (os->flags() & elfcpp::SHF_WRITE) == 0) 3262 { 3263 bool is_reloc = (os->type() == elfcpp::SHT_REL 3264 || os->type() == elfcpp::SHT_RELA); 3265 Output_segment::Output_data_list::iterator p = pdl->begin(); 3266 while (p != pdl->end() 3267 && (*p)->is_section() 3268 && ((*p)->output_section()->is_dynamic_linker_section() 3269 || (*p)->output_section()->type() == elfcpp::SHT_NOTE)) 3270 { 3271 // Put reloc sections after the other ones. Putting the 3272 // dynamic reloc sections first confuses BFD, notably 3273 // objcopy and strip. 3274 if (!is_reloc 3275 && ((*p)->output_section()->type() == elfcpp::SHT_REL 3276 || (*p)->output_section()->type() == elfcpp::SHT_RELA)) 3277 break; 3278 ++p; 3279 } 3280 pdl->insert(p, os); 3281 return; 3282 } 3283 } 3284 3285 // If there were no constraints on the output section, just add it 3286 // to the end of the list. 3228 3287 pdl->push_back(os); 3229 3288 } 3230 3289 … … 3503 3562 else 3504 3563 { 3505 3564 Output_section* os = (*p)->output_section(); 3565 3566 // Cast to unsigned long long to avoid format warnings. 3567 unsigned long long previous_dot = 3568 static_cast<unsigned long long>(addr + (off - startoff)); 3569 unsigned long long dot = 3570 static_cast<unsigned long long>((*p)->address()); 3571 3506 3572 if (os == NULL) 3507 3573 gold_error(_("dot moves backward in linker script " 3508 "from 0x%llx to 0x%llx"), 3509 addr + (off - startoff), (*p)->address()); 3574 "from 0x%llx to 0x%llx"), previous_dot, dot); 3510 3575 else 3511 3576 gold_error(_("address of section '%s' moves backward " 3512 3577 "from 0x%llx to 0x%llx"), 3513 os->name(), addr + (off - startoff), 3514 (*p)->address()); 3578 os->name(), previous_dot, dot); 3515 3579 } 3516 3580 } 3517 3581 (*p)->set_file_offset(off); -
gold/output.h
diff -Naur binutils-2.20.orig/gold/output.h binutils-2.20/gold/output.h
old new 2387 2387 is_large_data_section() 2388 2388 { return this->is_large_section_ && this->type_ != elfcpp::SHT_NOBITS; } 2389 2389 2390 // True if this is the .interp section which goes into the PT_INTERP 2391 // segment. 2392 bool 2393 is_interp() const 2394 { return this->is_interp_; } 2395 2396 // Record that this is the interp section. 2397 void 2398 set_is_interp() 2399 { this->is_interp_ = true; } 2400 2401 // True if this is a section used by the dynamic linker. 2402 bool 2403 is_dynamic_linker_section() const 2404 { return this->is_dynamic_linker_section_; } 2405 2406 // Record that this is a section used by the dynamic linker. 2407 void 2408 set_is_dynamic_linker_section() 2409 { this->is_dynamic_linker_section_ = true; } 2410 2390 2411 // Return whether this section should be written after all the input 2391 2412 // sections are complete. 2392 2413 bool … … 3327 3348 bool is_small_section_ : 1; 3328 3349 // True if this is a large section. 3329 3350 bool is_large_section_ : 1; 3351 // True if this is the .interp section going into the PT_INTERP 3352 // segment. 3353 bool is_interp_ : 1; 3354 // True if this is section is read by the dynamic linker. 3355 bool is_dynamic_linker_section_ : 1; 3356 // Whether code-fills are generated at write. 3357 bool generate_code_fills_at_write_ : 1; 3330 3358 // For SHT_TLS sections, the offset of this section relative to the base 3331 3359 // of the TLS segment. 3332 3360 uint64_t tls_offset_; … … 3337 3365 // Map from merge section properties to merge_sections; 3338 3366 Merge_section_by_properties_map merge_section_by_properties_map_; 3339 3367 // Map from input sections to relaxed input sections. This is mutable 3340 // be acause it is udpated lazily. We may need to update it in a3368 // because it is updated lazily. We may need to update it in a 3341 3369 // const qualified method. 3342 3370 mutable Output_section_data_by_input_section_map relaxed_input_section_map_; 3343 3371 // Whether relaxed_input_section_map_ is valid. 3344 3372 mutable bool is_relaxed_input_section_map_valid_; 3345 // Whether code-fills are generated at write.3346 bool generate_code_fills_at_write_;3347 3373 }; 3348 3374 3349 3375 // An output segment. PT_LOAD segments are built from collections of … … 3412 3438 uint64_t 3413 3439 maximum_alignment(); 3414 3440 3415 // Add an Output_section to this segment. 3441 // Add the Output_section OS to this segment. SEG_FLAGS is the 3442 // segment flags to use. DO_SORT is true if we should sort the 3443 // placement of the input section for more efficient generated code. 3416 3444 void 3417 add_output_section(Output_section* os, elfcpp::Elf_Word seg_flags); 3445 add_output_section(Output_section* os, elfcpp::Elf_Word seg_flags, 3446 bool do_sort); 3418 3447 3419 3448 // Remove an Output_section from this segment. It is an error if it 3420 3449 // is not present. -
gold/po/Make-in
diff -Naur binutils-2.20.orig/gold/po/Make-in binutils-2.20/gold/po/Make-in
old new 1 1 # Makefile for program source directory in GNU NLS utilities package. 2 2 # Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu> 3 # Copyright 2003, 2006 Free Software Foundation, Inc.3 # Copyright 2003, 2006, 2007, 2009 Free Software Foundation, Inc. 4 4 # 5 5 # This file may be copied and used freely without restrictions. It can 6 6 # be used in projects which are not available under the GNU Public License … … 88 88 89 89 $(srcdir)/$(PACKAGE).pot: $(POTFILES) 90 90 $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \ 91 --add-comments --keyword=_ --keyword=N_ \ 91 --add-comments -C --keyword=_ --keyword=N_ \ 92 --msgid-bugs-address=bug-binutils@gnu.org \ 92 93 --files-from=$(srcdir)/POTFILES.in 93 94 rm -f $(srcdir)/$(PACKAGE).pot 94 95 mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot … … 112 113 install-exec: 113 114 install-info: 114 115 install-html: 116 install-pdf: 115 117 install-data: install-data-@USE_NLS@ 116 118 install-data-no: all 117 119 install-data-yes: all 118 120 if test -r $(MKINSTALLDIRS); then \ 119 121 $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \ 120 122 else \ 121 $(top_srcdir)/ mkinstalldirs $(DESTDIR)$(datadir); \123 $(top_srcdir)/../mkinstalldirs $(DESTDIR)$(datadir); \ 122 124 fi 123 125 @catalogs='$(CATALOGS)'; \ 124 126 for cat in $$catalogs; do \ -
gold/powerpc.cc
diff -Naur binutils-2.20.orig/gold/powerpc.cc binutils-2.20/gold/powerpc.cc
old new 713 713 714 714 layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS, 715 715 elfcpp::SHF_ALLOC | elfcpp::SHF_WRITE, 716 this->got_ );716 this->got_, false); 717 717 718 718 // Create the GOT2 or TOC in the .got section. 719 719 if (size == 32) … … 722 722 layout->add_output_section_data(".got2", elfcpp::SHT_PROGBITS, 723 723 elfcpp::SHF_ALLOC 724 724 | elfcpp::SHF_WRITE, 725 this->got2_ );725 this->got2_, false); 726 726 } 727 727 else 728 728 { … … 730 730 layout->add_output_section_data(".toc", elfcpp::SHT_PROGBITS, 731 731 elfcpp::SHF_ALLOC 732 732 | elfcpp::SHF_WRITE, 733 this->toc_ );733 this->toc_, false); 734 734 } 735 735 736 736 // Define _GLOBAL_OFFSET_TABLE_ at the start of the .got section. … … 756 756 gold_assert(layout != NULL); 757 757 this->rela_dyn_ = new Reloc_section(parameters->options().combreloc()); 758 758 layout->add_output_section_data(".rela.dyn", elfcpp::SHT_RELA, 759 elfcpp::SHF_ALLOC, this->rela_dyn_ );759 elfcpp::SHF_ALLOC, this->rela_dyn_, true); 760 760 } 761 761 return this->rela_dyn_; 762 762 } … … 816 816 { 817 817 this->rel_ = new Reloc_section(false); 818 818 layout->add_output_section_data(".rela.plt", elfcpp::SHT_RELA, 819 elfcpp::SHF_ALLOC, this->rel_ );819 elfcpp::SHF_ALLOC, this->rel_, true); 820 820 } 821 821 822 822 template<int size, bool big_endian> … … 945 945 (elfcpp::SHF_ALLOC 946 946 | elfcpp::SHF_EXECINSTR 947 947 | elfcpp::SHF_WRITE), 948 this->plt_ );948 this->plt_, false); 949 949 950 950 // Define _PROCEDURE_LINKAGE_TABLE_ at the start of the .plt section. 951 951 symtab->define_in_output_data("_PROCEDURE_LINKAGE_TABLE_", NULL, … … 1512 1512 Output_section* os = layout->add_output_section_data(".sdata", 0, 1513 1513 elfcpp::SHF_ALLOC 1514 1514 | elfcpp::SHF_WRITE, 1515 sdata );1515 sdata, false); 1516 1516 symtab->define_in_output_data("_SDA_BASE_", NULL, 1517 1517 os, 1518 1518 32768, 0, … … 1547 1547 Output_data_dynamic* const odyn = layout->dynamic_data(); 1548 1548 if (odyn != NULL) 1549 1549 { 1550 if (this->plt_ != NULL) 1550 if (this->plt_ != NULL 1551 && this->plt_->output_section() != NULL) 1551 1552 { 1552 1553 const Output_data* od = this->plt_->rel_plt(); 1553 1554 odyn->add_section_size(elfcpp::DT_PLTRELSZ, od); … … 1557 1558 odyn->add_section_address(elfcpp::DT_PLTGOT, this->plt_); 1558 1559 } 1559 1560 1560 if (this->rela_dyn_ != NULL) 1561 if (this->rela_dyn_ != NULL 1562 && this->rela_dyn_->output_section() != NULL) 1561 1563 { 1562 1564 const Output_data* od = this->rela_dyn_; 1563 1565 odyn->add_section_address(elfcpp::DT_RELA, od); -
gold/resolve.cc
diff -Naur binutils-2.20.orig/gold/resolve.cc binutils-2.20/gold/resolve.cc
old new 302 302 sym.get_st_type()); 303 303 304 304 bool adjust_common_sizes; 305 typename Sized_symbol<size>::Size_type tosize = to->symsize(); 305 306 if (Symbol_table::should_override(to, frombits, object, 306 307 &adjust_common_sizes)) 307 308 { 308 typename Sized_symbol<size>::Size_type tosize = to->symsize();309 310 309 this->override(to, sym, st_shndx, is_ordinary, object, version); 311 312 310 if (adjust_common_sizes && tosize > to->symsize()) 313 311 to->set_symsize(tosize); 314 312 } 315 313 else 316 314 { 317 if (adjust_common_sizes && sym.get_st_size() > to ->symsize())315 if (adjust_common_sizes && sym.get_st_size() > tosize) 318 316 to->set_symsize(sym.get_st_size()); 319 317 // The ELF ABI says that even for a reference to a symbol we 320 318 // merge the visibility. 321 319 to->override_visibility(sym.get_st_visibility()); 322 320 } 323 321 322 if (adjust_common_sizes && parameters->options().warn_common()) 323 { 324 if (tosize > sym.get_st_size()) 325 Symbol_table::report_resolve_problem(false, 326 _("common of '%s' overriding " 327 "smaller common"), 328 to, object); 329 else if (tosize < sym.get_st_size()) 330 Symbol_table::report_resolve_problem(false, 331 _("common of '%s' overidden by " 332 "larger common"), 333 to, object); 334 else 335 Symbol_table::report_resolve_problem(false, 336 _("multiple common of '%s'"), 337 to, object); 338 } 339 324 340 // A new weak undefined reference, merging with an old weak 325 341 // reference, could be a One Definition Rule (ODR) violation -- 326 342 // especially if the types or sizes of the references differ. We'll … … 422 438 || object->just_symbols()) 423 439 return false; 424 440 425 // FIXME: Do a better job of reporting locations. 426 gold_error(_("%s: multiple definition of %s"), 427 object != NULL ? object->name().c_str() : _("command line"), 428 to->demangled_name().c_str()); 429 gold_error(_("%s: previous definition here"), 430 (to->source() == Symbol::FROM_OBJECT 431 ? to->object()->name().c_str() 432 : _("command line"))); 441 Symbol_table::report_resolve_problem(true, 442 _("multiple definition of '%s'"), 443 to, object); 433 444 return false; 434 445 435 446 case WEAK_DEF * 16 + DEF: … … 464 475 case DYN_COMMON * 16 + DEF: 465 476 case DYN_WEAK_COMMON * 16 + DEF: 466 477 // We've seen a common symbol and now we see a definition. The 467 // definition overrides. FIXME: We should optionally issue, version a 468 // warning. 478 // definition overrides. 479 if (parameters->options().warn_common()) 480 Symbol_table::report_resolve_problem(false, 481 _("definition of '%s' overriding " 482 "common"), 483 to, object); 469 484 return true; 470 485 471 486 case DEF * 16 + WEAK_DEF: … … 495 510 case DYN_COMMON * 16 + WEAK_DEF: 496 511 case DYN_WEAK_COMMON * 16 + WEAK_DEF: 497 512 // A weak definition does override a definition in a dynamic 498 // object. FIXME: We should optionally issue a warning. 513 // object. 514 if (parameters->options().warn_common()) 515 Symbol_table::report_resolve_problem(false, 516 _("definition of '%s' overriding " 517 "dynamic common definition"), 518 to, object); 499 519 return true; 500 520 501 521 case DEF * 16 + DYN_DEF: … … 611 631 612 632 case DEF * 16 + COMMON: 613 633 // A common symbol does not override a definition. 634 if (parameters->options().warn_common()) 635 Symbol_table::report_resolve_problem(false, 636 _("common '%s' overridden by " 637 "previous definition"), 638 to, object); 614 639 return false; 615 640 616 641 case WEAK_DEF * 16 + COMMON: … … 716 741 } 717 742 } 718 743 744 // Issue an error or warning due to symbol resolution. IS_ERROR 745 // indicates an error rather than a warning. MSG is the error 746 // message; it is expected to have a %s for the symbol name. TO is 747 // the existing symbol. OBJECT is where the new symbol was found. 748 749 // FIXME: We should have better location information here. When the 750 // symbol is defined, we should be able to pull the location from the 751 // debug info if there is any. 752 753 void 754 Symbol_table::report_resolve_problem(bool is_error, const char* msg, 755 const Symbol* to, Object* object) 756 { 757 std::string demangled(to->demangled_name()); 758 size_t len = strlen(msg) + demangled.length() + 10; 759 char* buf = new char[len]; 760 snprintf(buf, len, msg, demangled.c_str()); 761 762 const char* objname; 763 if (object != NULL) 764 objname = object->name().c_str(); 765 else 766 objname = _("command line"); 767 768 if (is_error) 769 gold_error("%s: %s", objname, buf); 770 else 771 gold_warning("%s: %s", objname, buf); 772 773 delete[] buf; 774 775 if (to->source() == Symbol::FROM_OBJECT) 776 objname = to->object()->name().c_str(); 777 else 778 objname = _("command line"); 779 gold_info("%s: %s: previous definition here", program_name, objname); 780 } 781 719 782 // A special case of should_override which is only called for a strong 720 783 // defined symbol from a regular object file. This is used when 721 784 // defining special symbols. -
gold/script-sections.cc
diff -Naur binutils-2.20.orig/gold/script-sections.cc binutils-2.20/gold/script-sections.cc
old new 3051 3051 is_current_seg_readonly = true; 3052 3052 } 3053 3053 3054 current_seg->add_output_section(*p, seg_flags );3054 current_seg->add_output_section(*p, seg_flags, false); 3055 3055 3056 3056 if (((*p)->flags() & elfcpp::SHF_WRITE) != 0) 3057 3057 is_current_seg_readonly = false; … … 3130 3130 Layout::section_flags_to_segment((*p)->flags()); 3131 3131 Output_segment* oseg = layout->make_output_segment(elfcpp::PT_NOTE, 3132 3132 seg_flags); 3133 oseg->add_output_section(*p, seg_flags );3133 oseg->add_output_section(*p, seg_flags, false); 3134 3134 3135 3135 // Incorporate any subsequent SHT_NOTE sections, in the 3136 3136 // hopes that the script is sensible. … … 3139 3139 && (*pnext)->type() == elfcpp::SHT_NOTE) 3140 3140 { 3141 3141 seg_flags = Layout::section_flags_to_segment((*pnext)->flags()); 3142 oseg->add_output_section(*pnext, seg_flags );3142 oseg->add_output_section(*pnext, seg_flags, false); 3143 3143 p = pnext; 3144 3144 ++pnext; 3145 3145 } … … 3154 3154 Layout::section_flags_to_segment((*p)->flags()); 3155 3155 Output_segment* oseg = layout->make_output_segment(elfcpp::PT_TLS, 3156 3156 seg_flags); 3157 oseg->add_output_section(*p, seg_flags );3157 oseg->add_output_section(*p, seg_flags, false); 3158 3158 3159 3159 Layout::Section_list::const_iterator pnext = p + 1; 3160 3160 while (pnext != sections->end() 3161 3161 && ((*pnext)->flags() & elfcpp::SHF_TLS) != 0) 3162 3162 { 3163 3163 seg_flags = Layout::section_flags_to_segment((*pnext)->flags()); 3164 oseg->add_output_section(*pnext, seg_flags );3164 oseg->add_output_section(*pnext, seg_flags, false); 3165 3165 p = pnext; 3166 3166 ++pnext; 3167 3167 } … … 3315 3315 3316 3316 elfcpp::Elf_Word seg_flags = 3317 3317 Layout::section_flags_to_segment(os->flags()); 3318 r->second->add_output_section(os, seg_flags );3318 r->second->add_output_section(os, seg_flags, false); 3319 3319 3320 3320 if (r->second->type() == elfcpp::PT_LOAD) 3321 3321 { -
gold/sparc.cc
diff -Naur binutils-2.20.orig/gold/sparc.cc binutils-2.20/gold/sparc.cc
old new 1027 1027 os = layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS, 1028 1028 (elfcpp::SHF_ALLOC 1029 1029 | elfcpp::SHF_WRITE), 1030 this->got_ );1030 this->got_, false); 1031 1031 os->set_is_relro(); 1032 1032 1033 1033 // Define _GLOBAL_OFFSET_TABLE_ at the start of the .got section. … … 1053 1053 gold_assert(layout != NULL); 1054 1054 this->rela_dyn_ = new Reloc_section(parameters->options().combreloc()); 1055 1055 layout->add_output_section_data(".rela.dyn", elfcpp::SHT_RELA, 1056 elfcpp::SHF_ALLOC, this->rela_dyn_ );1056 elfcpp::SHF_ALLOC, this->rela_dyn_, true); 1057 1057 } 1058 1058 return this->rela_dyn_; 1059 1059 } … … 1155 1155 { 1156 1156 this->rel_ = new Reloc_section(false); 1157 1157 layout->add_output_section_data(".rela.plt", elfcpp::SHT_RELA, 1158 elfcpp::SHF_ALLOC, this->rel_ );1158 elfcpp::SHF_ALLOC, this->rel_, true); 1159 1159 } 1160 1160 1161 1161 template<int size, bool big_endian> … … 1372 1372 (elfcpp::SHF_ALLOC 1373 1373 | elfcpp::SHF_EXECINSTR 1374 1374 | elfcpp::SHF_WRITE), 1375 this->plt_ );1375 this->plt_, false); 1376 1376 1377 1377 // Define _PROCEDURE_LINKAGE_TABLE_ at the start of the .plt section. 1378 1378 symtab->define_in_output_data("_PROCEDURE_LINKAGE_TABLE_", NULL, … … 2334 2334 Output_data_dynamic* const odyn = layout->dynamic_data(); 2335 2335 if (odyn != NULL) 2336 2336 { 2337 if (this->plt_ != NULL) 2337 if (this->plt_ != NULL 2338 && this->plt_->output_section() != NULL) 2338 2339 { 2339 2340 const Output_data* od = this->plt_->rel_plt(); 2340 2341 odyn->add_section_size(elfcpp::DT_PLTRELSZ, od); … … 2344 2345 odyn->add_section_address(elfcpp::DT_PLTGOT, this->plt_); 2345 2346 } 2346 2347 2347 if (this->rela_dyn_ != NULL) 2348 if (this->rela_dyn_ != NULL 2349 && this->rela_dyn_->output_section() != NULL) 2348 2350 { 2349 2351 const Output_data* od = this->rela_dyn_; 2350 2352 odyn->add_section_address(elfcpp::DT_RELA, od); -
gold/symtab.cc
diff -Naur binutils-2.20.orig/gold/symtab.cc binutils-2.20/gold/symtab.cc
old new 2242 2242 // Record any version information. 2243 2243 if (sym->version() != NULL) 2244 2244 versions->record_version(this, dynpool, sym); 2245 2246 // If the symbol is defined in a dynamic object and is 2247 // referenced in a regular object, then mark the dynamic 2248 // object as needed. This is used to implement --as-needed. 2249 if (sym->is_from_dynobj() && sym->in_reg()) 2250 sym->object()->set_is_needed(); 2245 2251 } 2246 2252 } 2247 2253 -
gold/symtab.h
diff -Naur binutils-2.20.orig/gold/symtab.h binutils-2.20/gold/symtab.h
old new 1488 1488 static bool 1489 1489 should_override(const Symbol*, unsigned int, Object*, bool*); 1490 1490 1491 // Report a problem in symbol resolution. 1492 static void 1493 report_resolve_problem(bool is_error, const char* msg, const Symbol* to, 1494 Object* object); 1495 1491 1496 // Override a symbol. 1492 1497 template<int size, bool big_endian> 1493 1498 void -
gold/x86_64.cc
diff -Naur binutils-2.20.orig/gold/x86_64.cc binutils-2.20/gold/x86_64.cc
old new 472 472 os = layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS, 473 473 (elfcpp::SHF_ALLOC 474 474 | elfcpp::SHF_WRITE), 475 this->got_ );475 this->got_, false); 476 476 os->set_is_relro(); 477 477 478 478 // The old GNU linker creates a .got.plt section. We just … … 483 483 os = layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS, 484 484 (elfcpp::SHF_ALLOC 485 485 | elfcpp::SHF_WRITE), 486 this->got_plt_ );486 this->got_plt_, false); 487 487 os->set_is_relro(); 488 488 489 489 // The first three entries are reserved. … … 511 511 gold_assert(layout != NULL); 512 512 this->rela_dyn_ = new Reloc_section(parameters->options().combreloc()); 513 513 layout->add_output_section_data(".rela.dyn", elfcpp::SHT_RELA, 514 elfcpp::SHF_ALLOC, this->rela_dyn_ );514 elfcpp::SHF_ALLOC, this->rela_dyn_, true); 515 515 } 516 516 return this->rela_dyn_; 517 517 } … … 611 611 { 612 612 this->rel_ = new Reloc_section(false); 613 613 layout->add_output_section_data(".rela.plt", elfcpp::SHT_RELA, 614 elfcpp::SHF_ALLOC, this->rel_ );614 elfcpp::SHF_ALLOC, this->rel_, true); 615 615 } 616 616 617 617 void … … 807 807 layout->add_output_section_data(".plt", elfcpp::SHT_PROGBITS, 808 808 (elfcpp::SHF_ALLOC 809 809 | elfcpp::SHF_EXECINSTR), 810 this->plt_ );810 this->plt_, false); 811 811 } 812 812 } 813 813 … … 1659 1659 Output_data_dynamic* const odyn = layout->dynamic_data(); 1660 1660 if (odyn != NULL) 1661 1661 { 1662 if (this->got_plt_ != NULL) 1662 if (this->got_plt_ != NULL 1663 && this->got_plt_->output_section() != NULL) 1663 1664 odyn->add_section_address(elfcpp::DT_PLTGOT, this->got_plt_); 1664 1665 1665 if (this->plt_ != NULL) 1666 if (this->plt_ != NULL 1667 && this->plt_->output_section() != NULL) 1666 1668 { 1667 1669 const Output_data* od = this->plt_->rel_plt(); 1668 1670 odyn->add_section_size(elfcpp::DT_PLTRELSZ, od); … … 1680 1682 } 1681 1683 } 1682 1684 1683 if (this->rela_dyn_ != NULL) 1685 if (this->rela_dyn_ != NULL 1686 && this->rela_dyn_->output_section() != NULL) 1684 1687 { 1685 1688 const Output_data* od = this->rela_dyn_; 1686 1689 odyn->add_section_address(elfcpp::DT_RELA, od); -
include/ChangeLog
diff -Naur binutils-2.20.orig/include/ChangeLog binutils-2.20/include/ChangeLog
old new 1 2009-10-09 Rafael Espindola <espindola@google.com> 2 3 * plugin-api.h (ld_plugin_add_input_library): Change argument name to 4 libname. 5 6 2008-10-03 Rafael Espindola <espindola@google.com> 7 8 * plugin-api.h: New. 9 * lto-symtab.h: New. 10 1 11 2009-09-09 Martin Thuresson <martin@mtme.org> 2 12 3 13 * bfdlink.h (struct bfd_link_hash_common_entry): Move to top -
include/elf/ChangeLog
diff -Naur binutils-2.20.orig/include/elf/ChangeLog binutils-2.20/include/elf/ChangeLog
old new 1 2009-12-17 Alan Modra <amodra@bigpond.net.au> 2 3 * ppc.h (R_PPC_RELAX32, R_PPC_RELAX32PC, R_PPC_RELAX32_PLT, 4 R_PPC_RELAX32PC_PLT): Delete. 5 (R_PPC_RELAX, R_PPC_RELAX_PLT, R_PPC_RELAX_PLTREL24): Define. 6 1 7 2009-09-21 Alan Modra <amodra@bigpond.net.au> 2 8 3 9 * ppc.h (DT_PPC_TLSOPT): Define. -
include/elf/ppc.h
diff -Naur binutils-2.20.orig/include/elf/ppc.h binutils-2.20/include/elf/ppc.h
old new 73 73 74 74 #ifndef RELOC_MACROS_GEN_FUNC 75 75 /* Fake relocations for branch stubs, only used internally by ld. */ 76 RELOC_NUMBER (R_PPC_RELAX32, 48) 77 RELOC_NUMBER (R_PPC_RELAX32PC, 49) 78 RELOC_NUMBER (R_PPC_RELAX32_PLT, 50) 79 RELOC_NUMBER (R_PPC_RELAX32PC_PLT, 51) 76 RELOC_NUMBER (R_PPC_RELAX, 48) 77 RELOC_NUMBER (R_PPC_RELAX_PLT, 49) 78 RELOC_NUMBER (R_PPC_RELAX_PLTREL24, 50) 80 79 #endif 81 80 82 81 /* Relocs added to support TLS. */ -
include/plugin-api.h
diff -Naur binutils-2.20.orig/include/plugin-api.h binutils-2.20/include/plugin-api.h
old new 1 1 /* plugin-api.h -- External linker plugin API. */ 2 2 3 /* Copyright 200 8Free Software Foundation, Inc.3 /* Copyright 2009 Free Software Foundation, Inc. 4 4 Written by Cary Coutant <ccoutant@google.com>. 5 5 6 6 This file is part of binutils. … … 111 111 enum ld_plugin_symbol_resolution 112 112 { 113 113 LDPR_UNKNOWN = 0, 114 115 /* Symbol is still undefined at this point. */ 114 116 LDPR_UNDEF, 117 118 /* This is the prevailing definition of the symbol, with references from 119 regular object code. */ 115 120 LDPR_PREVAILING_DEF, 121 122 /* This is the prevailing definition of the symbol, with no 123 references from regular objects. It is only referenced from IR 124 code. */ 116 125 LDPR_PREVAILING_DEF_IRONLY, 126 127 /* This definition was pre-empted by a definition in a regular 128 object file. */ 117 129 LDPR_PREEMPTED_REG, 130 131 /* This definition was pre-empted by a definition in another IR file. */ 118 132 LDPR_PREEMPTED_IR, 133 134 /* This symbol was resolved by a definition in another IR file. */ 119 135 LDPR_RESOLVED_IR, 136 137 /* This symbol was resolved by a definition in a regular object 138 linked into the main executable. */ 120 139 LDPR_RESOLVED_EXEC, 140 141 /* This symbol was resolved by a definition in a shared object. */ 121 142 LDPR_RESOLVED_DYN 122 143 }; 123 144 … … 193 214 enum ld_plugin_status 194 215 (*ld_plugin_add_input_file) (char *pathname); 195 216 217 /* The linker's interface for adding a library that should be searched. */ 218 219 typedef 220 enum ld_plugin_status 221 (*ld_plugin_add_input_library) (char *libname); 222 196 223 /* The linker's interface for issuing a warning or error message. */ 197 224 198 225 typedef … … 224 251 LDPT_ADD_INPUT_FILE, 225 252 LDPT_MESSAGE, 226 253 LDPT_GET_INPUT_FILE, 227 LDPT_RELEASE_INPUT_FILE 254 LDPT_RELEASE_INPUT_FILE, 255 LDPT_ADD_INPUT_LIBRARY 228 256 }; 229 257 230 258 /* The plugin transfer vector. */ … … 245 273 ld_plugin_message tv_message; 246 274 ld_plugin_get_input_file tv_get_input_file; 247 275 ld_plugin_release_input_file tv_release_input_file; 276 ld_plugin_add_input_library tv_add_input_library; 248 277 } tv_u; 249 278 }; 250 279 -
ld/ChangeLog
diff -Naur binutils-2.20.orig/ld/ChangeLog binutils-2.20/ld/ChangeLog
old new 1 2009-12-17 Dave Korn <dave.korn.cygwin@gmail.com> 2 3 * pe-dll.c (generate_reloc): Take account of wrapper options when 4 testing if a weak symbol is defined or not, and when it is not, 5 consider whether the default value requires a base reloc anyway. 6 7 2009-12-09 Alan Modra <amodra@bigpond.net.au> 8 9 PR ld/11012 10 * emulparams/elf64ppc.sh (OTHER_GOT_RELOC_SECTIONS): Move .rela.opd .. 11 (INITIAL_RELOC_SECTIONS): .. to here. New define. 12 * scripttempl/elf.sc: Expand INITIAL_RELOC_SECTIONS. 13 1 14 2009-10-14 Andreas Schwab <schwab@linux-m68k.org> 2 15 3 16 * ldlex.l (yy_input): Remove second argument and return the value -
ld/emulparams/elf64ppc.sh
diff -Naur binutils-2.20.orig/ld/emulparams/elf64ppc.sh binutils-2.20/ld/emulparams/elf64ppc.sh
old new 28 28 .got 0 : { *(.got) } 29 29 .toc 0 : { *(.toc) }" 30 30 fi 31 # Put .opd relocs first so ld.so will process them before any ifunc relocs. 32 INITIAL_RELOC_SECTIONS=" 33 .rela.opd ${RELOCATING-0} : { *(.rela.opd) }" 31 34 OTHER_GOT_RELOC_SECTIONS=" 32 35 .rela.toc ${RELOCATING-0} : { *(.rela.toc) } 33 .rela.opd ${RELOCATING-0} : { *(.rela.opd) }34 36 .rela.branch_lt ${RELOCATING-0} : { *(.rela.branch_lt) }" 35 37 OTHER_READWRITE_SECTIONS=" 36 38 .toc1 ${RELOCATING-0} :${RELOCATING+ ALIGN(8)} { *(.toc1) } -
binutils-2.20
diff -Naur binutils-2.20.orig/ld/pe-dll.c binutils-2.20/ld/pe-dll.c
old new 1348 1348 if (sym->flags == BSF_WEAK) 1349 1349 { 1350 1350 struct bfd_link_hash_entry *blhe 1351 = bfd_ link_hash_lookup (info->hash, sym->name,1351 = bfd_wrapped_link_hash_lookup (abfd, info, sym->name, 1352 1352 FALSE, FALSE, FALSE); 1353 if (!blhe || blhe->type != bfd_link_hash_defined) 1354 continue; 1353 if (blhe && blhe->type == bfd_link_hash_undefweak) 1354 { 1355 /* Check aux sym and see if it is defined or not. */ 1356 struct coff_link_hash_entry *h, *h2; 1357 h = (struct coff_link_hash_entry *)blhe; 1358 if (h->symbol_class != C_NT_WEAK || h->numaux != 1) 1359 continue; 1360 h2 = h->auxbfd->tdata.coff_obj_data->sym_hashes 1361 [h->aux->x_sym.x_tagndx.l]; 1362 /* We don't want a base reloc if the aux sym is not 1363 found, undefined, or if it is the constant ABS 1364 zero default value. (We broaden that slightly by 1365 not testing the value, just the section; there's 1366 no reason we'd want a reference to any absolute 1367 address to get relocated during rebasing). */ 1368 if (!h2 || h2->root.type == bfd_link_hash_undefined 1369 || h2->root.u.def.section == &bfd_abs_section) 1370 continue; 1371 } 1372 else if (!blhe || blhe->type != bfd_link_hash_defined) 1373 continue; 1355 1374 } 1356 1375 1357 1376 sym_vma = (relocs[i]->addend -
ld/scripttempl/elf.sc
diff -Naur binutils-2.20.orig/ld/scripttempl/elf.sc binutils-2.20/ld/scripttempl/elf.sc
old new 311 311 COMBRELOCCAT="cat > $COMBRELOC" 312 312 fi 313 313 eval $COMBRELOCCAT <<EOF 314 ${INITIAL_RELOC_SECTIONS} 314 315 .rel.init ${RELOCATING-0} : { *(.rel.init) } 315 316 .rela.init ${RELOCATING-0} : { *(.rela.init) } 316 317 .rel.text ${RELOCATING-0} : { *(.rel.text${RELOCATING+ .rel.text.* .rel.gnu.linkonce.t.*}) } -
ld/testsuite/ChangeLog
diff -Naur binutils-2.20.orig/ld/testsuite/ChangeLog binutils-2.20/ld/testsuite/ChangeLog
old new 1 2009-10-19 Hans-Peter Nilsson <hp@axis.com> 2 3 * ld-cris/tls-e-20.d, ld-cris/tls-e-20a.d, ld-cris/tls-e-22.d, 4 ld-cris/tls-e-80.d, ld-cris/tls-e-dtpoffd1.d, 5 ld-cris/tls-e-dtpoffd3.d, ld-cris/tls-ldgde-14.d, 6 ld-cris/tls-ldgde-15.d, ld-cris/tls-ldgdex-14.d, 7 ld-cris/tls-ldgdex-15.d: Adjust for change in non-shared 8 R_CRIS_32_DTPREL and R_CRIS_16_DTPREL relocations. 9 1 10 2009-10-03 Alan Modra <amodra@bigpond.net.au> 2 11 3 12 * ld-powerpc/tlsexe.d: Update. -
ld/testsuite/ld-cris/tls-e-20a.d
diff -Naur binutils-2.20.orig/ld/testsuite/ld-cris/tls-e-20a.d binutils-2.20/ld/testsuite/ld-cris/tls-e-20a.d
old new 102 102 #... 103 103 104 104 000800cc <tlsdsofn>: 105 800cc: 6fae f4ff ffff move\.d 0xfffffff4,\$r10105 800cc: 6fae 8000 0000 move\.d 80 <x>,\$r10 106 106 #... 107 107 108 108 000800d4 <tlsdsofn10>: -
ld/testsuite/ld-cris/tls-e-20.d
diff -Naur binutils-2.20.orig/ld/testsuite/ld-cris/tls-e-20.d binutils-2.20/ld/testsuite/ld-cris/tls-e-20.d
old new 64 64 80098: 6fae 1800 0000 move\.d 18 <x2\+0x10>,\$r10 65 65 #... 66 66 000800a0 <tlsdsofn>: 67 800a0: 6fae f4ff ffff move\.d 0xfffffff4,\$r1067 800a0: 6fae 0000 0000 move\.d 0 <x>,\$r10 68 68 #... 69 69 000800a8 <tlsdsofn10>: 70 70 800a8: 6fae 1400 0000 move\.d 14 <x2\+0xc>,\$r10 -
ld/testsuite/ld-cris/tls-e-22.d
diff -Naur binutils-2.20.orig/ld/testsuite/ld-cris/tls-e-22.d binutils-2.20/ld/testsuite/ld-cris/tls-e-22.d
old new 35 35 80094: 41b2 moveq 1,\$r11 36 36 #... 37 37 00080098 <tlsdsofn>: 38 80098: 6fae fcff ffff move\.d 0xfffffffc,\$r1038 80098: 6fae 8000 0000 move\.d 80 <x>,\$r10 39 39 #... -
ld/testsuite/ld-cris/tls-e-80.d
diff -Naur binutils-2.20.orig/ld/testsuite/ld-cris/tls-e-80.d binutils-2.20/ld/testsuite/ld-cris/tls-e-80.d
old new 81 81 800a8: 6fae b4ff ffff move.d 0xffffffb4,\$r10 82 82 #... 83 83 000800b0 <tlsdsofn>: 84 800b0: 6fae b0ff ffff move\.d 0xffffffb0,\$r1084 800b0: 6fae 0000 0000 move\.d 0 <x>,\$r10 85 85 #... 86 86 000800b8 <tlsdsofn10>: 87 87 800b8: 6fae 1400 0000 move\.d 14 <gx\+0x4>,\$r10 -
ld/testsuite/ld-cris/tls-e-dtpoffd1.d
diff -Naur binutils-2.20.orig/ld/testsuite/ld-cris/tls-e-dtpoffd1.d binutils-2.20/ld/testsuite/ld-cris/tls-e-dtpoffd1.d
old new 27 27 82120 00000000 00000000 00000000 01000000 .* 28 28 82130 80000000 .* 29 29 Contents of section .debug_info: 30 0000 fcffffff.*30 0000 80000000 .* 31 31 Contents of section .debug_line: 32 32 #pass -
ld/testsuite/ld-cris/tls-e-dtpoffd3.d
diff -Naur binutils-2.20.orig/ld/testsuite/ld-cris/tls-e-dtpoffd3.d binutils-2.20/ld/testsuite/ld-cris/tls-e-dtpoffd3.d
old new 27 27 8211c 00000000 00000000 00000000 01000000 .* 28 28 8212c 80000000 .* 29 29 Contents of section .debug_info: 30 0000 fcffffff.*30 0000 80000000 .* 31 31 Contents of section .debug_line: 32 32 #pass -
ld/testsuite/ld-cris/tls-ldgde-14.d
diff -Naur binutils-2.20.orig/ld/testsuite/ld-cris/tls-ldgde-14.d binutils-2.20/ld/testsuite/ld-cris/tls-ldgde-14.d
old new 51 51 80094: 41b2 moveq 1,\$r11 52 52 #... 53 53 00080098 <tlsdsofn>: 54 80098: 5fae f8ff move\.w 0xfff8,\$r1055 8009c: 5fbe fcff move\.w 0xfffc,\$r1154 80098: 5fae 8800 move\.w 0x88,\$r10 55 8009c: 5fbe 8c00 move\.w 0x8c,\$r11 56 56 57 57 000800a0 <tlsdsofn0>: 58 58 800a0: 5fae 1400 move\.w 0x14,\$r10 -
ld/testsuite/ld-cris/tls-ldgde-15.d
diff -Naur binutils-2.20.orig/ld/testsuite/ld-cris/tls-ldgde-15.d binutils-2.20/ld/testsuite/ld-cris/tls-ldgde-15.d
old new 51 51 80094: 41b2 moveq 1,\$r11 52 52 #... 53 53 00080098 <tlsdsofn>: 54 80098: 6fae f8ff ffff move.d 0xfffffff8,\$r1055 8009e: 6fbe fcff ffff move.d 0xfffffffc,\$r1154 80098: 6fae 8800 0000 move.d 88 <x1>,\$r10 55 8009e: 6fbe 8c00 0000 move.d 8c <x2>,\$r11 56 56 000800a4 <tlsdsofn2>: 57 57 800a4: 6fae 1400 0000 move.d 14 <tls128\+0x14>,\$r10 58 58 #... -
ld/testsuite/ld-cris/tls-ldgdex-14.d
diff -Naur binutils-2.20.orig/ld/testsuite/ld-cris/tls-ldgdex-14.d binutils-2.20/ld/testsuite/ld-cris/tls-ldgdex-14.d
old new 44 44 Contents of section .interp: 45 45 #... 46 46 Contents of section \.text: 47 801dc 41b20000 5fae f8ff 5fbefcff5fae1400 .*47 801dc 41b20000 5fae8000 5fbe8400 5fae1400 .* 48 48 801ec 5fae1c00 .* 49 49 Contents of section \.tdata: 50 50 #... -
ld/testsuite/ld-cris/tls-ldgdex-15.d
diff -Naur binutils-2.20.orig/ld/testsuite/ld-cris/tls-ldgdex-15.d binutils-2.20/ld/testsuite/ld-cris/tls-ldgdex-15.d
old new 44 44 Contents of section \.interp: 45 45 #... 46 46 Contents of section \.text: 47 801dc 41b20000 6fae f8ff ffff6fbe fcffffff.*47 801dc 41b20000 6fae8000 00006fbe 84000000 .* 48 48 801ec 6fae1400 00000000 6fae1c00 00000000 .* 49 49 Contents of section \.tdata: 50 50 #...
Note:
See TracBrowser
for help on using the repository browser.