~ubuntu-branches/ubuntu/hoary/binutils/hoary

« back to all changes in this revision

Viewing changes to bfd/elf64-s390.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2005-03-18 13:07:52 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050318130752-j4i37zgqclj53b94
Tags: 2.15-5ubuntu2
debian/rules: Call pkgstriptranslations if present (the package does not
use debhelper, thus it does not happen automatically).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* IBM S/390-specific support for 64-bit ELF
2
 
   Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
2
   Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
3
3
   Contributed Martin Schwidefsky (schwidefsky@de.ibm.com).
4
4
 
5
5
   This file is part of BFD, the Binary File Descriptor library.
638
638
elf_s390_object_p (abfd)
639
639
     bfd *abfd;
640
640
{
641
 
  /* Allocate our special target data.  */
642
 
  struct elf_s390_obj_tdata *new_tdata;
643
 
  bfd_size_type amt = sizeof (struct elf_s390_obj_tdata);
644
 
  new_tdata = bfd_zalloc (abfd, amt);
645
 
  if (new_tdata == NULL)
646
 
    return FALSE;
647
 
  new_tdata->root = *abfd->tdata.elf_obj_data;
648
 
  abfd->tdata.any = new_tdata;
649
641
  /* Set the right machine number for an s390 elf32 file.  */
650
642
  return bfd_default_set_arch_mach (abfd, bfd_arch_s390, bfd_mach_s390_64);
651
643
}
867
859
    dir->elf_link_hash_flags |=
868
860
      (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC
869
861
                                   | ELF_LINK_HASH_REF_REGULAR
870
 
                                   | ELF_LINK_HASH_REF_REGULAR_NONWEAK));
 
862
                                   | ELF_LINK_HASH_REF_REGULAR_NONWEAK
 
863
                                   | ELF_LINK_HASH_NEEDS_PLT));
871
864
  else
872
865
    _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
873
866
}
1316
1309
          /* This relocation describes the C++ object vtable hierarchy.
1317
1310
             Reconstruct it for later use during GC.  */
1318
1311
        case R_390_GNU_VTINHERIT:
1319
 
          if (!_bfd_elf64_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
 
1312
          if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
1320
1313
            return FALSE;
1321
1314
          break;
1322
1315
 
1323
1316
          /* This relocation describes which C++ vtable entries are actually
1324
1317
             used.  Record for later use during GC.  */
1325
1318
        case R_390_GNU_VTENTRY:
1326
 
          if (!_bfd_elf64_gc_record_vtentry (abfd, sec, h, rel->r_addend))
 
1319
          if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
1327
1320
            return FALSE;
1328
1321
          break;
1329
1322
 
1694
1687
  return TRUE;
1695
1688
}
1696
1689
 
1697
 
/* This is the condition under which elf_s390_finish_dynamic_symbol
1698
 
   will be called from elflink.h.  If elflink.h doesn't call our
1699
 
   finish_dynamic_symbol routine, we'll need to do something about
1700
 
   initializing any .plt and .got entries in elf_s390_relocate_section.  */
1701
 
#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, SHARED, H) \
1702
 
  ((DYN)                                                                \
1703
 
   && ((SHARED)                                                         \
1704
 
       || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)      \
1705
 
   && ((H)->dynindx != -1                                               \
1706
 
       || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0))
1707
 
 
1708
1690
/* Allocate space in .plt, .got and associated reloc sections for
1709
1691
   dynamic relocs.  */
1710
1692
 
