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

« back to all changes in this revision

Viewing changes to bfd/targets.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:
328
328
.  NAME##_truncate_arname, \
329
329
.  NAME##_write_armap, \
330
330
.  NAME##_read_ar_hdr, \
 
331
.  NAME##_write_ar_hdr, \
331
332
.  NAME##_openr_next_archived_file, \
332
333
.  NAME##_get_elt_at_index, \
333
334
.  NAME##_generic_stat_arch_elt, \
341
342
.  bfd_boolean (*write_armap)
342
343
.    (bfd *, unsigned int, struct orl *, unsigned int, int);
343
344
.  void *      (*_bfd_read_ar_hdr_fn) (bfd *);
 
345
.  bfd_boolean (*_bfd_write_ar_hdr_fn) (bfd *, bfd *);
344
346
.  bfd *       (*openr_next_archived_file) (bfd *, bfd *);
345
347
.#define bfd_get_elt_at_index(b,i) BFD_SEND (b, _bfd_get_elt_at_index, (b,i))
346
348
.  bfd *       (*_bfd_get_elt_at_index) (bfd *, symindex);
436
438
.  NAME##_bfd_link_hash_table_free, \
437
439
.  NAME##_bfd_link_add_symbols, \
438
440
.  NAME##_bfd_link_just_syms, \
 
441
.  NAME##_bfd_copy_link_hash_symbol_type, \
439
442
.  NAME##_bfd_final_link, \
440
443
.  NAME##_bfd_link_split_section, \
441
444
.  NAME##_bfd_gc_sections, \
467
470
.  {* Indicate that we are only retrieving symbol values from this section.  *}
468
471
.  void        (*_bfd_link_just_syms) (asection *, struct bfd_link_info *);
469
472
.
 
473
.  {* Copy the symbol type of a linker hash table entry.  *}
 
474
.#define bfd_copy_link_hash_symbol_type(b, t, f) \
 
475
.  BFD_SEND (b, _bfd_copy_link_hash_symbol_type, (b, t, f))
 
476
.  void (*_bfd_copy_link_hash_symbol_type)
 
477
.    (bfd *, struct bfd_link_hash_entry *, struct bfd_link_hash_entry *);
 
478
.
470
479
.  {* Do a link based on the link_order structures attached to each
471
480
.     section of the BFD.  *}
472
481
.  bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *);
641
650
extern const bfd_target bfd_elf32_powerpc_vec;
642
651
extern const bfd_target bfd_elf32_powerpcle_vec;
643
652
extern const bfd_target bfd_elf32_powerpc_vxworks_vec;
 
653
extern const bfd_target bfd_elf32_rx_le_vec;
 
654
extern const bfd_target bfd_elf32_rx_be_vec;
644
655
extern const bfd_target bfd_elf32_s390_vec;
645
656
extern const bfd_target bfd_elf32_bigscore_vec;
646
657
extern const bfd_target bfd_elf32_littlescore_vec;
751
762
extern const bfd_target mach_o_le_vec;
752
763
extern const bfd_target mach_o_fat_vec;
753
764
extern const bfd_target mach_o_i386_vec;
 
765
extern const bfd_target mach_o_x86_64_vec;
754
766
extern const bfd_target maxqcoff_vec;
755
767
extern const bfd_target mcore_pe_big_vec;
756
768
extern const bfd_target mcore_pe_little_vec;
978
990
        &bfd_elf32_powerpc_vec,
979
991
        &bfd_elf32_powerpc_vxworks_vec,
980
992
        &bfd_elf32_powerpcle_vec,
 
993
        &bfd_elf32_rx_be_vec,
 
994
        &bfd_elf32_rx_le_vec,
981
995
        &bfd_elf32_s390_vec,
982
996
#ifdef BFD64
983
997
        &bfd_elf32_bigscore_vec,
1123
1137
        &mach_o_le_vec,
1124
1138
        &mach_o_fat_vec,
1125
1139
        &mach_o_i386_vec,
 
1140
#ifdef BFD64
 
1141
        &mach_o_x86_64_vec,
 
1142
#endif
1126
1143
        &maxqcoff_vec,
1127
1144
        &mcore_pe_big_vec,
1128
1145
        &mcore_pe_little_vec,
1424
1441
  return target;
1425
1442
}
1426
1443
 
 
1444
/* Helper function for bfd_get_target_info to determine the target's
 
1445
   architecture.  This method handles bfd internal target names as
 
1446
   tuples and triplets.  */
 
1447
static bfd_boolean
 
1448
_bfd_find_arch_match (const char *tname, const char **arch,
 
1449
                      const char **def_target_arch)
 
