source: patches/binutils-2.20-branch_update-1.patch @ 206bb97

clfs-1.2clfs-2.1clfs-3.0.0-systemdclfs-3.0.0-sysvinitsystemdsysvinit
Last change on this file since 206bb97 was 206bb97, checked in by Joe Ciccone <jciccone@…>, 14 years ago

Updated Binutils to 2.20.

  • Property mode set to 100644
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  
     12009-12-21  Alan Modra  <amodra@gmail.com>
     2
     3        * elf64-ppc.c: Delete my email address.
     4
     52009-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
     232009-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
     292009-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
     372009-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
     442009-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
     502009-10-20  Alan Modra  <amodra@bigpond.net.au>
     51
     52        PR binutils/10802
     53        * opncls.c (_maybe_make_executable): Make DYNAMIC files executable.
     54
     552009-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
     612009-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
    1672009-10-16  Tristan Gingold  <gingold@adacore.com>
    268
    369        * configure.in: Bump version to 2.20
  • bfd/configure

    diff -Naur binutils-2.20.orig/bfd/configure binutils-2.20/bfd/configure
    old new  
    41164116
    41174117# Define the identity of the package.
    41184118 PACKAGE=bfd
    4119  VERSION=2.20
     4119 VERSION=2.20.0
    41204120
    41214121
    41224122cat >>confdefs.h <<_ACEOF
  • bfd/configure.in

    diff -Naur binutils-2.20.orig/bfd/configure.in binutils-2.20/bfd/configure.in
    old new  
    88AC_CANONICAL_TARGET
    99AC_ISC_POSIX
    1010
    11 AM_INIT_AUTOMAKE(bfd, 2.20)
     11AM_INIT_AUTOMAKE(bfd, 2.20.0)
    1212
    1313dnl These must be called before LT_INIT, because it may want
    1414dnl 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  
    16901690                = -elf_cris_hash_table (info)->dtpmod_refcount;
    16911691            }
    16921692
    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.  */
    16981695          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;
    17021697          break;
    17031698
    17041699        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  
    33233323{
    33243324  struct plt_entry *ent;
    33253325
     3326  if (addend < 32768)
     3327    sec = NULL;
    33263328  for (ent = *plist; ent != NULL; ent = ent->next)
    33273329    if (ent->sec == sec && ent->addend == addend)
    33283330      break;
     
    35083510                      if (info->shared)
    35093511                        addend = rel->r_addend;
    35103512                    }
    3511                   if (!update_plt_info (abfd, ifunc,
    3512                                         addend < 32768 ? NULL : got2, addend))
     3513                  if (!update_plt_info (abfd, ifunc, got2, addend))
    35133514                    return FALSE;
    35143515                }
    35153516            }
     
    37483749                    addend = rel->r_addend;
    37493750                }
    37503751              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))
    37533753                return FALSE;
    37543754            }
    37553755          break;
     
    37803780        case R_PPC_EMB_MRKREF:
    37813781        case R_PPC_NONE:
    37823782        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:
    37873786          break;
    37883787
    37893788          /* These should only appear in dynamic objects.  */
     
    44864485                  struct plt_entry *ent;
    44874486
    44884487                  ent = find_plt_ent (&h->plt.plist, NULL, 0);
    4489                   if (ent->plt.refcount > 0)
     4488                  if (ent != NULL && ent->plt.refcount > 0)
    44904489                    ent->plt.refcount -= 1;
    44914490                }
    44924491            }
     
    45344533              if (r_type == R_PPC_PLTREL24 && info->shared)
    45354534                addend = rel->r_addend;
    45364535              ent = find_plt_ent (&h->plt.plist, got2, addend);
    4537               if (ent->plt.refcount > 0)
     4536              if (ent != NULL && ent->plt.refcount > 0)
    45384537                ent->plt.refcount -= 1;
    45394538            }
    45404539          break;
     
    45824581                       && tga->root.type == bfd_link_hash_undefweak)))
    45834582            {
    45844583              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)
    45884588                {
    45894589                  tga->root.type = bfd_link_hash_indirect;
    45904590                  tga->root.u.i.link = &opt->root;
     
    46694669      {
    46704670        Elf_Internal_Sym *locsyms = NULL;
    46714671        Elf_Internal_Shdr *symtab_hdr = &elf_symtab_hdr (ibfd);
     4672        asection *got2 = bfd_get_section_by_name (ibfd, ".got2");
    46724673
    46734674        for (sec = ibfd->sections; sec != NULL; sec = sec->next)
    46744675          if (sec->has_tls_reloc && !bfd_is_abs_section (sec->output_section))
     
    47624763                      else
    47634764                        continue;
    47644765
     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
    47654773                    default:
    47664774                      continue;
    47674775                    }
     
    47694777                  if (pass == 0)
    47704778                    {
    47714779                      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))
    47734782                        continue;
    47744783
    47754784                      if (rel + 1 < relend
     
    47854794                      break;
    47864795                    }
    47874796
     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
    47884814                  if (h != NULL)
    47894815                    {
    47904816                      tls_mask = &ppc_elf_hash_entry (h)->tls_mask;
     
    48294855                        *got_count -= 1;
    48304856                    }
    48314857
    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 
    48424858                  *tls_mask |= tls_set;
    48434859                  *tls_mask &= ~tls_clear;
    48444860                }
     
    62396255            {
    62406256              size = 4 * ARRAY_SIZE (shared_stub_entry);
    62416257              insn_offset = 12;
    6242               stub_rtype = R_PPC_RELAX32PC;
    62436258            }
    62446259          else
    62456260            {
    62466261              size = 4 * ARRAY_SIZE (stub_entry);
    62476262              insn_offset = 0;
    6248               stub_rtype = R_PPC_RELAX32;
    62496263            }
    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;
    62546265          if (tsec == htab->plt
    62556266              || 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            }
    62576272
    62586273          /* Hijack the old relocation.  Since we need two
    62596274             relocations for this use a "composite" reloc.  */
    62606275          irel->r_info = ELF32_R_INFO (ELF32_R_SYM (irel->r_info),
    62616276                                       stub_rtype);
    62626277          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)
    62646280            irel->r_addend = 0;
    62656281
    62666282          /* Record the fixup so we don't do it again this section.  */
     
    64306446    {
    64316447      /* Convert the internal relax relocs to external form.  */
    64326448      for (irel = internal_relocs; irel < irelend; irel++)
    6433         if (ELF32_R_TYPE (irel->r_info) == R_PPC_RELAX32)
     6449        if (ELF32_R_TYPE (irel->r_info) == R_PPC_RELAX)
    64346450          {
    64356451            unsigned long r_symndx = ELF32_R_SYM (irel->r_info);
    64366452
     
    69146930                  insn1 |= 32 << 26;    /* lwz */
    69156931                  if (offset != (bfd_vma) -1)
    69166932                    {
    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);
    69206934                      insn2 = 0x7c631214;       /* add 3,3,2 */
    69216935                      bfd_put_32 (output_bfd, insn2, contents + offset);
    69226936                    }
     
    69907004              bfd_put_32 (output_bfd, insn2, contents + offset);
    69917005              /* Zap the reloc on the _tls_get_addr call too.  */
    69927006              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);
    69957008            }
    69967009          break;
    69977010
     
    70207033                          contents + rel->r_offset - d_offset);
    70217034              /* Zap the reloc on the _tls_get_addr call too.  */
    70227035              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);
    70257037              rel--;
    70267038              continue;
    70277039            }
     
    76537665            }
    76547666          break;
    76557667
    7656         case R_PPC_RELAX32PC_PLT:
    7657         case R_PPC_RELAX32_PLT:
     7668        case R_PPC_RELAX_PLT:
     7669        case R_PPC_RELAX_PLTREL24:
    76587670          if (h != NULL)
    76597671            {
    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);
    76627682              if (htab->plt_type == PLT_NEW)
    76637683                relocation = (htab->glink->output_section->vma
    76647684                              + htab->glink->output_offset
     
    76687688                              + htab->plt->output_offset
    76697689                              + ent->plt.offset);
    76707690            }
    7671           if (r_type == R_PPC_RELAX32_PLT)
    7672             goto relax32;
    76737691          /* Fall thru */
    76747692
    7675         case R_PPC_RELAX32PC:
    7676           relocation -= (input_section->output_section->vma
    7677                          + input_section->output_offset
    7678                          + 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);
    76807698
    7681         case R_PPC_RELAX32:
    7682         relax32:
    76837699          {
    76847700            unsigned long t0;
    76857701            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  
    331331
    332332  /* How much memory we have.  */
    333333  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
    344335  /* Count of overlay stubs needed in non-overlay area.  */
    345336  unsigned int non_ovly_stub;
    346337
     
    26922683      Elf_Internal_Sym *sym;
    26932684      struct elf_link_hash_entry *h;
    26942685      bfd_vma val;
    2695       bfd_boolean reject, is_call;
     2686      bfd_boolean nonbranch, is_call;
    26962687      struct function_info *caller;
    26972688      struct call_info *callee;
    26982689
    2699       reject = FALSE;
    27002690      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;
    27082692
    27092693      r_indx = ELF32_R_SYM (irela->r_info);
    27102694      if (!get_sym_h (&h, &sym, &sym_sec, psyms, r_indx, sec->owner))
     
    27152699        continue;
    27162700
    27172701      is_call = FALSE;
    2718       if (!reject)
     2702      if (!nonbranch)
    27192703        {
    27202704          unsigned char insn[4];
    27212705
     
    27462730            }
    27472731          else
    27482732            {
    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))
    27522735                continue;
    27532736            }
    27542737        }
    27552738
    2756       if (reject)
     2739      if (nonbranch)
    27572740        {
    27582741          /* For --auto-overlay, count possible stubs we need for
    27592742             function pointer references.  */
     
    27632746          else
    27642747            sym_type = ELF_ST_TYPE (sym->st_info);
    27652748          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.  */
    27682763        }
    27692764
    27702765      if (h)
     
    28132808      callee->is_pasted = FALSE;
    28142809      callee->broken_cycle = FALSE;
    28152810      callee->priority = priority;
    2816       callee->count = 1;
     2811      callee->count = nonbranch? 0 : 1;
    28172812      if (callee->fun->last_caller != sec)
    28182813        {
    28192814          callee->fun->last_caller = sec;
     
    41594154  bfd **bfd_arr;
    41604155  struct elf_segment_map *m;
    41614156  unsigned int fixed_size, lo, hi;
     4157  unsigned int reserved;
    41624158  struct spu_link_hash_table *htab;
    41634159  unsigned int base, i, count, bfd_count;
    41644160  unsigned int region, ovlynum;
     
    41944190    goto err_exit;
    41954191
    41964192  htab = spu_hash_table (info);
    4197   if (htab->reserved == 0)
     4193  reserved = htab->params->auto_overlay_reserved;
     4194  if (reserved == 0)
    41984195    {
    41994196      struct _sum_stack_param sum_stack_param;
    42004197
     
    42024199      sum_stack_param.overall_stack = 0;
    42034200      if (!for_each_node (sum_stack, info, &sum_stack_param, TRUE))
    42044201        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);
    42064204    }
    42074205
    42084206  /* No need for overlays if everything already fits.  */
    4209   if (fixed_size + htab->reserved <= htab->local_store
     4207  if (fixed_size + reserved <= htab->local_store
    42104208      && htab->params->ovly_flavour != ovly_soft_icache)
    42114209    {
    42124210      htab->params->auto_overlay = 0;
     
    43194317    }
    43204318  free (bfd_arr);
    43214319
    4322   fixed_size += htab->reserved;
     4320  fixed_size += reserved;
    43234321  fixed_size += htab->non_ovly_stub * ovl_stub_size (htab->params);
    43244322  if (fixed_size + mos_param.max_overlay_size <= htab->local_store)
    43254323    {
     
    43584356                            (bfd_vma) mos_param.max_overlay_size);
    43594357
    43604358  /* 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)
    43624360    {
    43634361      unsigned int max_fixed, lib_size;
    43644362
    43654363      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;
    43684366      lib_size = max_fixed - fixed_size;
    43694367      lib_size = auto_ovl_lib_functions (info, lib_size);
    43704368      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  
    33   2009 Free Software Foundation, Inc.
    44   Written by Linus Nordberg, Swox AB <info@swox.com>,
    55   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.
    77
    88   This file is part of BFD, the Binary File Descriptor library.
    99
     
    58665866              for (ent = h->plt.plist; ent != NULL; ent = ent->next)
    58675867                if (ent->addend == rel->r_addend)
    58685868                  break;
    5869               if (ent == NULL)
    5870                 abort ();
    5871               if (ent->plt.refcount > 0)
     5869              if (ent != NULL && ent->plt.refcount > 0)
    58725870                ent->plt.refcount -= 1;
    58735871            }
    58745872          break;
     
    1112911127                  insn1 |= 58 << 26;    /* ld */
    1113011128                  insn2 = 0x7c636a14;   /* add 3,3,13 */
    1113111129                  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);
    1113411131                  if ((tls_mask & TLS_EXPLICIT) == 0)
    1113511132                    r_type = (((r_type - (R_PPC64_GOT_TLSGD16 & 3)) & 3)
    1113611133                              + R_PPC64_GOT_TPREL16_DS);
     
    1122911226              rel->r_info = ELF64_R_INFO (r_symndx, r_type);
    1123011227              /* Zap the reloc on the _tls_get_addr call too.  */
    1123111228              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);
    1123411230              insn3 = bfd_get_32 (output_bfd,
    1123511231                                  contents + offset + 4);
    1123611232              if (insn3 == NOP
     
    1127511271              rel->r_offset = offset + d_offset;
    1127611272              /* Zap the reloc on the _tls_get_addr call too.  */
    1127711273              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);
    1128011275              insn2 = 0x38630000;       /* addi 3,3,0 */
    1128111276              insn3 = bfd_get_32 (output_bfd,
    1128211277                                  contents + offset + 4);
  • bfd/Makefile.in

    diff -Naur binutils-2.20.orig/bfd/Makefile.in binutils-2.20/bfd/Makefile.in
    old new  
    224224PACKAGE_URL = @PACKAGE_URL@
    225225PACKAGE_VERSION = @PACKAGE_VERSION@
    226226PATH_SEPARATOR = @PATH_SEPARATOR@
    227 PKGVERSION = @PKGVERSION@
     227PKGVERSION = (GNU Binutils for Cross-LFS - Retrieved on 20100101)
    228228POSUB = @POSUB@
    229229RANLIB = @RANLIB@
    230230REPORT_BUGS_TEXI = @REPORT_BUGS_TEXI@
     
    317317ACLOCAL_AMFLAGS = -I . -I .. -I ../config
    318318
    319319# Uncomment the following line when doing a release.
    320 RELEASE = y
     320RELEASE=y
    321321INCDIR = $(srcdir)/../include
    322322CSEARCH = -I. -I$(srcdir) -I$(INCDIR)
    323323SUBDIRS = doc po
  • bfd/opncls.c

    diff -Naur binutils-2.20.orig/bfd/opncls.c binutils-2.20/bfd/opncls.c
    old new  
    635635  /* If the file was open for writing and is now executable,
    636636     make it so.  */
    637637  if (abfd->direction == write_direction
    638       && abfd->flags & EXEC_P)
     638      && (abfd->flags & (EXEC_P | DYNAMIC)) != 0)
    639639    {
    640640      struct stat buf;
    641641
  • 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 20091016
     1#define BFD_VERSION_DATE 20100101
    22#define BFD_VERSION @bfd_version@
    33#define BFD_VERSION_STRING  @bfd_version_package@ @bfd_version_string@
    44#define REPORT_BUGS_TO @report_bugs_to@
  • binutils/ChangeLog

    diff -Naur binutils-2.20.orig/binutils/ChangeLog binutils-2.20/binutils/ChangeLog
    old new  
     12009-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
     72009-10-23  Thomas Cougnard  <thomas.cougnard@gmail.com>
     8
     9        * readelf.c (dynamic_info): Correct size of array.
     10
     112009-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
    1212009-10-01  Alan Modra  <amodra@bigpond.net.au>
    222
    323        * 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  
    31623162static void
    31633163dll_name_list_append (dll_name_list_type * list, bfd_byte * data)
    31643164{
     3165  dll_name_list_node_type * entry;
     3166
    31653167  /* Error checking.  */
    31663168  if (! list || ! list->tail)
    31673169    return;
    31683170
    31693171  /* 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)));
    31723174
    31733175  /* Initialize its values.  */
    31743176  entry->dllname = xstrdup ((char *) data);
     
    31843186static int
    31853187dll_name_list_count (dll_name_list_type * list)
    31863188{
     3189  dll_name_list_node_type * p;
     3190  int count = 0;
     3191
    31873192  /* Error checking.  */
    31883193  if (! list || ! list->head)
    31893194    return 0;
    31903195
    3191   int count = 0;
    3192   dll_name_list_node_type * p = list->head;
     3196  p = list->head;
    31933197
    31943198  while (p && p->next)
    31953199    {
     
    32043208static void
    32053209dll_name_list_print (dll_name_list_type * list)
    32063210{
     3211  dll_name_list_node_type * p;
     3212
    32073213  /* Error checking.  */
    32083214  if (! list || ! list->head)
    32093215    return;
    32103216
    3211   dll_name_list_node_type * p = list->head;
     3217  p = list->head;
    32123218
    32133219  while (p && p->next && p->next->dllname && *(p->next->dllname))
    32143220    {
  • binutils/MAINTAINERS

    diff -Naur binutils-2.20.orig/binutils/MAINTAINERS binutils-2.20/binutils/MAINTAINERS
    old new  
    3838  Jeff Law <law@redhat.com>
    3939  Jim Wilson <wilson@tuliptree.org>
    4040  DJ Delorie <dj@redhat.com>
    41   Alan Modra <amodra@bigpond.net.au>
     41  Alan Modra <amodra@gmail.com>
    4242  Michael Meissner <gnu@the-meissners.org>
    4343  Daniel Jacobowitz <dan@debian.org>
    4444  Richard Sandiford <rdsandiford@googlemail.com>
     
    7777  FRV              Alexandre Oliva <aoliva@redhat.com>
    7878  H8300            Prafulla Thakare <prafulla.thakare@kpitcummins.com>
    7979  HPPA             Dave Anglin <dave.anglin@nrc.ca>
    80   HPPA elf32       Alan Modra <amodra@bigpond.net.au>
     80  HPPA elf32       Alan Modra <amodra@gmail.com>
    8181  HPPA elf64       Jeff Law <law@redhat.com> [Basic maintainance only]
    8282  IA-64            Jim Wilson <wilson@tuliptree.org>
    8383  IQ2000           Stan Cox <scox@redhat.com>
     
    102102  MSP430           Dmitry Diky <diwil@spec.ru>
    103103  NetBSD support   Matt Thomas <matt@netbsd.org>
    104104  PPC              Geoff Keating <geoffk@geoffk.org>
    105   PPC              Alan Modra <amodra@bigpond.net.au>
     105  PPC              Alan Modra <amodra@gmail.com>
    106106  PPC vector ext   Aldy Hernandez <aldyh@redhat.com>
    107107  s390, s390x      Martin Schwidefsky <schwidefsky@de.ibm.com>
    108108  SCORE            Mei Ligang <ligang@sunnorth.com.cn>
    109109  SH               Alexandre Oliva <aoliva@redhat.com>
    110110  SH               Kaz Kojima <kkojima@rr.iij4u.or.jp>
    111111  SPARC            Jakub Jelinek <jakub@redhat.com>
    112   SPU              Alan Modra <amodra@bigpond.net.au>
     112  SPU              Alan Modra <amodra@gmail.com>
    113113  TESTSUITES       Ben Elliston <bje@gnu.org>
    114114  TIC4X            Svein Seldal <svein@dev.seldal.com>
    115115  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  
    12371237           filename, strerror (errno));
    12381238
    12391239  bufsize = 100;
    1240   buf = (char *) xmalloc (bufsize);
     1240  buf = (char *) xmalloc (bufsize + 1 /* For the terminating NUL.  */);
    12411241
    12421242  lineno = 1;
    12431243  c = getc (file);
     
    12541254          if (len >= bufsize)
    12551255            {
    12561256              bufsize *= 2;
    1257               buf = (char *) xrealloc (buf, bufsize);
     1257              buf = (char *) xrealloc (buf, bufsize + 1);
    12581258            }
    12591259          c = getc (file);
    12601260        }
     
    12801280          if (len >= bufsize)
    12811281            {
    12821282              bufsize *= 2;
    1283               buf = (char *) xrealloc (buf, bufsize);
     1283              buf = (char *) xrealloc (buf, bufsize + 1);
    12841284            }
    12851285          c = getc (file);
    12861286        }
  • binutils/prdbg.c

    diff -Naur binutils-2.20.orig/binutils/prdbg.c binutils-2.20/binutils/prdbg.c
    old new  
    20882088static bfd_boolean
    20892089tg_end_struct_type (void *p ATTRIBUTE_UNUSED)
    20902090{
    2091   struct pr_handle *info = (struct pr_handle *) p;
    2092   assert (info->stack != NULL);
     2091  assert (((struct pr_handle *) p)->stack != NULL);
    20932092
    20942093  return TRUE;
    20952094}
  • binutils/readelf.c

    diff -Naur binutils-2.20.orig/binutils/readelf.c binutils-2.20/binutils/readelf.c
    old new  
    165165static unsigned long dynamic_syminfo_offset;
    166166static unsigned int dynamic_syminfo_nent;
    167167static char program_interpreter[PATH_MAX];
    168 static bfd_vma dynamic_info[DT_JMPREL + 1];
     168static bfd_vma dynamic_info[DT_ENCODING];
    169169static bfd_vma dynamic_info_DT_GNU_HASH;
    170170static bfd_vma version_info[16];
    171171static Elf_Internal_Ehdr elf_header;
  • configure.ac

    diff -Naur binutils-2.20.orig/configure.ac binutils-2.20/configure.ac
    old new  
    169169# binutils, gas and ld appear in that order because it makes sense to run
    170170# "make check" in that particular order.
    171171# 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"
     172host_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"
    173173
    174174# libgcj represents the runtime libraries only used by gcj.
    175175libgcj="target-libffi \
  • binutils-2.20

    diff -Naur binutils-2.20.orig/gas/as.h binutils-2.20/gas/as.h
    old new  
    238238#define know(p) gas_assert(p)   /* Verify our assumptions!  */
    239239#endif /* not yet defined */
    240240#else
    241 #define know(p)                 /* know() checks are no-op.ed  */
     241#define know(p) do {} while (0) /* know() checks are no-op.ed  */
    242242#endif
    243243
    244244
  • gas/ChangeLog

     /* input_scrub.c */
    diff -Naur binutils-2.20.orig/gas/ChangeLog binutils-2.20/gas/ChangeLog
    old new  
     12009-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
     132009-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
     252009-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
     332009-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
     402009-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
    1452009-10-13  Alan Modra  <amodra@bigpond.net.au>
    246            H.J. Lu  <hongjiu.lu@intel.com>
    347
  • 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  
    24862486      frag->tc_frag_data.first_map = symbolP;
    24872487    }
    24882488  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    }
    24902492  frag->tc_frag_data.last_map = symbolP;
    24912493}
    24922494
     
    1938119383  return FALSE;
    1938219384}
    1938319385
     19386/* Encode Thumb2 unconditional branches and calls. The encoding
     19387   for the 2 are identical for the immediate values.  */
     19388
     19389static void
     19390encode_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
    1938419411void
    1938519412md_apply_fix (fixS *    fixP,
    1938619413               valueT * valP,
     
    2007320100         fixP->fx_r_type = BFD_RELOC_THUMB_PCREL_BRANCH23;
    2007420101#endif
    2007520102
    20076       if ((value & ~0x3fffff) && ((value & ~0x3fffff) != ~0x3fffff))
    20077         as_bad_where (fixP->fx_file, fixP->fx_line,
    20078                       _("branch out of range"));
    20079 
    2008020103      if (fixP->fx_r_type == BFD_RELOC_THUMB_PCREL_BLX)
    2008120104        /* For a BLX instruction, make sure that the relocation is rounded up
    2008220105           to a word boundary.  This follows the semantics of the instruction
     
    2008420107           1 of the base address.  */
    2008520108        value = (value + 1) & ~ 1;
    2008620109
     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
    2008720128      if (fixP->fx_done || !seg->use_rela_p)
    2008820129        {
    2008920130          offsetT newval2;
     
    2010420145
    2010520146      if (fixP->fx_done || !seg->use_rela_p)
    2010620147        {
    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);
    2012520149        }
    2012620150      break;
    2012720151
  • binutils-2.20

    diff -Naur binutils-2.20.orig/gas/expr.c binutils-2.20/gas/expr.c
    old new  
    19971997  /* Help out with CSE.  */
    19981998  valueT final_val = expressionP->X_add_number;
    19991999  symbolS *add_symbol = expressionP->X_add_symbol;
     2000  symbolS *orig_add_symbol = add_symbol;
    20002001  symbolS *op_symbol = expressionP->X_op_symbol;
    20012002  operatorT op = expressionP->X_op;
    20022003  valueT left, right;
     
    20782079              left = right;
    20792080              seg_left = seg_right;
    20802081              add_symbol = op_symbol;
     2082              orig_add_symbol = expressionP->X_op_symbol;
    20812083              op = O_symbol;
    20822084              break;
    20832085            }
     
    21222124            {
    21232125              if (op == O_bit_exclusive_or || op == O_bit_inclusive_or)
    21242126                {
    2125                   if (seg_right != absolute_section || right != 0)
     2127                  if (!(seg_right == absolute_section && right == 0))
    21262128                    {
    21272129                      seg_left = seg_right;
    21282130                      left = right;
    21292131                      add_symbol = op_symbol;
     2132                      orig_add_symbol = expressionP->X_op_symbol;
    21302133                    }
    21312134                  op = O_symbol;
    21322135                  break;
    21332136                }
    21342137              else if (op == O_left_shift || op == O_right_shift)
    21352138                {
    2136                   if (seg_left != absolute_section || left != 0)
     2139                  if (!(seg_left == absolute_section && left == 0))
    21372140                    {
    21382141                      op = O_symbol;
    21392142                      break;
     
    21492152              seg_left = seg_right;
    21502153              left = right;
    21512154              add_symbol = op_symbol;
     2155              orig_add_symbol = expressionP->X_op_symbol;
    21522156              op = O_symbol;
    21532157              break;
    21542158            }
     
    21582162              op = O_symbol;
    21592163              break;
    21602164            }
    2161           else if (left != right
    2162                    || ((seg_left != reg_section || seg_right != reg_section)
    2163                        && (seg_left != undefined_section
    2164                            || seg_right != undefined_section
    2165                            || 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))))
    21662170            return 0;
    21672171          else if (op == O_bit_and || op == O_bit_inclusive_or)
    21682172            {
     
    22332237        op = O_constant;
    22342238      else if (seg_left == reg_section && final_val == 0)
    22352239        op = O_register;
    2236       else if (add_symbol != expressionP->X_add_symbol)
     2240      else if (!symbol_same_p (add_symbol, orig_add_symbol))
    22372241        final_val += left;
    22382242      expressionP->X_add_symbol = add_symbol;
    22392243    }
  • gas/symbols.c

    diff -Naur binutils-2.20.orig/gas/symbols.c binutils-2.20/gas/symbols.c
    old new  
    23852385  S_CLEAR_WEAKREFR (s);
    23862386}
    23872387
     2388/* Return whether 2 symbols are the same.  */
     2389
     2390int
     2391symbol_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
    23882402/* Return a pointer to the X_add_number component of a symbol.  */
    23892403
    23902404offsetT *
  • gas/symbols.h

    diff -Naur binutils-2.20.orig/gas/symbols.h binutils-2.20/gas/symbols.h
    old new  
    198198extern int symbol_shadow_p (symbolS *);
    199199extern asymbol *symbol_get_bfdsym (symbolS *);
    200200extern void symbol_set_bfdsym (symbolS *, asymbol *);
     201extern int symbol_same_p (symbolS *, symbolS *);
    201202
    202203#ifdef OBJ_SYMFIELD_TYPE
    203204OBJ_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  
     12009-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
    1202009-10-02  Peter Bergner  <bergner@vnet.ibm.com>
    221
    322        * 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  
    66
    77Disassembly of section .text:
    88
    9 0+000 <gs_foo>:
    10    0:   c3 [    ]*ret   
     90+ <gs_foo>:
     10[       ]*[a-f0-9]+:    c3                      ret   
    1111
    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 [       ]*...
     120+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
     210+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
     250+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  
    77bar:
    88 lea    eax, .LC0@GOTOFF[ebx]
    99 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
     19L11:
     20        jmp     DWORD PTR[ L11  + eax * 4 + 0x1000 ]
     21        jmp     DWORD PTR[ L12  + eax * 4 + 0x1000 ]
     22L12:
     23        nop
  • binutils-2.20

    diff -Naur binutils-2.20.orig/gold/arm.cc binutils-2.20/gold/arm.cc
    old new  
    10751075      os = layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS,
    10761076                                           (elfcpp::SHF_ALLOC
    10771077                                            | elfcpp::SHF_WRITE),
    1078                                            this->got_);
     1078                                           this->got_, false);
    10791079      os->set_is_relro();
    10801080
    10811081      // The old GNU linker creates a .got.plt section.  We just
     
    10861086      os = layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS,
    10871087                                           (elfcpp::SHF_ALLOC
    10881088                                            | elfcpp::SHF_WRITE),
    1089                                            this->got_plt_);
     1089                                           this->got_plt_, false);
    10901090      os->set_is_relro();
    10911091
    10921092      // The first three entries are reserved.
     
    11141114      gold_assert(layout != NULL);
    11151115      this->rel_dyn_ = new Reloc_section(parameters->options().combreloc());
    11161116      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);
    11181118    }
    11191119  return this->rel_dyn_;
    11201120}
     
    11861186{
    11871187  this->rel_ = new Reloc_section(false);
    11881188  layout->add_output_section_data(".rel.plt", elfcpp::SHT_REL,
    1189                                   elfcpp::SHF_ALLOC, this->rel_);
     1189                                  elfcpp::SHF_ALLOC, this->rel_, true);
    11901190}
    11911191
    11921192template<bool big_endian>
     
    13481348      layout->add_output_section_data(".plt", elfcpp::SHT_PROGBITS,
    13491349                                      (elfcpp::SHF_ALLOC
    13501350                                       | elfcpp::SHF_EXECINSTR),
    1351                                       this->plt_);
     1351                                      this->plt_, false);
    13521352    }
    13531353  this->plt_->add_entry(gsym);
    13541354}
     
    18311831  Output_data_dynamic* const odyn = layout->dynamic_data();
    18321832  if (odyn != NULL)
    18331833    {
    1834       if (this->got_plt_ != NULL)
     1834      if (this->got_plt_ != NULL
     1835          && this->got_plt_->output_section() != NULL)
    18351836        odyn->add_section_address(elfcpp::DT_PLTGOT, this->got_plt_);
    18361837
    1837       if (this->plt_ != NULL)
     1838      if (this->plt_ != NULL
     1839          && this->plt_->output_section() != NULL)
    18381840        {
    18391841          const Output_data* od = this->plt_->rel_plt();
    18401842          odyn->add_section_size(elfcpp::DT_PLTRELSZ, od);
     
    18421844          odyn->add_constant(elfcpp::DT_PLTREL, elfcpp::DT_REL);
    18431845        }
    18441846
    1845       if (this->rel_dyn_ != NULL)
     1847      if (this->rel_dyn_ != NULL
     1848          && this->rel_dyn_->output_section() != NULL)
    18461849        {
    18471850          const Output_data* od = this->rel_dyn_;
    18481851          odyn->add_section_address(elfcpp::DT_REL, od);
     
    18791882                      == NULL);
    18801883          Output_segment*  exidx_segment =
    18811884            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);
    18831887        }
    18841888    }
    18851889}
  • gold/ChangeLog

    diff -Naur binutils-2.20.orig/gold/ChangeLog binutils-2.20/gold/ChangeLog
    old new  
     12009-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
     152009-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
     202009-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
     262009-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
     372009-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
     472009-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
     652009-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
     772009-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
     832009-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
     912009-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
    1962009-10-15  Ian Lance Taylor  <iant@google.com>
    297
    398        * 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  
    239239  Output_data_space *poc = new Output_data_space(addralign, ds_name);
    240240  Output_section *os = layout->add_output_section_data(name,
    241241                                                       elfcpp::SHT_NOBITS,
    242                                                        flags, poc);
     242                                                       flags, poc, false);
    243243  if (os != NULL)
    244244    {
    245245      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  
    138138      layout->add_output_section_data(".bss",
    139139                                      elfcpp::SHT_NOBITS,
    140140                                      elfcpp::SHF_ALLOC | elfcpp::SHF_WRITE,
    141                                       this->dynbss_);
     141                                      this->dynbss_, false);
    142142    }
    143143
    144144  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  
    107107    0,                          // nonvis
    108108    true,                       // offset_is_from_end
    109109    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  },
    111171};
    112172
    113173const int in_section_count = sizeof in_section / sizeof in_section[0];
     
    238298    elfcpp::STV_DEFAULT,        // visibility
    239299    0,                          // nonvis
    240300    Symbol::SEGMENT_END,        // offset_from_base
    241     false                       // only_if_ref
     301    true                        // only_if_ref
    242302  }
    243303};
    244304
  • gold/dynobj.cc

    diff -Naur binutils-2.20.orig/gold/dynobj.cc binutils-2.20/gold/dynobj.cc
    old new  
    13001300Versions::Versions(const Version_script_info& version_script,
    13011301                   Stringpool* dynpool)
    13021302  : 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())
    13041305{
    1305   // We always need a base version, so define that first.  Nothing
    1306   // explicitly declares itself as part of base, so it doesn't need to
    1307   // 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 
    13191306  if (!this->version_script_.empty())
    13201307    {
    13211308      // Parse the version script, and insert each declared version into
    13221309      // defs_ and version_table_.
    13231310      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
    13241315      for (size_t k = 0; k < versions.size(); ++k)
    13251316        {
    13261317          Stringpool::Key version_key;
     
    13501341    delete *p;
    13511342}
    13521343
     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
     1349void
     1350Versions::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
    13531366// Return the dynamic object which a symbol refers to.
    13541367
    13551368Dynobj*
     
    14211434      if (parameters->options().shared())
    14221435        gold_error(_("symbol %s has undefined version %s"),
    14231436                   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       
    14251441      // When creating a regular executable, automatically define
    14261442      // a new version.
    14271443      Verdef* vd = new Verdef(version, std::vector<std::string>(),
     
    14681484
    14691485  if (vn == NULL)
    14701486    {
     1487      // Create base version definition lazily for shared library.
     1488      if (this->needs_base_version_)
     1489        this->define_base_version(dynpool);
     1490
    14711491      // We have a new filename.
    14721492      vn = new Verneed(filename);
    14731493      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  
    584584  version_index(const Symbol_table*, const Stringpool*,
    585585                const Symbol* sym) const;
    586586
     587  // Define the base version of a shared library.
     588  void
     589  define_base_version(Stringpool* dynpool);
     590
    587591  // We keep a hash table mapping canonicalized name/version pairs to
    588592  // a version base.
    589593  typedef std::pair<Stringpool::Key, Stringpool::Key> Key;
     
    616620  bool is_finalized_;
    617621  // Contents of --version-script, if passed, or NULL.
    618622  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_;
    619626};
    620627
    621628} // End namespace gold.
  • gold/i386.cc

    diff -Naur binutils-2.20.orig/gold/i386.cc binutils-2.20/gold/i386.cc
    old new  
    464464      os = layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS,
    465465                                           (elfcpp::SHF_ALLOC
    466466                                            | elfcpp::SHF_WRITE),
    467                                            this->got_);
     467                                           this->got_, false);
    468468      os->set_is_relro();
    469469
    470470      // The old GNU linker creates a .got.plt section.  We just
     
    475475      os = layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS,
    476476                                           (elfcpp::SHF_ALLOC
    477477                                            | elfcpp::SHF_WRITE),
    478                                            this->got_plt_);
     478                                           this->got_plt_, false);
    479479      os->set_is_relro();
    480480
    481481      // The first three entries are reserved.
     
    503503      gold_assert(layout != NULL);
    504504      this->rel_dyn_ = new Reloc_section(parameters->options().combreloc());
    505505      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);
    507507    }
    508508  return this->rel_dyn_;
    509509}
     
    578578{
    579579  this->rel_ = new Reloc_section(false);
    580580  layout->add_output_section_data(".rel.plt", elfcpp::SHT_REL,
    581                                   elfcpp::SHF_ALLOC, this->rel_);
     581                                  elfcpp::SHF_ALLOC, this->rel_, true);
    582582}
    583583
    584584void
     
    763763      layout->add_output_section_data(".plt", elfcpp::SHT_PROGBITS,
    764764                                      (elfcpp::SHF_ALLOC
    765765                                       | elfcpp::SHF_EXECINSTR),
    766                                       this->plt_);
     766                                      this->plt_, false);
    767767    }
    768768
    769769  this->plt_->add_entry(gsym);
     
    15691569  Output_data_dynamic* const odyn = layout->dynamic_data();
    15701570  if (odyn != NULL)
    15711571    {
    1572       if (this->got_plt_ != NULL)
     1572      if (this->got_plt_ != NULL
     1573          && this->got_plt_->output_section() != NULL)
    15731574        odyn->add_section_address(elfcpp::DT_PLTGOT, this->got_plt_);
    15741575
    1575       if (this->plt_ != NULL)
     1576      if (this->plt_ != NULL
     1577          && this->plt_->output_section() != NULL)
    15761578        {
    15771579          const Output_data* od = this->plt_->rel_plt();
    15781580          odyn->add_section_size(elfcpp::DT_PLTRELSZ, od);
     
    15801582          odyn->add_constant(elfcpp::DT_PLTREL, elfcpp::DT_REL);
    15811583        }
    15821584
    1583       if (this->rel_dyn_ != NULL)
     1585      if (this->rel_dyn_ != NULL
     1586          && this->rel_dyn_->output_section() != NULL)
    15841587        {
    15851588          const Output_data* od = this->rel_dyn_;
    15861589          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  
    388388
    389389// Return the output section to use for section NAME with type TYPE
    390390// 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.
    392394
    393395Output_section*
    394396Layout::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)
    396399{
    397400  elfcpp::Elf_Xword lookup_flags = flags;
    398401
     
    441444        }
    442445
    443446      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);
    445449      ins.first->second = os;
    446450      return os;
    447451    }
     
    451455// RELOBJ, with type TYPE and flags FLAGS.  RELOBJ may be NULL for a
    452456// linker created section.  IS_INPUT_SECTION is true if we are
    453457// 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.
    456462
    457463Output_section*
    458464Layout::choose_output_section(const Relobj* relobj, const char* name,
    459465                              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)
    461468{
    462469  // We should not see any input sections after we have attached
    463470  // sections to segments.
     
    505512
    506513          name = this->namepool_.add(name, false, NULL);
    507514
    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);
    509518          os->set_found_in_sections_clause();
    510519          *output_section_slot = os;
    511520          return os;
     
    528537
    529538  // Find or make the output section.  The output section is selected
    530539  // 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);
    532542}
    533543
    534544// Return the output section to use for input section SHNDX, with name
     
    561571    {
    562572      name = this->namepool_.add(name, true, NULL);
    563573      os = this->make_output_section(name, shdr.get_sh_type(),
    564                                      shdr.get_sh_flags());
     574                                     shdr.get_sh_flags(), false, false);
    565575    }
    566576  else
    567577    {
    568578      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);
    570581      if (os == NULL)
    571582        return NULL;
    572583    }
     
    617628  Output_section* os = this->choose_output_section(object, name.c_str(),
    618629                                                   sh_type,
    619630                                                   shdr.get_sh_flags(),
    620                                                    false);
     631                                                   false, false, false);
    621632
    622633  os->set_should_link_to_symtab();
    623634  os->set_info_section(data_section);
     
    664675  group_section_name = this->namepool_.add(group_section_name, true, NULL);
    665676  Output_section* os = this->make_output_section(group_section_name,
    666677                                                 elfcpp::SHT_GROUP,
    667                                                  shdr.get_sh_flags());
     678                                                 shdr.get_sh_flags(),
     679                                                 false, false);
    668680
    669681  // We need to find a symbol with the signature in the symbol table.
    670682  // If we don't find one now, we need to look again later.
     
    718730                                                   name,
    719731                                                   elfcpp::SHT_PROGBITS,
    720732                                                   elfcpp::SHF_ALLOC,
    721                                                    false);
     733                                                   false, false, false);
    722734  if (os == NULL)
    723735    return NULL;
    724736
     
    734746                                        ".eh_frame_hdr",
    735747                                        elfcpp::SHT_PROGBITS,
    736748                                        elfcpp::SHF_ALLOC,
    737                                         false);
     749                                        false, false, false);
    738750
    739751          if (hdr_os != NULL)
    740752            {
     
    749761                  Output_segment* hdr_oseg;
    750762                  hdr_oseg = this->make_output_segment(elfcpp::PT_GNU_EH_FRAME,
    751763                                                       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);
    753765                }
    754766
    755767              this->eh_frame_data_->set_eh_frame_hdr(hdr_posd);
     
    800812Output_section*
    801813Layout::add_output_section_data(const char* name, elfcpp::Elf_Word type,
    802814                                elfcpp::Elf_Xword flags,
    803                                 Output_section_data* posd)
     815                                Output_section_data* posd,
     816                                bool is_dynamic_linker_section)
    804817{
    805818  Output_section* os = this->choose_output_section(NULL, name, type, flags,
    806                                                    false);
     819                                                   false, false,
     820                                                   is_dynamic_linker_section);
    807821  if (os != NULL)
    808822    os->add_output_section_data(posd);
    809823  return os;
     
    838852}
    839853
    840854// 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.
    842858
    843859Output_section*
    844860Layout::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)
    846863{
    847864  Output_section* os;
    848865  if ((flags & elfcpp::SHF_ALLOC) == 0
     
    850867      && is_compressible_debug_section(name))
    851868    os = new Output_compressed_section(&parameters->options(), name, type,
    852869                                       flags);
    853 
    854870  else if ((flags & elfcpp::SHF_ALLOC) == 0
    855871           && parameters->options().strip_debug_non_line()
    856872           && strcmp(".debug_abbrev", name) == 0)
     
    876892      os = target->make_output_section(name, type, flags);
    877893    }
    878894
     895  if (is_interp)
     896    os->set_is_interp();
     897  if (is_dynamic_linker_section)
     898    os->set_is_dynamic_linker_section();
     899
    879900  parameters->target().new_output_section(os);
    880901
    881902  this->section_list_.push_back(os);
     
    971992
    972993  elfcpp::Elf_Word seg_flags = Layout::section_flags_to_segment(flags);
    973994
     995  bool sort_sections = !this->script_options_->saw_sections_clause();
     996
    974997  // In general the only thing we really care about for PT_LOAD
    975998  // segments is whether or not they are writable, so that is how we
    976999  // search for them.  Large data sections also go into their own
     
    9981021      if (os->is_large_data_section() && !(*p)->is_large_data_segment())
    9991022        continue;
    10001023
    1001       (*p)->add_output_section(os, seg_flags);
     1024      (*p)->add_output_section(os, seg_flags, sort_sections);
    10021025      break;
    10031026    }
    10041027
     
    10081031                                                       seg_flags);
    10091032      if (os->is_large_data_section())
    10101033        oseg->set_is_large_data_segment();
    1011       oseg->add_output_section(os, seg_flags);
     1034      oseg->add_output_section(os, seg_flags, sort_sections);
    10121035    }
    10131036
    10141037  // If we see a loadable SHT_NOTE section, we create a PT_NOTE
     
    10241047              && (((*p)->flags() & elfcpp::PF_W)
    10251048                  == (seg_flags & elfcpp::PF_W)))
    10261049            {
    1027               (*p)->add_output_section(os, seg_flags);
     1050              (*p)->add_output_section(os, seg_flags, false);
    10281051              break;
    10291052            }
    10301053        }
     
    10331056        {
    10341057          Output_segment* oseg = this->make_output_segment(elfcpp::PT_NOTE,
    10351058                                                           seg_flags);
    1036           oseg->add_output_section(os, seg_flags);
     1059          oseg->add_output_section(os, seg_flags, false);
    10371060        }
    10381061    }
    10391062
     
    10431066    {
    10441067      if (this->tls_segment_ == NULL)
    10451068        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);
    10471070    }
    10481071
    10491072  // If -z relro is in effect, and we see a relro section, we create a
     
    10531076      gold_assert(seg_flags == (elfcpp::PF_R | elfcpp::PF_W));
    10541077      if (this->relro_segment_ == NULL)
    10551078        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);
    10571080    }
    10581081}
    10591082
     
    10641087{
    10651088  name = this->namepool_.add(name, false, NULL);
    10661089  Output_section* os = this->make_output_section(name, elfcpp::SHT_PROGBITS,
    1067                                                  elfcpp::SHF_ALLOC);
     1090                                                 elfcpp::SHF_ALLOC, false,
     1091                                                 false);
    10681092  os->set_found_in_sections_clause();
    10691093  return os;
    10701094}
     
    11341158                                                       elfcpp::SHT_DYNAMIC,
    11351159                                                       (elfcpp::SHF_ALLOC
    11361160                                                        | elfcpp::SHF_WRITE),
    1137                                                        false);
     1161                                                       false, false, true);
    11381162  this->dynamic_section_->set_is_relro();
    11391163
    11401164  symtab->define_in_output_data("_DYNAMIC", NULL, this->dynamic_section_, 0, 0,
     
    17321756    flags = elfcpp::SHF_ALLOC;
    17331757  Output_section* os = this->choose_output_section(NULL, section_name,
    17341758                                                   elfcpp::SHT_NOTE,
    1735                                                    flags, false);
     1759                                                   flags, false, false,
     1760                                                   false);
    17361761  if (os == NULL)
    17371762    return NULL;
    17381763
     
    18111836      elfcpp::Elf_Xword flags = 0;
    18121837      if (is_stack_executable)
    18131838        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);
    18151841    }
    18161842  else
    18171843    {
     
    19711997    this->namepool_.add(".gnu_incremental_inputs", false, NULL);
    19721998  Output_section* inputs_os =
    19731999    this->make_output_section(incremental_inputs_name,
    1974                               elfcpp::SHT_GNU_INCREMENTAL_INPUTS, 0);
     2000                              elfcpp::SHT_GNU_INCREMENTAL_INPUTS, 0,
     2001                              false, false);
    19752002  Output_section_data* posd =
    19762003      this->incremental_inputs_->create_incremental_inputs_section_data();
    19772004  inputs_os->add_output_section_data(posd);
     
    19812008    this->namepool_.add(".gnu_incremental_strtab", false, NULL);
    19822009  Output_section* strtab_os = this->make_output_section(incremental_strtab_name,
    19832010                                                        elfcpp::SHT_STRTAB,
    1984                                                         0);
     2011                                                        0, false, false);
    19852012  Output_data_strtab* strtab_data =
    19862013    new Output_data_strtab(this->incremental_inputs_->get_stringpool());
    19872014  strtab_os->add_output_section_data(strtab_data);
     
    25932620      const char* symtab_name = this->namepool_.add(".symtab", false, NULL);
    25942621      Output_section* osymtab = this->make_output_section(symtab_name,
    25952622                                                          elfcpp::SHT_SYMTAB,
    2596                                                           0);
     2623                                                          0, false, false);
    25972624      this->symtab_section_ = osymtab;
    25982625
    25992626      Output_section_data* pos = new Output_data_fixed_space(off - startoff,
     
    26142641                                                               false, NULL);
    26152642          Output_section* osymtab_xindex =
    26162643            this->make_output_section(symtab_xindex_name,
    2617                                       elfcpp::SHT_SYMTAB_SHNDX, 0);
     2644                                      elfcpp::SHT_SYMTAB_SHNDX, 0, false,
     2645                                      false);
    26182646
    26192647          size_t symcount = (off - startoff) / symsize;
    26202648          this->symtab_xindex_ = new Output_symtab_xindex(symcount);
     
    26362664      const char* strtab_name = this->namepool_.add(".strtab", false, NULL);
    26372665      Output_section* ostrtab = this->make_output_section(strtab_name,
    26382666                                                          elfcpp::SHT_STRTAB,
    2639                                                           0);
     2667                                                          0, false, false);
    26402668
    26412669      Output_section_data* pstr = new Output_data_strtab(&this->sympool_);
    26422670      ostrtab->add_output_section_data(pstr);
     
    26632691
    26642692  const char* name = this->namepool_.add(".shstrtab", false, NULL);
    26652693
    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);
    26672696
    26682697  // We can't write out this section until we've set all the section
    26692698  // names, and we don't set the names of compressed output sections
     
    27762805  Output_section* dynsym = this->choose_output_section(NULL, ".dynsym",
    27772806                                                       elfcpp::SHT_DYNSYM,
    27782807                                                       elfcpp::SHF_ALLOC,
    2779                                                        false);
     2808                                                       false, false, true);
    27802809
    27812810  Output_section_data* odata = new Output_data_fixed_space(index * symsize,
    27822811                                                           align,
     
    28062835        this->choose_output_section(NULL, ".dynsym_shndx",
    28072836                                    elfcpp::SHT_SYMTAB_SHNDX,
    28082837                                    elfcpp::SHF_ALLOC,
    2809                                     false);
     2838                                    false, false, true);
    28102839
    28112840      this->dynsym_xindex_ = new Output_symtab_xindex(index);
    28122841
     
    28292858  Output_section* dynstr = this->choose_output_section(NULL, ".dynstr",
    28302859                                                       elfcpp::SHT_STRTAB,
    28312860                                                       elfcpp::SHF_ALLOC,
    2832                                                        false);
     2861                                                       false, false, true);
    28332862
    28342863  Output_section_data* strdata = new Output_data_strtab(&this->dynpool_);
    28352864  dynstr->add_output_section_data(strdata);
     
    28552884      Output_section* hashsec = this->choose_output_section(NULL, ".hash",
    28562885                                                            elfcpp::SHT_HASH,
    28572886                                                            elfcpp::SHF_ALLOC,
    2858                                                             false);
     2887                                                            false, false, true);
    28592888
    28602889      Output_section_data* hashdata = new Output_data_const_buffer(phash,
    28612890                                                                   hashlen,
     
    28802909      Output_section* hashsec = this->choose_output_section(NULL, ".gnu.hash",
    28812910                                                            elfcpp::SHT_GNU_HASH,
    28822911                                                            elfcpp::SHF_ALLOC,
    2883                                                             false);
     2912                                                            false, false, true);
    28842913
    28852914      Output_section_data* hashdata = new Output_data_const_buffer(phash,
    28862915                                                                   hashlen,
     
    29783007  Output_section* vsec = this->choose_output_section(NULL, ".gnu.version",
    29793008                                                     elfcpp::SHT_GNU_versym,
    29803009                                                     elfcpp::SHF_ALLOC,
    2981                                                      false);
     3010                                                     false, false, true);
    29823011
    29833012  unsigned char* vbuf;
    29843013  unsigned int vsize;
     
    30033032      vdsec= this->choose_output_section(NULL, ".gnu.version_d",
    30043033                                         elfcpp::SHT_GNU_verdef,
    30053034                                         elfcpp::SHF_ALLOC,
    3006                                          false);
     3035                                         false, false, true);
    30073036
    30083037      unsigned char* vdbuf;
    30093038      unsigned int vdsize;
     
    30283057      vnsec = this->choose_output_section(NULL, ".gnu.version_r",
    30293058                                          elfcpp::SHT_GNU_verneed,
    30303059                                          elfcpp::SHF_ALLOC,
    3031                                           false);
     3060                                          false, false, true);
    30323061
    30333062      unsigned char* vnbuf;
    30343063      unsigned int vnsize;
     
    30683097  Output_section* osec = this->choose_output_section(NULL, ".interp",
    30693098                                                     elfcpp::SHT_PROGBITS,
    30703099                                                     elfcpp::SHF_ALLOC,
    3071                                                      false);
     3100                                                     false, true, true);
    30723101  osec->add_output_section_data(odata);
    30733102
    30743103  if (!this->script_options_->saw_phdrs_clause())
    30753104    {
    30763105      Output_segment* oseg = this->make_output_segment(elfcpp::PT_INTERP,
    30773106                                                       elfcpp::PF_R);
    3078       oseg->add_output_section(osec, elfcpp::PF_R);
     3107      oseg->add_output_section(osec, elfcpp::PF_R, false);
    30793108    }
    30803109}
    30813110
     
    30913120                                                       (elfcpp::PF_R
    30923121                                                        | elfcpp::PF_W));
    30933122      oseg->add_output_section(this->dynamic_section_,
    3094                                elfcpp::PF_R | elfcpp::PF_W);
     3123                               elfcpp::PF_R | elfcpp::PF_W,
     3124                               false);
    30953125    }
    30963126
    30973127  Output_data_dynamic* const odyn = this->dynamic_data_;
     
    31003130       p != input_objects->dynobj_end();
    31013131       ++p)
    31023132    {
    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
    31043141      odyn->add_string(elfcpp::DT_NEEDED, (*p)->soname());
    31053142    }
    31063143
  • gold/layout.h

    diff -Naur binutils-2.20.orig/gold/layout.h binutils-2.20/gold/layout.h
    old new  
    360360  layout_gnu_stack(bool seen_gnu_stack, uint64_t gnu_stack_flags);
    361361
    362362  // 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.
    364366  Output_section*
    365367  add_output_section_data(const char* name, elfcpp::Elf_Word type,
    366368                          elfcpp::Elf_Xword flags,
    367                           Output_section_data*);
     369                          Output_section_data*, bool is_dynamic_linker_section);
    368370
    369371  // Create dynamic sections if necessary.
    370372  void
     
    745747  // Return the output section for NAME, TYPE and FLAGS.
    746748  Output_section*
    747749  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);
    749752
    750753  // Choose the output section for NAME in RELOBJ.
    751754  Output_section*
    752755  choose_output_section(const Relobj* relobj, const char* name,
    753756                        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);
    755759
    756760  // Create a new Output_section.
    757761  Output_section*
    758762  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);
    760765
    761766  // Attach a section to a segment.
    762767  void
  • gold/object.h

    diff -Naur binutils-2.20.orig/gold/object.h binutils-2.20/gold/object.h
    old new  
    195195  Object(const std::string& name, Input_file* input_file, bool is_dynamic,
    196196         off_t offset = 0)
    197197    : 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)
    200200  { input_file->file().add_object(); }
    201201
    202202  virtual ~Object()
     
    217217  is_dynamic() const
    218218  { return this->is_dynamic_; }
    219219
     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
    220233  // Return whether this object was compiled with -fsplit-stack.
    221234  bool
    222235  uses_split_stack() const
     
    589602  // Number of input sections.
    590603  unsigned int shnum_;
    591604  // 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;
    593610  // Whether this object was compiled with -fsplit-stack.
    594   bool uses_split_stack_;
     611  bool uses_split_stack_ : 1;
    595612  // Whether this object contains any functions compiled with the
    596613  // 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;
    600615  // True if exclude this object from automatic symbol export.
    601616  // 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_;
    603620};
    604621
    605622// 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  
    912912  DEFINE_special(version_script, options::TWO_DASHES, '\0',
    913913                 N_("Read version script"), N_("FILE"));
    914914
     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
    915919  DEFINE_bool(warn_search_mismatch, options::TWO_DASHES, '\0', true,
    916920              N_("Warn when skipping an incompatible library"),
    917921              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  
    18001800    is_relro_local_(false),
    18011801    is_small_section_(false),
    18021802    is_large_section_(false),
     1803    is_interp_(false),
     1804    is_dynamic_linker_section_(false),
     1805    generate_code_fills_at_write_(false),
    18031806    tls_offset_(0),
    18041807    checkpoint_(NULL),
    18051808    merge_section_map_(),
    18061809    merge_section_by_properties_map_(),
    18071810    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)
    18101812{
    18111813  // An unallocated section has no address.  Forcing this means that
    18121814  // we don't need special treatment for symbols defined in debug
     
    30453047
    30463048void
    30473049Output_segment::add_output_section(Output_section* os,
    3048                                    elfcpp::Elf_Word seg_flags)
     3050                                   elfcpp::Elf_Word seg_flags,
     3051                                   bool do_sort)
    30493052{
    30503053  gold_assert((os->flags() & elfcpp::SHF_ALLOC) != 0);
    30513054  gold_assert(!this->is_max_align_known_);
    30523055  gold_assert(os->is_large_data_section() == this->is_large_data_segment());
     3056  gold_assert(this->type() == elfcpp::PT_LOAD || !do_sort);
    30533057
    30543058  // Update the segment flags.
    30553059  this->flags_ |= seg_flags;
     
    30603064  else
    30613065    pdl = &this->output_data_;
    30623066
    3063   // So that PT_NOTE segments will work correctly, we need to ensure
    3064   // that all SHT_NOTE sections are adjacent.  This will normally
    3065   // happen automatically, because all the SHT_NOTE input sections
    3066   // will wind up in the same output section.  However, it is possible
    3067   // for multiple SHT_NOTE input sections to have different section
    3068   // flags, and thus be in different output sections, but for the
    3069   // different section flags to map into the same segment flags and
    3070   // thus the same output segment.
    3071 
    30723067  // Note that while there may be many input sections in an output
    30733068  // section, there are normally only a few output sections in an
    3074   // output segment.  This loop is expected to be fast.
     3069  // output segment.  The loops below are expected to be fast.
    30753070
     3071  // So that PT_NOTE segments will work correctly, we need to ensure
     3072  // that all SHT_NOTE sections are adjacent.
    30763073  if (os->type() == elfcpp::SHT_NOTE && !pdl->empty())
    30773074    {
    30783075      Output_segment::Output_data_list::iterator p = pdl->end();
     
    30943091  // case: we group the SHF_TLS/SHT_NOBITS sections right after the
    30953092  // SHF_TLS/SHT_PROGBITS sections.  This lets us set up PT_TLS
    30963093  // correctly.  SHF_TLS sections get added to both a PT_LOAD segment
    3097   // and the PT_TLS segment -- we do this grouping only for the
    3098   // PT_LOAD segment.
     3094  // and the PT_TLS segment; we do this grouping only for the PT_LOAD
     3095  // segment.
    30993096  if (this->type_ != elfcpp::PT_TLS
    31003097      && (os->flags() & elfcpp::SHF_TLS) != 0)
    31013098    {
     
    32253222      gold_unreachable();
    32263223    }
    32273224
     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.
    32283287  pdl->push_back(os);
    32293288}
    32303289
     
    35033562              else
    35043563                {
    35053564                  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
    35063572                  if (os == NULL)
    35073573                    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);
    35103575                  else
    35113576                    gold_error(_("address of section '%s' moves backward "
    35123577                                 "from 0x%llx to 0x%llx"),
    3513                                os->name(), addr + (off - startoff),
    3514                                (*p)->address());
     3578                               os->name(), previous_dot, dot);
    35153579                }
    35163580            }
    35173581          (*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  
    23872387  is_large_data_section()
    23882388  { return this->is_large_section_ && this->type_ != elfcpp::SHT_NOBITS; }
    23892389
     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
    23902411  // Return whether this section should be written after all the input
    23912412  // sections are complete.
    23922413  bool
     
    33273348  bool is_small_section_ : 1;
    33283349  // True if this is a large section.
    33293350  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;
    33303358  // For SHT_TLS sections, the offset of this section relative to the base
    33313359  // of the TLS segment.
    33323360  uint64_t tls_offset_;
     
    33373365  // Map from merge section properties to merge_sections;
    33383366  Merge_section_by_properties_map merge_section_by_properties_map_;
    33393367  // Map from input sections to relaxed input sections.  This is mutable
    3340   // beacause it is udpated lazily.  We may need to update it in a
     3368  // because it is updated lazily.  We may need to update it in a
    33413369  // const qualified method.
    33423370  mutable Output_section_data_by_input_section_map relaxed_input_section_map_;
    33433371  // Whether relaxed_input_section_map_ is valid.
    33443372  mutable bool is_relaxed_input_section_map_valid_;
    3345   // Whether code-fills are generated at write.
    3346   bool generate_code_fills_at_write_;
    33473373};
    33483374
    33493375// An output segment.  PT_LOAD segments are built from collections of
     
    34123438  uint64_t
    34133439  maximum_alignment();
    34143440
    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.
    34163444  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);
    34183447
    34193448  // Remove an Output_section from this segment.  It is an error if it
    34203449  // 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  
    11# Makefile for program source directory in GNU NLS utilities package.
    22# 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.
    44#
    55# This file may be copied and used freely without restrictions.  It can
    66# be used in projects which are not available under the GNU Public License
     
    8888
    8989$(srcdir)/$(PACKAGE).pot: $(POTFILES)
    9090        $(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 \
    9293          --files-from=$(srcdir)/POTFILES.in
    9394        rm -f $(srcdir)/$(PACKAGE).pot
    9495        mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot
     
    112113install-exec:
    113114install-info:
    114115install-html:
     116install-pdf:
    115117install-data: install-data-@USE_NLS@
    116118install-data-no: all
    117119install-data-yes: all
    118120        if test -r $(MKINSTALLDIRS); then \
    119121          $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
    120122        else \
    121           $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
     123          $(top_srcdir)/../mkinstalldirs $(DESTDIR)$(datadir); \
    122124        fi
    123125        @catalogs='$(CATALOGS)'; \
    124126        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  
    713713
    714714      layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS,
    715715                                      elfcpp::SHF_ALLOC | elfcpp::SHF_WRITE,
    716                                       this->got_);
     716                                      this->got_, false);
    717717
    718718      // Create the GOT2 or TOC in the .got section.
    719719      if (size == 32)
     
    722722          layout->add_output_section_data(".got2", elfcpp::SHT_PROGBITS,
    723723                                          elfcpp::SHF_ALLOC
    724724                                          | elfcpp::SHF_WRITE,
    725                                           this->got2_);
     725                                          this->got2_, false);
    726726        }
    727727      else
    728728        {
     
    730730          layout->add_output_section_data(".toc", elfcpp::SHT_PROGBITS,
    731731                                          elfcpp::SHF_ALLOC
    732732                                          | elfcpp::SHF_WRITE,
    733                                           this->toc_);
     733                                          this->toc_, false);
    734734        }
    735735
    736736      // Define _GLOBAL_OFFSET_TABLE_ at the start of the .got section.
     
    756756      gold_assert(layout != NULL);
    757757      this->rela_dyn_ = new Reloc_section(parameters->options().combreloc());
    758758      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);
    760760    }
    761761  return this->rela_dyn_;
    762762}
     
    816816{
    817817  this->rel_ = new Reloc_section(false);
    818818  layout->add_output_section_data(".rela.plt", elfcpp::SHT_RELA,
    819                                   elfcpp::SHF_ALLOC, this->rel_);
     819                                  elfcpp::SHF_ALLOC, this->rel_, true);
    820820}
    821821
    822822template<int size, bool big_endian>
     
    945945                                      (elfcpp::SHF_ALLOC
    946946                                       | elfcpp::SHF_EXECINSTR
    947947                                       | elfcpp::SHF_WRITE),
    948                                       this->plt_);
     948                                      this->plt_, false);
    949949
    950950      // Define _PROCEDURE_LINKAGE_TABLE_ at the start of the .plt section.
    951951      symtab->define_in_output_data("_PROCEDURE_LINKAGE_TABLE_", NULL,
     
    15121512    Output_section* os = layout->add_output_section_data(".sdata", 0,
    15131513                                                         elfcpp::SHF_ALLOC
    15141514                                                         | elfcpp::SHF_WRITE,
    1515                                                          sdata);
     1515                                                         sdata, false);
    15161516    symtab->define_in_output_data("_SDA_BASE_", NULL,
    15171517                                  os,
    15181518                                  32768, 0,
     
    15471547  Output_data_dynamic* const odyn = layout->dynamic_data();
    15481548  if (odyn != NULL)
    15491549    {
    1550       if (this->plt_ != NULL)
     1550      if (this->plt_ != NULL
     1551          && this->plt_->output_section() != NULL)
    15511552        {
    15521553          const Output_data* od = this->plt_->rel_plt();
    15531554          odyn->add_section_size(elfcpp::DT_PLTRELSZ, od);
     
    15571558          odyn->add_section_address(elfcpp::DT_PLTGOT, this->plt_);
    15581559        }
    15591560
    1560       if (this->rela_dyn_ != NULL)
     1561      if (this->rela_dyn_ != NULL
     1562          && this->rela_dyn_->output_section() != NULL)
    15611563        {
    15621564          const Output_data* od = this->rela_dyn_;
    15631565          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  
    302302                                         sym.get_st_type());
    303303
    304304  bool adjust_common_sizes;
     305  typename Sized_symbol<size>::Size_type tosize = to->symsize();
    305306  if (Symbol_table::should_override(to, frombits, object,
    306307                                    &adjust_common_sizes))
    307308    {
    308       typename Sized_symbol<size>::Size_type tosize = to->symsize();
    309 
    310309      this->override(to, sym, st_shndx, is_ordinary, object, version);
    311 
    312310      if (adjust_common_sizes && tosize > to->symsize())
    313311        to->set_symsize(tosize);
    314312    }
    315313  else
    316314    {
    317       if (adjust_common_sizes && sym.get_st_size() > to->symsize())
     315      if (adjust_common_sizes && sym.get_st_size() > tosize)
    318316        to->set_symsize(sym.get_st_size());
    319317      // The ELF ABI says that even for a reference to a symbol we
    320318      // merge the visibility.
    321319      to->override_visibility(sym.get_st_visibility());
    322320    }
    323321
     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
    324340  // A new weak undefined reference, merging with an old weak
    325341  // reference, could be a One Definition Rule (ODR) violation --
    326342  // especially if the types or sizes of the references differ.  We'll
     
    422438          || object->just_symbols())
    423439        return false;
    424440
    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);
    433444      return false;
    434445
    435446    case WEAK_DEF * 16 + DEF:
     
    464475    case DYN_COMMON * 16 + DEF:
    465476    case DYN_WEAK_COMMON * 16 + DEF:
    466477      // 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);
    469484      return true;
    470485
    471486    case DEF * 16 + WEAK_DEF:
     
    495510    case DYN_COMMON * 16 + WEAK_DEF:
    496511    case DYN_WEAK_COMMON * 16 + WEAK_DEF:
    497512      // 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);
    499519      return true;
    500520
    501521    case DEF * 16 + DYN_DEF:
     
    611631
    612632    case DEF * 16 + COMMON:
    613633      // 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);
    614639      return false;
    615640
    616641    case WEAK_DEF * 16 + COMMON:
     
    716741    }
    717742}
    718743
     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
     753void
     754Symbol_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
    719782// A special case of should_override which is only called for a strong
    720783// defined symbol from a regular object file.  This is used when
    721784// 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  
    30513051          is_current_seg_readonly = true;
    30523052        }
    30533053
    3054       current_seg->add_output_section(*p, seg_flags);
     3054      current_seg->add_output_section(*p, seg_flags, false);
    30553055
    30563056      if (((*p)->flags() & elfcpp::SHF_WRITE) != 0)
    30573057        is_current_seg_readonly = false;
     
    31303130            Layout::section_flags_to_segment((*p)->flags());
    31313131          Output_segment* oseg = layout->make_output_segment(elfcpp::PT_NOTE,
    31323132                                                             seg_flags);
    3133           oseg->add_output_section(*p, seg_flags);
     3133          oseg->add_output_section(*p, seg_flags, false);
    31343134
    31353135          // Incorporate any subsequent SHT_NOTE sections, in the
    31363136          // hopes that the script is sensible.
     
    31393139                 && (*pnext)->type() == elfcpp::SHT_NOTE)
    31403140            {
    31413141              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);
    31433143              p = pnext;
    31443144              ++pnext;
    31453145            }
     
    31543154            Layout::section_flags_to_segment((*p)->flags());
    31553155          Output_segment* oseg = layout->make_output_segment(elfcpp::PT_TLS,
    31563156                                                             seg_flags);
    3157           oseg->add_output_section(*p, seg_flags);
     3157          oseg->add_output_section(*p, seg_flags, false);
    31583158
    31593159          Layout::Section_list::const_iterator pnext = p + 1;
    31603160          while (pnext != sections->end()
    31613161                 && ((*pnext)->flags() & elfcpp::SHF_TLS) != 0)
    31623162            {
    31633163              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);
    31653165              p = pnext;
    31663166              ++pnext;
    31673167            }
     
    33153315
    33163316              elfcpp::Elf_Word seg_flags =
    33173317                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);
    33193319
    33203320              if (r->second->type() == elfcpp::PT_LOAD)
    33213321                {
  • gold/sparc.cc

    diff -Naur binutils-2.20.orig/gold/sparc.cc binutils-2.20/gold/sparc.cc
    old new  
    10271027      os = layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS,
    10281028                                           (elfcpp::SHF_ALLOC
    10291029                                            | elfcpp::SHF_WRITE),
    1030                                            this->got_);
     1030                                           this->got_, false);
    10311031      os->set_is_relro();
    10321032
    10331033      // Define _GLOBAL_OFFSET_TABLE_ at the start of the .got section.
     
    10531053      gold_assert(layout != NULL);
    10541054      this->rela_dyn_ = new Reloc_section(parameters->options().combreloc());
    10551055      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);
    10571057    }
    10581058  return this->rela_dyn_;
    10591059}
     
    11551155{
    11561156  this->rel_ = new Reloc_section(false);
    11571157  layout->add_output_section_data(".rela.plt", elfcpp::SHT_RELA,
    1158                                   elfcpp::SHF_ALLOC, this->rel_);
     1158                                  elfcpp::SHF_ALLOC, this->rel_, true);
    11591159}
    11601160
    11611161template<int size, bool big_endian>
     
    13721372                                      (elfcpp::SHF_ALLOC
    13731373                                       | elfcpp::SHF_EXECINSTR
    13741374                                       | elfcpp::SHF_WRITE),
    1375                                       this->plt_);
     1375                                      this->plt_, false);
    13761376
    13771377      // Define _PROCEDURE_LINKAGE_TABLE_ at the start of the .plt section.
    13781378      symtab->define_in_output_data("_PROCEDURE_LINKAGE_TABLE_", NULL,
     
    23342334  Output_data_dynamic* const odyn = layout->dynamic_data();
    23352335  if (odyn != NULL)
    23362336    {
    2337       if (this->plt_ != NULL)
     2337      if (this->plt_ != NULL
     2338          && this->plt_->output_section() != NULL)
    23382339        {
    23392340          const Output_data* od = this->plt_->rel_plt();
    23402341          odyn->add_section_size(elfcpp::DT_PLTRELSZ, od);
     
    23442345          odyn->add_section_address(elfcpp::DT_PLTGOT, this->plt_);
    23452346        }
    23462347
    2347       if (this->rela_dyn_ != NULL)
     2348      if (this->rela_dyn_ != NULL
     2349          && this->rela_dyn_->output_section() != NULL)
    23482350        {
    23492351          const Output_data* od = this->rela_dyn_;
    23502352          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  
    22422242          // Record any version information.
    22432243          if (sym->version() != NULL)
    22442244            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();
    22452251        }
    22462252    }
    22472253
  • gold/symtab.h

    diff -Naur binutils-2.20.orig/gold/symtab.h binutils-2.20/gold/symtab.h
    old new  
    14881488  static bool
    14891489  should_override(const Symbol*, unsigned int, Object*, bool*);
    14901490
     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
    14911496  // Override a symbol.
    14921497  template<int size, bool big_endian>
    14931498  void
  • gold/x86_64.cc

    diff -Naur binutils-2.20.orig/gold/x86_64.cc binutils-2.20/gold/x86_64.cc
    old new  
    472472      os = layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS,
    473473                                           (elfcpp::SHF_ALLOC
    474474                                            | elfcpp::SHF_WRITE),
    475                                            this->got_);
     475                                           this->got_, false);
    476476      os->set_is_relro();
    477477
    478478      // The old GNU linker creates a .got.plt section.  We just
     
    483483      os = layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS,
    484484                                           (elfcpp::SHF_ALLOC
    485485                                            | elfcpp::SHF_WRITE),
    486                                            this->got_plt_);
     486                                           this->got_plt_, false);
    487487      os->set_is_relro();
    488488
    489489      // The first three entries are reserved.
     
    511511      gold_assert(layout != NULL);
    512512      this->rela_dyn_ = new Reloc_section(parameters->options().combreloc());
    513513      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);
    515515    }
    516516  return this->rela_dyn_;
    517517}
     
    611611{
    612612  this->rel_ = new Reloc_section(false);
    613613  layout->add_output_section_data(".rela.plt", elfcpp::SHT_RELA,
    614                                   elfcpp::SHF_ALLOC, this->rel_);
     614                                  elfcpp::SHF_ALLOC, this->rel_, true);
    615615}
    616616
    617617void
     
    807807      layout->add_output_section_data(".plt", elfcpp::SHT_PROGBITS,
    808808                                      (elfcpp::SHF_ALLOC
    809809                                       | elfcpp::SHF_EXECINSTR),
    810                                       this->plt_);
     810                                      this->plt_, false);
    811811    }
    812812}
    813813
     
    16591659  Output_data_dynamic* const odyn = layout->dynamic_data();
    16601660  if (odyn != NULL)
    16611661    {
    1662       if (this->got_plt_ != NULL)
     1662      if (this->got_plt_ != NULL
     1663          && this->got_plt_->output_section() != NULL)
    16631664        odyn->add_section_address(elfcpp::DT_PLTGOT, this->got_plt_);
    16641665
    1665       if (this->plt_ != NULL)
     1666      if (this->plt_ != NULL
     1667          && this->plt_->output_section() != NULL)
    16661668        {
    16671669          const Output_data* od = this->plt_->rel_plt();
    16681670          odyn->add_section_size(elfcpp::DT_PLTRELSZ, od);
     
    16801682            }
    16811683        }
    16821684
    1683       if (this->rela_dyn_ != NULL)
     1685      if (this->rela_dyn_ != NULL
     1686          && this->rela_dyn_->output_section() != NULL)
    16841687        {
    16851688          const Output_data* od = this->rela_dyn_;
    16861689          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  
     12009-10-09  Rafael Espindola  <espindola@google.com>
     2
     3        * plugin-api.h (ld_plugin_add_input_library): Change argument name to
     4        libname.
     5
     62008-10-03  Rafael Espindola  <espindola@google.com>
     7
     8        * plugin-api.h: New.
     9        * lto-symtab.h: New.
     10
    1112009-09-09  Martin Thuresson  <martin@mtme.org>
    212
    313        * 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  
     12009-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
    172009-09-21  Alan Modra  <amodra@bigpond.net.au>
    28
    39        * 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  
    7373
    7474#ifndef RELOC_MACROS_GEN_FUNC
    7575/* 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)
    8079#endif
    8180
    8281  /* 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  
    11/* plugin-api.h -- External linker plugin API.  */
    22
    3 /* Copyright 2008 Free Software Foundation, Inc.
     3/* Copyright 2009 Free Software Foundation, Inc.
    44   Written by Cary Coutant <ccoutant@google.com>.
    55
    66   This file is part of binutils.
     
    111111enum ld_plugin_symbol_resolution
    112112{
    113113  LDPR_UNKNOWN = 0,
     114
     115  /* Symbol is still undefined at this point.  */
    114116  LDPR_UNDEF,
     117
     118  /* This is the prevailing definition of the symbol, with references from
     119     regular object code.  */
    115120  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.  */
    116125  LDPR_PREVAILING_DEF_IRONLY,
     126
     127  /* This definition was pre-empted by a definition in a regular
     128     object file.  */
    117129  LDPR_PREEMPTED_REG,
     130
     131  /* This definition was pre-empted by a definition in another IR file.  */
    118132  LDPR_PREEMPTED_IR,
     133
     134  /* This symbol was resolved by a definition in another IR file.  */
    119135  LDPR_RESOLVED_IR,
     136
     137  /* This symbol was resolved by a definition in a regular object
     138     linked into the main executable.  */
    120139  LDPR_RESOLVED_EXEC,
     140
     141  /* This symbol was resolved by a definition in a shared object.  */
    121142  LDPR_RESOLVED_DYN
    122143};
    123144
     
    193214enum ld_plugin_status
    194215(*ld_plugin_add_input_file) (char *pathname);
    195216
     217/* The linker's interface for adding a library that should be searched.  */
     218
     219typedef
     220enum ld_plugin_status
     221(*ld_plugin_add_input_library) (char *libname);
     222
    196223/* The linker's interface for issuing a warning or error message.  */
    197224
    198225typedef
     
    224251  LDPT_ADD_INPUT_FILE,
    225252  LDPT_MESSAGE,
    226253  LDPT_GET_INPUT_FILE,
    227   LDPT_RELEASE_INPUT_FILE
     254  LDPT_RELEASE_INPUT_FILE,
     255  LDPT_ADD_INPUT_LIBRARY
    228256};
    229257
    230258/* The plugin transfer vector.  */
     
    245273    ld_plugin_message tv_message;
    246274    ld_plugin_get_input_file tv_get_input_file;
    247275    ld_plugin_release_input_file tv_release_input_file;
     276    ld_plugin_add_input_library tv_add_input_library;
    248277  } tv_u;
    249278};
    250279
  • ld/ChangeLog

    diff -Naur binutils-2.20.orig/ld/ChangeLog binutils-2.20/ld/ChangeLog
    old new  
     12009-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
     72009-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
    1142009-10-14  Andreas Schwab  <schwab@linux-m68k.org>
    215
    316        * 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  
    2828  .got          0 : { *(.got) }
    2929  .toc          0 : { *(.toc) }"
    3030fi
     31# Put .opd relocs first so ld.so will process them before any ifunc relocs.
     32INITIAL_RELOC_SECTIONS="
     33  .rela.opd     ${RELOCATING-0} : { *(.rela.opd) }"
    3134OTHER_GOT_RELOC_SECTIONS="
    3235  .rela.toc     ${RELOCATING-0} : { *(.rela.toc) }
    33   .rela.opd     ${RELOCATING-0} : { *(.rela.opd) }
    3436  .rela.branch_lt       ${RELOCATING-0} : { *(.rela.branch_lt) }"
    3537OTHER_READWRITE_SECTIONS="
    3638  .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  
    13481348                  if (sym->flags == BSF_WEAK)
    13491349                    {
    13501350                      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,
    13521352                                                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;
    13551374                    }
    13561375
    13571376                  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  
    311311  COMBRELOCCAT="cat > $COMBRELOC"
    312312fi
    313313eval $COMBRELOCCAT <<EOF
     314  ${INITIAL_RELOC_SECTIONS}
    314315  .rel.init     ${RELOCATING-0} : { *(.rel.init) }
    315316  .rela.init    ${RELOCATING-0} : { *(.rela.init) }
    316317  .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  
     12009-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
    1102009-10-03  Alan Modra  <amodra@bigpond.net.au>
    211
    312        * 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  
    102102#...
    103103
    104104000800cc <tlsdsofn>:
    105    800cc:       6fae f4ff ffff          move\.d 0xfffffff4,\$r10
     105   800cc:       6fae 8000 0000          move\.d 80 <x>,\$r10
    106106#...
    107107
    108108000800d4 <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  
    6464   80098:       6fae 1800 0000          move\.d 18 <x2\+0x10>,\$r10
    6565#...
    6666000800a0 <tlsdsofn>:
    67    800a0:       6fae f4ff ffff          move\.d 0xfffffff4,\$r10
     67   800a0:       6fae 0000 0000          move\.d 0 <x>,\$r10
    6868#...
    6969000800a8 <tlsdsofn10>:
    7070   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  
    3535   80094:       41b2                    moveq 1,\$r11
    3636#...
    373700080098 <tlsdsofn>:
    38    80098:       6fae fcff ffff          move\.d 0xfffffffc,\$r10
     38   80098:       6fae 8000 0000          move\.d 80 <x>,\$r10
    3939#...
  • 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  
    8181   800a8:       6fae b4ff ffff          move.d 0xffffffb4,\$r10
    8282#...
    8383000800b0 <tlsdsofn>:
    84    800b0:       6fae b0ff ffff          move\.d 0xffffffb0,\$r10
     84   800b0:       6fae 0000 0000          move\.d 0 <x>,\$r10
    8585#...
    8686000800b8 <tlsdsofn10>:
    8787   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  
    2727 82120 00000000 00000000 00000000 01000000  .*
    2828 82130 80000000                             .*
    2929Contents of section .debug_info:
    30  0000 fcffffff                             .*
     30 0000 80000000                             .*
    3131Contents of section .debug_line:
    3232#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  
    2727 8211c 00000000 00000000 00000000 01000000  .*
    2828 8212c 80000000                             .*
    2929Contents of section .debug_info:
    30  0000 fcffffff                             .*
     30 0000 80000000                             .*
    3131Contents of section .debug_line:
    3232#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  
    5151   80094:       41b2                    moveq 1,\$r11
    5252#...
    535300080098 <tlsdsofn>:
    54    80098:       5fae f8ff               move\.w 0xfff8,\$r10
    55    8009c:       5fbe fcff               move\.w 0xfffc,\$r11
     54   80098:       5fae 8800               move\.w 0x88,\$r10
     55   8009c:       5fbe 8c00               move\.w 0x8c,\$r11
    5656
    5757000800a0 <tlsdsofn0>:
    5858   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  
    5151   80094:       41b2                    moveq 1,\$r11
    5252#...
    535300080098 <tlsdsofn>:
    54    80098:       6fae f8ff ffff          move.d 0xfffffff8,\$r10
    55    8009e:       6fbe fcff ffff          move.d 0xfffffffc,\$r11
     54   80098:       6fae 8800 0000          move.d 88 <x1>,\$r10
     55   8009e:       6fbe 8c00 0000          move.d 8c <x2>,\$r11
    5656000800a4 <tlsdsofn2>:
    5757   800a4:       6fae 1400 0000          move.d 14 <tls128\+0x14>,\$r10
    5858#...
  • 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  
    4444Contents of section .interp:
    4545#...
    4646Contents of section \.text:
    47  801dc 41b20000 5faef8ff 5fbefcff 5fae1400  .*
     47 801dc 41b20000 5fae8000 5fbe8400 5fae1400  .*
    4848 801ec 5fae1c00                             .*
    4949Contents of section \.tdata:
    5050#...
  • 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  
    4444Contents of section \.interp:
    4545#...
    4646Contents of section \.text:
    47  801dc 41b20000 6faef8ff ffff6fbe fcffffff  .*
     47 801dc 41b20000 6fae8000 00006fbe 84000000  .*
    4848 801ec 6fae1400 00000000 6fae1c00 00000000  .*
    4949Contents of section \.tdata:
    5050#...
Note: See TracBrowser for help on using the repository browser.