1740
1722
      if (h->dynindx == -1
1741
1723
          && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
1742
1724
        {
1743
 
          if (! bfd_elf64_link_record_dynamic_symbol (info, h))
 
1725
          if (! bfd_elf_link_record_dynamic_symbol (info, h))
1744
1726
            return FALSE;
1745
1727
        }
1746
1728
 
1823
1805
      if (h->dynindx == -1
1824
1806
          && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
1825
1807
        {
1826
 
          if (! bfd_elf64_link_record_dynamic_symbol (info, h))
 
1808
          if (! bfd_elf_link_record_dynamic_symbol (info, h))
1827
1809
            return FALSE;
1828
1810
        }
1829
1811
 
1862
1844
 
1863
1845
  if (info->shared)
1864
1846
    {
1865
 
      if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
1866
 
          && ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0
1867
 
              || info->symbolic))
 
1847
      if (SYMBOL_REFERENCES_LOCAL (info, h))
1868
1848
        {
1869
1849
          struct elf_s390_dyn_relocs **pp;
1870
1850
 
1903
1883
          if (h->dynindx == -1
1904
1884
              && (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
1905
1885
            {
1906
 
              if (! bfd_elf64_link_record_dynamic_symbol (info, h))
 
1886
              if (! bfd_elf_link_record_dynamic_symbol (info, h))
1907
1887
                return FALSE;
1908
1888
            }
1909
1889
 
2136
2116
         the .dynamic section.  The DT_DEBUG entry is filled in by the
2137
2117
         dynamic linker and used by the debugger.  */
2138
2118
#define add_dynamic_entry(TAG, VAL) \
2139
 
  bfd_elf64_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL))
 
2119
  _bfd_elf_add_dynamic_entry (info, TAG, VAL)
2140
2120
 
2141
2121
      if (info->executable)
2142
2122
        {
2186
2166
dtpoff_base (info)
2187
2167
     struct bfd_link_info *info;
2188
2168
{
2189
 
  /* If tls_segment is NULL, we should have signalled an error already.  */
2190
 
  if (elf_hash_table (info)->tls_segment == NULL)
 
2169
  /* If tls_sec is NULL, we should have signalled an error already.  */
 
2170
  if (elf_hash_table (info)->tls_sec == NULL)
2191
2171
    return 0;
2192
 
  return elf_hash_table (info)->tls_segment->start;
 
2172
  return elf_hash_table (info)->tls_sec->vma;
2193
2173
}
2194
2174
 
2195
2175
/* Return the relocation value for @tpoff relocation
2200
2180
     struct bfd_link_info *info;
2201
2181
     bfd_vma address;
2202
2182
{
2203
 
  struct elf_link_tls_segment *tls_segment
2204
 
    = elf_hash_table (info)->tls_segment;
 
2183
  struct elf_link_hash_table *htab = elf_hash_table (info);
2205
2184
 
2206
 
  /* If tls_segment is NULL, we should have signalled an error already.  */
2207
 
  if (tls_segment == NULL)
 
2185
  /* If tls_sec is NULL, we should have signalled an error already.  */
 
2186
  if (htab->tls_sec == NULL)
2208
2187
    return 0;
2209
 
  return (align_power (tls_segment->size, tls_segment->align)
2210
 
          + tls_segment->start - address);
 
2188
  return htab->tls_size + htab->tls_sec->vma - address;
2211
2189
}
2212
2190
 
2213
2191
/* Complain if TLS instruction relocation is against an invalid
2297
2275
        {
2298
2276
          sym = local_syms + r_symndx;
2299
2277
          sec = local_sections[r_symndx];
2300
 
          relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
 
2278
          relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
2301
2279
        }
2302
2280
      else
2303
2281
        {
2304
2282
          bfd_boolean warned ATTRIBUTE_UNUSED;
2305
2283
 
2306
 
          RELOC_FOR_GLOBAL_SYMBOL (h, sym_hashes, r_symndx,
2307
 
                                   symtab_hdr, relocation, sec,
2308
 
                                   unresolved_reloc, info,
2309
 
                                   warned);
 
2284
          RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
 
2285
                                   r_symndx, symtab_hdr, sym_hashes,
 
2286
                                   h, sec, relocation,
 
2287
                                   unresolved_reloc, warned);
2310
2288
        }
2311
2289
 
2312
2290
      switch (r_type)
2549
2527
                    && r_type != R_390_PC32DBL
2550
2528
                    && r_type != R_390_PC64)
2551
2529
                   || (h != NULL
2552
 
                       && h->dynindx != -1
2553
 
                       && (! info->symbolic
2554
 
                           || (h->elf_link_hash_flags
2555
 
                               & ELF_LINK_HASH_DEF_REGULAR) == 0))))
 
2530
                       && !SYMBOL_REFERENCES_LOCAL (info, h))))
2556
2531
              || (ELIMINATE_COPY_RELOCS
2557
2532
                  && !info->shared
2558
2533
                  && h != NULL
2607
2582
              else
2608
2583
                {
2609
2584
                  /* This symbol is local, or marked to become local.  */
2610
 
                  relocate = TRUE;
2611
 
                  outrel.r_info = ELF64_R_INFO (0, R_390_RELATIVE);
2612
2585
                  outrel.r_addend = relocation + rel->r_addend;
 
2586
                  if (r_type == R_390_64)
 
2587
                    {
 
2588
                      relocate = TRUE;
 
2589
                      outrel.r_info = ELF64_R_INFO (0, R_390_RELATIVE);
 
2590
                    }
 
2591
                  else
 
2592
                    {
 
2593
                      long sindx;
 
2594
 
 
2595
                      if (bfd_is_abs_section (sec))
 
2596
                        sindx = 0;
 
2597
                      else if (sec == NULL || sec->owner == NULL)
 
2598
                        {
 
2599
                          bfd_set_error(bfd_error_bad_value);
 
2600
                          return FALSE;
 
2601
                        }
 
2602
                      else
 
2603
                        {
 
2604
                          asection *osec;
 
2605
 
 
2606
                          osec = sec->output_section;
 
2607
                          sindx = elf_section_data (osec)->dynindx;
 
2608
                          BFD_ASSERT (sindx > 0);
 
2609
 
 
2610
                          /* We are turning this relocation into one
 
2611
                             against a section symbol, so subtract out
 
2612
                             the output section's address but not the
 
2613
                             offset of the input section in the output
 
2614
                             section.  */
 
2615
 
 
2616
                          outrel.r_addend -= osec->vma;
 
2617
                        }
 
2618
                      outrel.r_info = ELF64_R_INFO (sindx, r_type);
 
2619
                    }
2613
2620
                }
2614
2621
 
2615
2622
              sreloc = elf_section_data (input_section)->sreloc;
3411
3418
#define elf_backend_plt_readonly        1
3412
3419
#define elf_backend_want_plt_sym        0
3413
3420
#define elf_backend_got_header_size     24
3414
 
#define elf_backend_plt_header_size     PLT_ENTRY_SIZE
3415
3421
#define elf_backend_rela_normal         1
3416
3422
 
3417
3423
#define elf_info_to_howto               elf_s390_info_to_howto