Develop and Download Open Source Software

Browse Subversion Repository

Diff of /trunk/bfd/elf32-s390.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 20 by monabuilder, Sun Dec 7 02:23:44 2008 UTC revision 21 by monamour, Mon Jul 27 20:34:36 2009 UTC
# Line 730  struct elf_s390_link_hash_table Line 730  struct elf_s390_link_hash_table
730      bfd_vma offset;      bfd_vma offset;
731    } tls_ldm_got;    } tls_ldm_got;
732    
733    /* Small local sym to section mapping cache.  */    /* Small local sym cache.  */
734    struct sym_sec_cache sym_sec;    struct sym_cache sym_cache;
735  };  };
736    
737  /* Get the s390 ELF linker hash table from a link_info structure.  */  /* Get the s390 ELF linker hash table from a link_info structure.  */
# Line 800  elf_s390_link_hash_table_create (abfd) Line 800  elf_s390_link_hash_table_create (abfd)
800    ret->sdynbss = NULL;    ret->sdynbss = NULL;
801    ret->srelbss = NULL;    ret->srelbss = NULL;
802    ret->tls_ldm_got.refcount = 0;    ret->tls_ldm_got.refcount = 0;
803    ret->sym_sec.abfd = NULL;    ret->sym_cache.abfd = NULL;
804    
805    return &ret->elf.root;    return &ret->elf.root;
806  }  }
# Line 821  create_got_section (dynobj, info) Line 821  create_got_section (dynobj, info)
821    htab = elf_s390_hash_table (info);    htab = elf_s390_hash_table (info);
822    htab->sgot = bfd_get_section_by_name (dynobj, ".got");    htab->sgot = bfd_get_section_by_name (dynobj, ".got");
823    htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");    htab->sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
824    if (!htab->sgot || !htab->sgotplt)    htab->srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
825      if (!htab->sgot || !htab->sgotplt || !htab->srelgot)
826      abort ();      abort ();
827    
   htab->srelgot = bfd_make_section_with_flags (dynobj, ".rela.got",  
                                                (SEC_ALLOC | SEC_LOAD  
                                                 | SEC_HAS_CONTENTS  
                                                 | SEC_IN_MEMORY  
                                                 | SEC_LINKER_CREATED  
                                                 | SEC_READONLY));  
   if (htab->srelgot == NULL  
       || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2))  
     return FALSE;  