1450
{
 
1451
  if (!arch)
 
1452
    return FALSE;
 
1453
 
 
1454
  while (*arch != NULL)
 
1455
    {
 
1456
      const char *in_a = strstr (*arch, tname);
 
1457
      char end_ch = (in_a ? in_a[strlen (tname)] : 0);
 
1458
 
 
1459
      if (in_a && (in_a == *arch || in_a[-1] == ':')
 
1460
          && end_ch == 0)
 
1461
        {
 
1462
          *def_target_arch = *arch;
 
1463
          return TRUE;
 
1464
        }
 
1465
      arch++;
 
1466
    }
 
1467
  return FALSE;
 
1468
}
 
1469
 
 
1470
/*
 
1471
FUNCTION
 
1472
        bfd_get_target_info
 
1473
SYNOPSIS
 
1474
        const bfd_target *bfd_get_target_info (const char *target_name,
 
1475
                                               bfd *abfd,
 
1476
                                               bfd_boolean *is_bigendian,
 
1477
                                               int *underscoring,
 
1478
                                               const char **def_target_arch);
 
1479
DESCRIPTION
 
1480
        Return a pointer to the transfer vector for the object target
 
1481
        named @var{target_name}.  If @var{target_name} is <<NULL>>,
 
1482
        choose the one in the environment variable <<GNUTARGET>>; if
 
1483
        that is null or not defined, then choose the first entry in the
 
1484
        target list.  Passing in the string "default" or setting the
 
1485
        environment variable to "default" will cause the first entry in
 
1486
        the target list to be returned, and "target_defaulted" will be
 
1487
        set in the BFD if @var{abfd} isn't <<NULL>>.  This causes
 
1488
        <<bfd_check_format>> to loop over all the targets to find the
 
1489
        one that matches the file being read.
 
1490
        If @var{is_bigendian} is not <<NULL>>, then set this value to target's
 
1491
        endian mode. True for big-endian, FALSE for little-endian or for
 
1492
        invalid target.
 
1493
        If @var{underscoring} is not <<NULL>>, then set this value to target's
 
1494
        underscoring mode. Zero for none-underscoring, -1 for invalid target,
 
1495
        else the value of target vector's symbol underscoring.
 
1496
        If @var{def_target_arch} is not <<NULL>>, then set it to the architecture
 
1497
        string specified by the target_name.
 
1498
*/
 
1499
const bfd_target *
 
1500
bfd_get_target_info (const char *target_name, bfd *abfd,
 
1501
                     bfd_boolean *is_bigendian,
 
1502
                     int *underscoring, const char **def_target_arch)
 
1503
{
 
1504
  const bfd_target *target_vec;
 
1505
 
 
1506
  if (is_bigendian)
 
1507
    *is_bigendian = FALSE;
 
1508
  if (underscoring)
 
1509
    *underscoring = -1;
 
1510
  if (def_target_arch)
 
1511
    *def_target_arch = NULL;
 
1512
  target_vec = bfd_find_target (target_name, abfd);
 
1513
  if (! target_vec)
 
1514
    return NULL;
 
1515
  if (is_bigendian)
 
1516
    *is_bigendian = ((target_vec->byteorder == BFD_ENDIAN_BIG) ? TRUE
 
1517
                                                               : FALSE);
 
1518
  if (underscoring)
 
1519
    *underscoring = ((int) target_vec->symbol_leading_char) & 0xff;
 
1520
 
 
1521
  if (def_target_arch)
 
1522
    {
 
1523
      const char *tname = target_vec->name;
 
1524
      const char **arches = bfd_arch_list ();
 
1525
 
 
1526
      if (arches && tname)
 
1527
        {
 
1528
          char *hyp = strchr (tname, '-');
 
1529
 
 
1530
          if (hyp != NULL)
 
1531
            {
 
1532
              tname = ++hyp;
 
1533
 
 
1534
              /* Make sure we detect architecture names
 
1535
                 for triplets like "pe-arm-wince-little".  */
 
1536
              if (!_bfd_find_arch_match (tname, arches, def_target_arch))
 
1537
                {
 
1538
                  char new_tname[50];
 
1539
 
 
1540
                  strcpy (new_tname, hyp);
 
1541
                  while ((hyp = strrchr (new_tname, '-')) != NULL)
 
1542
                    {
 
1543
                      *hyp = 0;
 
1544
                      if (_bfd_find_arch_match (new_tname, arches,
 
1545
                                                def_target_arch))
 
1546
                        break;
 
1547
                    }
 
1548
                }
 
1549
            }
 
1550
          else
 
1551
            _bfd_find_arch_match (tname, arches, def_target_arch);
 
1552
        }
 
1553
 
 
1554
      if (arches)
 
1555
        free (arches);
 
1556
    }
 
1557
  return target_vec;
 
1558
}
 
1559
 
1427
1560
/*
1428
1561
FUNCTION
1429
1562
        bfd_target_list