~ubuntu-branches/debian/jessie/gdb/jessie

« back to all changes in this revision

Viewing changes to bfd/elf32-hppa.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Jacobowitz
  • Date: 2010-03-20 01:21:29 UTC
  • mfrom: (1.3.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20100320012129-t7h25y8zgr8c2369
Tags: 7.1-1
* New upstream release, including:
  - PIE support (Closes: #346409).
  - C++ improvements, including static_cast<> et al, namespace imports,
    and bug fixes in printing virtual base classes.
  - Multi-program debugging.  One GDB can now debug multiple programs
    at the same time.
  - Python scripting improvements, including gdb.parse_and_eval.
  - Updated MIPS Linux signal frame layout (Closes: #570875).
  - No internal error stepping over _dl_debug_state (Closes: #569551).
* Update to Standards-Version: 3.8.4 (no changes required).
* Include more relevant (and smaller) docs in the gdbserver package
  (Closes: #571132).
* Do not duplicate documentation in gdb64, gdb-source, and libgdb-dev.
* Fix crash when switching into TUI mode (Closes: #568489).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* BFD back-end for HP PA-RISC ELF files.
2
2
   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001,
3
 
   2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
 
3
   2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
4
4
   Free Software Foundation, Inc.
5
5
 
6
6
   Original code by
314
314
 
315
315
/* Various hash macros and functions.  */
316
316
#define hppa_link_hash_table(p) \
317
 
  ((struct elf32_hppa_link_hash_table *) ((p)->hash))
 
317
  (elf_hash_table_id ((struct elf_link_hash_table *) ((p)->hash)) \
 
318
  == HPPA32_ELF_DATA ? ((struct elf32_hppa_link_hash_table *) ((p)->hash)) : NULL)
318
319
 
319
320
#define hppa_elf_hash_entry(ent) \
320
321
  ((struct elf32_hppa_link_hash_entry *)(ent))
341
342
elf32_hppa_mkobject (bfd *abfd)
342
343
{
343
344
  return bfd_elf_allocate_object (abfd, sizeof (struct elf_obj_tdata),
344
 
                                  HPPA_ELF_TDATA);
 
345
                                  HPPA32_ELF_DATA);
345
346
}
346
347
 
347
348
/* Assorted hash table functions.  */
432
433
    return NULL;
433
434
 
434
435
  if (!_bfd_elf_link_hash_table_init (&htab->etab, abfd, hppa_link_hash_newfunc,
435
 
                                      sizeof (struct elf32_hppa_link_hash_entry)))
 
436
                                      sizeof (struct elf32_hppa_link_hash_entry),
 
437
                                      HPPA32_ELF_DATA))
436
438
    {
437
439
      free (htab);
438
440
      return NULL;
728
730
  info = (struct bfd_link_info *)in_arg;
729
731
 
730
732
  htab = hppa_link_hash_table (info);
 
733
  if (htab == NULL)
 
734
    return FALSE;
 
735
 
731
736
  stub_sec = hsh->stub_sec;
732
737
 
733
738
  /* Make a note of the offset within the stubs for this entry.  */
1000
1005
 
1001
1006
  /* Don't try to create the .plt and .got twice.  */
1002
1007
  htab = hppa_link_hash_table (info);
 
1008
  if (htab == NULL)
 
1009
    return FALSE;
1003
1010
  if (htab->splt != NULL)
1004
1011
    return TRUE;
1005
1012
 
1160
1167
    return TRUE;
1161
1168
 
1162
1169
  htab = hppa_link_hash_table (info);
 
1170
  if (htab == NULL)
 
1171
    return FALSE;
1163
1172
  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
1164
1173
  eh_syms = elf_sym_hashes (abfd);
1165
1174
  sreloc = NULL;
1369
1378
 
1370
1379
          if (r_type == R_PARISC_TLS_LDM21L
1371
1380
              || r_type == R_PARISC_TLS_LDM14R)
1372
 
            hppa_link_hash_table (info)->tls_ldm_got.refcount += 1;
 
1381
            htab->tls_ldm_got.refcount += 1;
1373
1382
          else
1374
1383
            {
1375
1384
              if (hh != NULL)
1601
1610
  bfd_signed_vma *local_got_refcounts;
1602
1611
  bfd_signed_vma *local_plt_refcounts;
1603
1612
  const Elf_Internal_Rela *rela, *relend;
 
1613
  struct elf32_hppa_link_hash_table *htab;
1604
1614
 
1605
1615
  if (info->relocatable)
1606
1616
    return TRUE;
1607
1617
 
 
1618
  htab = hppa_link_hash_table (info);
 
1619
  if (htab == NULL)
 
1620
    return FALSE;
 
1621
 
1608
1622
  elf_section_data (sec)->local_dynrel = NULL;
1609
1623
 
1610
1624
  symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
1669
1683
 
1670
1684
        case R_PARISC_TLS_LDM21L:
1671
1685
        case R_PARISC_TLS_LDM14R:
1672
 
          hppa_link_hash_table (info)->tls_ldm_got.refcount -= 1;
 
1686
          htab->tls_ldm_got.refcount -= 1;
1673
1687
          break;
1674
1688
 
1675
1689
        case R_PARISC_PCREL12F:
1904
1918
     same memory location for the variable.  */
1905
1919
 
1906
1920
  htab = hppa_link_hash_table (info);
 
1921
  if (htab == NULL)
 
1922
    return FALSE;
1907
1923
 
1908
1924
  /* We must generate a COPY reloc to tell the dynamic linker to
1909
1925
     copy the initial value out of the dynamic object and into the
1939
1955
  info = (struct bfd_link_info *) inf;
1940
1956
  hh = hppa_elf_hash_entry (eh);
1941
1957
  htab = hppa_link_hash_table (info);
 
1958
  if (htab == NULL)
 
1959
    return FALSE;
 
1960
 
1942
1961
  if (htab->etab.dynamic_sections_created
1943
1962
      && eh->plt.refcount > 0)
1944
1963
    {
2005
2024
 
2006
2025
  info = inf;
2007
2026
  htab = hppa_link_hash_table (info);
 
2027
  if (htab == NULL)
 
2028
    return FALSE;
 
2029
 
2008
2030
  hh = hppa_elf_hash_entry (eh);
2009
2031
  
2010
2032
  if (htab->etab.dynamic_sections_created
2212
2234
  bfd_boolean relocs;
2213
2235
 
2214
2236
  htab = hppa_link_hash_table (info);
 
2237
  if (htab == NULL)
 
2238
    return FALSE;
 
2239
 
2215
2240
  dynobj = htab->etab.dynobj;
2216
2241
  if (dynobj == NULL)
2217
2242
    abort ();
2505
2530
  bfd_size_type amt;
2506
2531
  struct elf32_hppa_link_hash_table *htab = hppa_link_hash_table (info);
2507
2532
 
 
2533
  if (htab == NULL)
 
2534
    return -1;
 
2535
 
2508
2536
  /* Count the number of input BFDs and find the top input section id.  */
2509
2537
  for (input_bfd = info->input_bfds, bfd_count = 0, top_id = 0;
2510
2538
       input_bfd != NULL;
2572
2600
{
2573
2601
  struct elf32_hppa_link_hash_table *htab = hppa_link_hash_table (info);
2574
2602
 
 
2603
  if (htab == NULL)
 
2604
    return;
 
2605
 
2575
2606
  if (isec->output_section->index <= htab->top_index)
2576
2607
    {
2577
2608
      asection **list = htab->input_list + isec->output_section->index;
2679
2710
  int stub_changed = 0;
2680
2711
  struct elf32_hppa_link_hash_table *htab = hppa_link_hash_table (info);
2681
2712
 
 
2713
  if (htab == NULL)
 
2714
    return -1;
 
2715
 
2682
2716
  /* We want to read in symbol extension records only once.  To do this
2683
2717
     we need to read in the local symbols in parallel and save them for
2684
2718
     later use; so hold pointers to the local symbols in an array.  */
2807
2841
  bfd_boolean stub_changed;
2808
2842
  struct elf32_hppa_link_hash_table *htab = hppa_link_hash_table (info);
2809
2843
 
 
2844
  if (htab == NULL)
 
2845
    return FALSE;
 
2846
 
2810
2847
  /* Stash our params away.  */
2811
2848
  htab->stub_bfd = stub_bfd;
2812
2849
  htab->multi_subspace = multi_subspace;
3092
3129
  struct elf32_hppa_link_hash_table *htab;
3093
3130
 
3094
3131
  htab = hppa_link_hash_table (info);
 
3132
  if (htab == NULL)
 
3133
    return FALSE;
 
3134
 
3095
3135
  h = bfd_link_hash_lookup (&htab->etab.root, "$global$", FALSE, FALSE, FALSE);
3096
3136
 
3097
3137
  if (h != NULL
3176
3216
  struct elf32_hppa_link_hash_table *htab;
3177
3217
 
3178
3218
  htab = hppa_link_hash_table (info);
 
3219
  if (htab == NULL)
 
3220
    return FALSE;
3179
3221
 
3180
3222
  for (stub_sec = htab->stub_bfd->sections;
3181
3223
       stub_sec != NULL;
3238
3280
 
3239
3281
  /* If we're producing a final executable, sort the contents of the
3240
3282
     unwind section.  */
 
3283
  if (info->relocatable)
 
3284
    return TRUE;
 
3285
 
3241
3286
  return elf_hppa_sort_unwind (abfd);
3242
3287
}
3243
3288
 
3249
3294
  struct elf32_hppa_link_hash_table *htab;
3250
3295
 
3251
3296
  htab = (struct elf32_hppa_link_hash_table*) data;
 
3297
  if (htab == NULL)
 
3298
    return;
3252
3299
 
3253
3300
  if ((section->flags & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD))
3254
3301
    {
3385
3432
    case R_PARISC_DPREL21L:
3386
3433
    case R_PARISC_DPREL14R:
3387
3434
    case R_PARISC_DPREL14F:
 
3435
    case R_PARISC_TLS_GD21L:
 
3436
    case R_PARISC_TLS_LDM21L:
 
3437
    case R_PARISC_TLS_IE21L:
3388
3438
      /* Convert instructions that use the linkage table pointer (r19) to
3389
3439
         instructions that use the global data pointer (dp).  This is the
3390
3440
         most efficient way of using PIC code in an incomplete executable,
3391
3441
         but the user must follow the standard runtime conventions for
3392
3442
         accessing data for this to work.  */
3393
 
      if (orig_r_type == R_PARISC_DLTIND21L)
 
3443
      if (orig_r_type == R_PARISC_DLTIND21L
 
3444
          || (!info->shared
 
3445
              && (r_type == R_PARISC_TLS_GD21L
 
3446
                  || r_type == R_PARISC_TLS_LDM21L
 
3447
                  || r_type == R_PARISC_TLS_IE21L)))
3394
3448
        {
3395
3449
          /* Convert addil instructions if the original reloc was a
3396
3450
             DLTIND21L.  GCC sometimes uses a register other than r19 for
3441
3495
    case R_PARISC_DLTIND21L:
3442
3496
    case R_PARISC_DLTIND14R:
3443
3497
    case R_PARISC_DLTIND14F:
3444
 
    case R_PARISC_TLS_GD21L:
3445
3498
    case R_PARISC_TLS_GD14R:
3446
 
    case R_PARISC_TLS_LDM21L:
3447
3499
    case R_PARISC_TLS_LDM14R:
3448
 
    case R_PARISC_TLS_IE21L:
3449
3500
    case R_PARISC_TLS_IE14R:
3450
3501
      value -= elf_gp (input_section->output_section->owner);
3451
3502
      break;
3626
3677
  symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
3627
3678
 
3628
3679
  htab = hppa_link_hash_table (info);
 
3680
  if (htab == NULL)
 
3681
    return FALSE;
 
3682
 
3629
3683
  local_got_offsets = elf_local_got_offsets (input_bfd);
3630
3684
 
3631
3685
  rela = relocs;
4293
4347
  bfd_byte *loc;
4294
4348
 
4295
4349
  htab = hppa_link_hash_table (info);
 
4350
  if (htab == NULL)
 
4351
    return FALSE;
4296
4352
 
4297
4353
  if (eh->plt.offset != (bfd_vma) -1)
4298
4354
    {
4462
4518
  asection *sdyn;
4463
4519
 
4464
4520
  htab = hppa_link_hash_table (info);
 
4521
  if (htab == NULL)
 
4522
    return FALSE;
 
4523
 
4465
4524
  dynobj = htab->etab.dynobj;
4466
4525
 
4467
4526
  sdyn = bfd_get_section_by_name (dynobj, ".dynamic");