828    return TRUE;    return TRUE;
829  }  }
830    
# Line 1261  elf_s390_check_relocs (abfd, info, sec, Line 1253  elf_s390_check_relocs (abfd, info, sec,
1253                      && ELF32_R_TYPE (rel->r_info) != R_390_PC32DBL                      && ELF32_R_TYPE (rel->r_info) != R_390_PC32DBL
1254                      && ELF32_R_TYPE (rel->r_info) != R_390_PC32)                      && ELF32_R_TYPE (rel->r_info) != R_390_PC32)
1255                     || (h != NULL                     || (h != NULL
1256                         && (! info->symbolic                         && (! SYMBOLIC_BIND (info, h)
1257                             || h->root.type == bfd_link_hash_defweak                             || h->root.type == bfd_link_hash_defweak
1258                             || !h->def_regular))))                             || !h->def_regular))))
1259                || (ELIMINATE_COPY_RELOCS                || (ELIMINATE_COPY_RELOCS
# Line 1302  elf_s390_check_relocs (abfd, info, sec, Line 1294  elf_s390_check_relocs (abfd, info, sec,
1294                       easily.  Oh well.  */                       easily.  Oh well.  */
1295                    asection *s;                    asection *s;
1296                    void *vpp;                    void *vpp;
1297                      Elf_Internal_Sym *isym;
1298    
1299                    s = bfd_section_from_r_symndx (abfd, &htab->sym_sec,                    isym = bfd_sym_from_r_symndx (&htab->sym_cache,
1300                                                   sec, r_symndx);                                                  abfd, r_symndx);
1301                    if (s == NULL)                    if (isym == NULL)
1302                      return FALSE;                      return FALSE;
1303    
1304                      s = bfd_section_from_elf_index (abfd, isym->st_shndx);
1305                      if (s == NULL)
1306                        s = sec;
1307    
1308                    vpp = &elf_section_data (s)->local_dynrel;                    vpp = &elf_section_data (s)->local_dynrel;
1309                    head = (struct elf_s390_dyn_relocs **) vpp;                    head = (struct elf_s390_dyn_relocs **) vpp;
1310                  }                  }
# Line 1566  elf_s390_adjust_dynamic_symbol (info, h) Line 1563  elf_s390_adjust_dynamic_symbol (info, h)
1563        || h->needs_plt)        || h->needs_plt)
1564      {      {
1565        if (h->plt.refcount <= 0        if (h->plt.refcount <= 0
1566            || (! info->shared            || SYMBOL_CALLS_LOCAL (info, h)
1567                && !h->def_dynamic            || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
1568                && !h->ref_dynamic                && h->root.type != bfd_link_hash_undefweak))
               && h->root.type != bfd_link_hash_undefweak  
               && h->root.type != bfd_link_hash_undefined))  
1569          {          {
1570            /* This case can occur if we saw a PLT32 reloc in an input            /* This case can occur if we saw a PLT32 reloc in an input
1571               file, but the symbol was never referred to by a dynamic               file, but the symbol was never referred to by a dynamic
# Line 1709  allocate_dynrelocs (h, inf) Line 1704  allocate_dynrelocs (h, inf)
1704    htab = elf_s390_hash_table (info);    htab = elf_s390_hash_table (info);
1705    
1706    if (htab->elf.dynamic_sections_created    if (htab->elf.dynamic_sections_created
1707        && h->plt.refcount > 0        && h->plt.refcount > 0)
       && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT  
           || h->root.type != bfd_link_hash_undefweak))  
1708      {      {
1709        /* Make sure this symbol is output as a dynamic symbol.        /* Make sure this symbol is output as a dynamic symbol.
1710           Undefined weak syms won't yet be marked as dynamic.  */           Undefined weak syms won't yet be marked as dynamic.  */
# Line 1840  allocate_dynrelocs (h, inf) Line 1833  allocate_dynrelocs (h, inf)
1833    
1834    if (info->shared)    if (info->shared)
1835      {      {
1836        if (SYMBOL_REFERENCES_LOCAL (info, h))        if (SYMBOL_CALLS_LOCAL (info, h))
1837          {          {
1838            struct elf_s390_dyn_relocs **pp;            struct elf_s390_dyn_relocs **pp;
1839    
# Line 2364  elf_s390_relocate_section (output_bfd, i Line 2357  elf_s390_relocate_section (output_bfd, i
2357                dyn = htab->elf.dynamic_sections_created;                dyn = htab->elf.dynamic_sections_created;
2358                if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)                if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
2359                    || (info->shared                    || (info->shared
2360                        && (info->symbolic                        && SYMBOL_REFERENCES_LOCAL (info, h))
                           || h->dynindx == -1  
                           || h->forced_local)  
                       && h->def_regular)  
2361                    || (ELF_ST_VISIBILITY (h->other)                    || (ELF_ST_VISIBILITY (h->other)
2362                        && h->root.type == bfd_link_hash_undefweak))                        && h->root.type == bfd_link_hash_undefweak))
2363                  {                  {
# Line 2537  elf_s390_relocate_section (output_bfd, i Line 2527  elf_s390_relocate_section (output_bfd, i
2527                      && r_type != R_390_PC16DBL                      && r_type != R_390_PC16DBL
2528                      && r_type != R_390_PC32DBL                      && r_type != R_390_PC32DBL
2529                      && r_type != R_390_PC32)                      && r_type != R_390_PC32)
2530                     || (h != NULL                     || !SYMBOL_CALLS_LOCAL (info, h)))
                        && !SYMBOL_REFERENCES_LOCAL (info, h))))  
2531                || (ELIMINATE_COPY_RELOCS                || (ELIMINATE_COPY_RELOCS
2532                    && !info->shared                    && !info->shared
2533                    && h != NULL                    && h != NULL
# Line 2580  elf_s390_relocate_section (output_bfd, i Line 2569  elf_s390_relocate_section (output_bfd, i
2569                             || r_type == R_390_PC32DBL                             || r_type == R_390_PC32DBL
2570                             || r_type == R_390_PC32                             || r_type == R_390_PC32
2571                             || !info->shared                             || !info->shared
2572                             || !info->symbolic                             || !SYMBOLIC_BIND (info, h)
2573                             || !h->def_regular))                             || !h->def_regular))
2574                  {                  {
2575                    outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);                    outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
# Line 3262  elf_s390_finish_dynamic_symbol (output_b Line 3251  elf_s390_finish_dynamic_symbol (output_b
3251           The entry in the global offset table will already have been           The entry in the global offset table will already have been
3252           initialized in the relocate_section function.  */           initialized in the relocate_section function.  */
3253        if (info->shared        if (info->shared
3254            && (info->symbolic            && SYMBOL_REFERENCES_LOCAL (info, h))
               || h->dynindx == -1  
               || h->forced_local)  
           && h->def_regular)  
3255          {          {
3256              if (!h->def_regular)
3257                return FALSE;
3258            BFD_ASSERT((h->got.offset & 1) != 0);            BFD_ASSERT((h->got.offset & 1) != 0);
3259            rela.r_info = ELF32_R_INFO (0, R_390_RELATIVE);            rela.r_info = ELF32_R_INFO (0, R_390_RELATIVE);
3260            rela.r_addend = (h->root.u.def.value            rela.r_addend = (h->root.u.def.value

Legend:
Removed from v.20  
changed lines
  Added in v.21

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26