Add CRX insns: pushx, popx
[deliverable/binutils-gdb.git] / bfd / bfd.c
index f8ed3407637802812f1d5f60926fdaaad803e95d..209b1b681a74f50e898c0b1c5acf71176714d0d3 100644 (file)
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -1,6 +1,6 @@
 /* Generic BFD library interface and support routines.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003
+   2000, 2001, 2002, 2003, 2004
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -765,12 +765,14 @@ bfd_get_sign_extend_vma (bfd *abfd)
 
   name = bfd_get_target (abfd);
 
-  /* Return a proper value for DJGPP COFF (an x86 COFF variant).
+  /* Return a proper value for DJGPP & PE COFF (x86 COFF variants).
      This function is required for DWARF2 support, but there is
      no place to store this information in the COFF back end.
      Should enough other COFF targets add support for DWARF2,
      a place will have to be found.  Until then, this hack will do.  */
-  if (strncmp (name, "coff-go32", sizeof ("coff-go32") - 1) == 0)
+  if (strncmp (name, "coff-go32", sizeof ("coff-go32") - 1) == 0
+      || strcmp (name, "pe-i386") == 0
+      || strcmp (name, "pei-i386") == 0)
     return 1;
 
   bfd_set_error (bfd_error_wrong_format);
@@ -978,6 +980,29 @@ bfd_scan_vma (const char *string, const char **end, int base)
   return value;
 }
 
+/*
+FUNCTION
+       bfd_copy_private_header_data
+
+SYNOPSIS
+       bfd_boolean bfd_copy_private_header_data (bfd *ibfd, bfd *obfd);
+
+DESCRIPTION
+       Copy private BFD header information from the BFD @var{ibfd} to the
+       the BFD @var{obfd}.  This copies information that may require
+       sections to exist, but does not require symbol tables.  Return
+       <<true>> on success, <<false>> on error.
+       Possible error returns are:
+
+       o <<bfd_error_no_memory>> -
+       Not enough memory exists to create private data for @var{obfd}.
+
+.#define bfd_copy_private_header_data(ibfd, obfd) \
+.     BFD_SEND (obfd, _bfd_copy_private_header_data, \
+.              (ibfd, obfd))
+
+*/
+
 /*
 FUNCTION
        bfd_copy_private_bfd_data
@@ -1081,6 +1106,9 @@ DESCRIPTION
 .#define bfd_merge_sections(abfd, link_info) \
 .      BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
 .
+.#define bfd_is_group_section(abfd, sec) \
+.      BFD_SEND (abfd, _bfd_is_group_section, (abfd, sec))
+.
 .#define bfd_discard_group(abfd, sec) \
 .      BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
 .
@@ -1111,6 +1139,9 @@ DESCRIPTION
 .#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
 .      BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
 .
+.#define bfd_get_synthetic_symtab(abfd, dynsyms, ret) \
+.      BFD_SEND (abfd, _bfd_get_synthetic_symtab, (abfd, dynsyms, ret))
+.
 .#define bfd_get_dynamic_reloc_upper_bound(abfd) \
 .      BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
 .
@@ -1386,3 +1417,46 @@ bfd_preserve_finish (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_preserve *preserve)
      objalloc.  */
   bfd_hash_table_free (&preserve->section_htab);
 }
+
+/*
+FUNCTION
+       bfd_get_section_ident
+
+SYNOPSIS
+       char *bfd_get_section_ident (asection *sec);
+
+DESCRIPTION
+       This function returns "section name[group name]" in a malloced
+       buffer if @var{sec} is a member of an ELF section group and
+       returns NULL otherwise. The caller should free the non-NULL
+       return after use.
+
+*/
+
+char *
+bfd_get_section_ident (asection *sec)
+{
+  char *buf;
+  bfd_size_type nlen;
+  bfd_size_type glen;
+
+  if (sec->owner == NULL
+      || bfd_get_flavour (sec->owner) != bfd_target_elf_flavour
+      || elf_next_in_group (sec) == NULL
+      || (sec->flags & SEC_GROUP) != 0)
+    return NULL;
+
+  nlen = strlen (sec->name);
+  glen = strlen (elf_group_name (sec));
+  buf = bfd_malloc (nlen + glen + 2 + 1);
+  if (buf != NULL)
+    {
+      strcpy (buf, sec->name);
+      buf [nlen] = '[';
+      strcpy (&buf [nlen + 1], elf_group_name (sec));
+      buf [nlen + 1 + glen] = ']';
+      buf [nlen + 1 + glen + 1] = '\0';
+    }
+
+  return buf;
+}
This page took 0.0262 seconds and 4 git commands to generate.