aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-04-30 20:42:30 +0930
committerAlan Modra <amodra@gmail.com>2023-05-03 15:00:05 +0930
commit717d4bd6d199fcf834f741489aaf3bd800f9769f (patch)
tree41ecfc03c6cd82e376d3b8bfe328842af6a7a250
parenta41bd1c837f9b71b44dbb71c2d47814326cfaa8d (diff)
downloadgdb-717d4bd6d199fcf834f741489aaf3bd800f9769f.zip
gdb-717d4bd6d199fcf834f741489aaf3bd800f9769f.tar.gz
gdb-717d4bd6d199fcf834f741489aaf3bd800f9769f.tar.bz2
Generated docs and include files
bfd/doc/chew.c extracts documentation from source code comments annotated with keywords, and generates much of bfd.h and libbfd.h from those same comments. The docs have suffered from people (me too) adding things like CODE_FRAGMENT to the source to put code into bfd.h without realising that CODE_FRAGMENT also puts @example around said code into the docs. So we have random senseless things in the docs. This patch fixes that problem (well, the senseless things from CODE_FRAGMENT), moves most of the code out of bfd-in.h, and improves a few chew.c features. libbfd.h now automatically gets ATTRIBUTE_HIDDEN prototypes, and indentation in bfd.h and libbfd.h is better.
-rw-r--r--bfd/Makefile.am13
-rw-r--r--bfd/Makefile.in13
-rw-r--r--bfd/archive.c31
-rw-r--r--bfd/archures.c1
-rw-r--r--bfd/bfd-in.h297
-rw-r--r--bfd/bfd-in2.h3153
-rw-r--r--bfd/bfd.c68
-rw-r--r--bfd/bfdio.c75
-rw-r--r--bfd/bfdwin.c64
-rw-r--r--bfd/cache.c2
-rw-r--r--bfd/coffcode.h14
-rw-r--r--bfd/compress.c2
-rw-r--r--bfd/doc/chew.c53
-rw-r--r--bfd/doc/doc.str25
-rw-r--r--bfd/doc/proto.str41
-rw-r--r--bfd/elfxx-mips.h2
-rw-r--r--bfd/hash.c272
-rw-r--r--bfd/libbfd-in.h64
-rw-r--r--bfd/libbfd.c37
-rw-r--r--bfd/libbfd.h207
-rw-r--r--bfd/libcoff.h7
-rw-r--r--bfd/linker.c1
-rw-r--r--bfd/opncls.c36
-rw-r--r--bfd/reloc.c26
-rw-r--r--bfd/section.c21
-rw-r--r--bfd/stab-syms.c11
-rw-r--r--bfd/stabs.c94
-rw-r--r--bfd/syms.c29
-rw-r--r--bfd/targets.c16
-rw-r--r--gas/obj.h2
30 files changed, 2458 insertions, 2219 deletions
diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index 0992293..5c5fdef 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -904,13 +904,14 @@ stmp-bfd-h: bfd-in3.h
rm -f bfd-tmp.h
touch stmp-bfd-h
-BFD_H_FILES = bfd-in.h opncls.c libbfd.c \
- bfdio.c bfdwin.c section.c archures.c reloc.c \
- syms.c bfd.c archive.c corefile.c targets.c format.c \
- linker.c simple.c compress.c
+BFD_H_FILES = bfd-in.h libbfd.c hash.c section.c syms.c \
+ archive.c archures.c bfd.c bfdio.c bfdwin.c \
+ cache.c compress.c corefile.c format.c linker.c opncls.c \
+ reloc.c simple.c stab-syms.c stabs.c targets.c
BFD64_H_FILES = archive64.c
-LIBBFD_H_FILES = libbfd-in.h libbfd.c bfd.c bfdio.c bfdwin.c \
- cache.c reloc.c section.c targets.c archures.c linker.c
+LIBBFD_H_FILES = libbfd-in.h libbfd.c bfd.c bfdio.c \
+ archive.c archures.c bfdwin.c cache.c hash.c linker.c opncls.c \
+ reloc.c section.c stabs.c targets.c
LIBCOFF_H_FILES = libcoff-in.h coffcode.h
headers: stmp-bin2-h stmp-lbfd-h stmp-lcoff-h
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 5be3d1b..4edfede 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -1196,14 +1196,15 @@ libbfd_la_SOURCES = $(BFD32_LIBS_CFILES)
EXTRA_libbfd_la_SOURCES = $(CFILES)
libbfd_la_DEPENDENCIES = $(OFILES) ofiles ../libsframe/libsframe.la
libbfd_la_LIBADD = `cat ofiles` @SHARED_LIBADD@ $(LIBDL) $(ZLIB) $(ZSTD_LIBS) ../libsframe/libsframe.la
-BFD_H_FILES = bfd-in.h opncls.c libbfd.c \
- bfdio.c bfdwin.c section.c archures.c reloc.c \
- syms.c bfd.c archive.c corefile.c targets.c format.c \
- linker.c simple.c compress.c
+BFD_H_FILES = bfd-in.h libbfd.c hash.c section.c syms.c \
+ archive.c archures.c bfd.c bfdio.c bfdwin.c \
+ cache.c compress.c corefile.c format.c linker.c opncls.c \
+ reloc.c simple.c stab-syms.c stabs.c targets.c
BFD64_H_FILES = archive64.c
-LIBBFD_H_FILES = libbfd-in.h libbfd.c bfd.c bfdio.c bfdwin.c \
- cache.c reloc.c section.c targets.c archures.c linker.c
+LIBBFD_H_FILES = libbfd-in.h libbfd.c bfd.c bfdio.c \
+ archive.c archures.c bfdwin.c cache.c hash.c linker.c opncls.c \
+ reloc.c section.c stabs.c targets.c
LIBCOFF_H_FILES = libcoff-in.h coffcode.h
diff --git a/bfd/archive.c b/bfd/archive.c
index 01bfcfc..273a1b3 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -146,6 +146,37 @@ SUBSECTION
extern int errno;
#endif
+/*
+EXTERNAL
+.{* A canonical archive symbol. *}
+.{* This is a type pun with struct symdef/struct ranlib on purpose! *}
+.typedef struct carsym
+.{
+. const char *name;
+. file_ptr file_offset; {* Look here to find the file. *}
+.}
+.carsym;
+.
+.{* A count of carsyms (canonical archive symbols). *}
+. typedef unsigned long symindex;
+.#define BFD_NO_MORE_SYMBOLS ((symindex) ~0)
+.
+
+INTERNAL
+.{* Used in generating armaps (archive tables of contents). *}
+.struct orl {* Output ranlib. *}
+.{
+. char **name; {* Symbol name. *}
+. union
+. {
+. file_ptr pos;
+. bfd *abfd;
+. } u; {* bfd* or file position. *}
+. int namidx; {* Index into string table. *}
+.};
+.
+*/
+
/* We keep a cache of archive filepointers to archive elements to
speed up searching the archive by filepos. We only add an entry to
the cache when we actually read one. We also don't sort the cache;
diff --git a/bfd/archures.c b/bfd/archures.c
index ff1ee0f..6fe8701 100644
--- a/bfd/archures.c
+++ b/bfd/archures.c
@@ -947,6 +947,7 @@ DESCRIPTION
architecture of the file.
.extern const bfd_arch_info_type bfd_default_arch_struct;
+.
*/
const bfd_arch_info_type bfd_default_arch_struct =
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 889aa45..1476039 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -75,9 +75,6 @@ extern "C" {
#define BFD64
#endif
-/* Forward declaration. */
-typedef struct bfd bfd;
-
/* Boolean type used in bfd.
General rule: Functions which are bfd_boolean return TRUE on
success and FALSE on failure (unless they're a predicate). */
@@ -130,69 +127,16 @@ typedef uint32_t symvalue;
typedef @bfd_file_ptr@ file_ptr;
typedef @bfd_ufile_ptr@ ufile_ptr;
-extern void bfd_sprintf_vma (bfd *, char *, bfd_vma);
-extern void bfd_fprintf_vma (bfd *, void *, bfd_vma);
-
-#define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x)
-
typedef uint32_t flagword; /* 32 bits of flags */
typedef uint8_t bfd_byte;
-
-/* File formats. */
-
-typedef enum bfd_format
-{
- bfd_unknown = 0, /* File format is unknown. */
- bfd_object, /* Linker/assembler/compiler output. */
- bfd_archive, /* Object archive file. */
- bfd_core, /* Core dump. */
- bfd_type_end /* Marks the end; don't use it! */
-}
-bfd_format;
-
-/* Symbols and relocation. */
-
-/* A count of carsyms (canonical archive symbols). */
-typedef unsigned long symindex;
-
-#define BFD_NO_MORE_SYMBOLS ((symindex) ~0)
-/* A canonical archive symbol. */
-/* This is a type pun with struct ranlib on purpose! */
-typedef struct carsym
-{
- const char *name;
- file_ptr file_offset; /* Look here to find the file. */
-}
-carsym; /* To make these you call a carsymogen. */
-
-/* Used in generating armaps (archive tables of contents).
- Perhaps just a forward definition would do? */
-struct orl /* Output ranlib. */
-{
- char **name; /* Symbol name. */
- union
- {
- file_ptr pos;
- bfd *abfd;
- } u; /* bfd* or file position. */
- int namidx; /* Index into string table. */
-};
-
-/* Linenumber stuff. */
-typedef struct lineno_cache_entry
-{
- unsigned int line_number; /* Linenumber from start of function. */
- union
- {
- struct bfd_symbol *sym; /* Function name. */
- bfd_vma offset; /* Offset into section. */
- } u;
-}
-alent;
-
-/* Object and core file sections. */
+/* Forward declarations. */
+typedef struct bfd bfd;
+struct bfd_link_info;
+struct bfd_link_hash_entry;
typedef struct bfd_section *sec_ptr;
+typedef struct reloc_cache_entry arelent;
+struct orl;
#define align_power(addr, align) \
(((addr) + ((bfd_vma) 1 << (align)) - 1) & (-((bfd_vma) 1 << (align))))
@@ -205,234 +149,6 @@ typedef struct bfd_section *sec_ptr;
((((bfd_vma) (this) + (boundary) - 1) >= (bfd_vma) (this)) \
? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \
: ~ (bfd_vma) 0)
-
-typedef enum bfd_print_symbol
-{
- bfd_print_symbol_name,
- bfd_print_symbol_more,
- bfd_print_symbol_all
-} bfd_print_symbol_type;
-
-/* Information about a symbol that nm needs. */
-
-typedef struct _symbol_info
-{
- symvalue value;
- char type;
- const char *name; /* Symbol name. */
- unsigned char stab_type; /* Stab type. */
- char stab_other; /* Stab other. */
- short stab_desc; /* Stab desc. */
- const char *stab_name; /* String for stab type. */
-} symbol_info;
-
-/* Get the name of a stabs type code. */
-
-extern const char *bfd_get_stab_name (int);
-
-/* Hash table routines. There is no way to free up a hash table. */
-
-/* An element in the hash table. Most uses will actually use a larger
- structure, and an instance of this will be the first field. */
-
-struct bfd_hash_entry
-{
- /* Next entry for this hash code. */
- struct bfd_hash_entry *next;
- /* String being hashed. */
- const char *string;
- /* Hash code. This is the full hash code, not the index into the
- table. */
- unsigned long hash;
-};
-
-/* A hash table. */
-
-struct bfd_hash_table
-{
- /* The hash array. */
- struct bfd_hash_entry **table;
- /* A function used to create new elements in the hash table. The
- first entry is itself a pointer to an element. When this
- function is first invoked, this pointer will be NULL. However,
- having the pointer permits a hierarchy of method functions to be
- built each of which calls the function in the superclass. Thus
- each function should be written to allocate a new block of memory
- only if the argument is NULL. */
- struct bfd_hash_entry *(*newfunc)
- (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
- /* An objalloc for this hash table. This is a struct objalloc *,
- but we use void * to avoid requiring the inclusion of objalloc.h. */
- void *memory;
- /* The number of slots in the hash table. */
- unsigned int size;
- /* The number of entries in the hash table. */
- unsigned int count;
- /* The size of elements. */
- unsigned int entsize;
- /* If non-zero, don't grow the hash table. */
- unsigned int frozen:1;
-};
-
-/* Initialize a hash table. */
-extern bool bfd_hash_table_init
- (struct bfd_hash_table *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *),
- unsigned int);
-
-/* Initialize a hash table specifying a size. */
-extern bool bfd_hash_table_init_n
- (struct bfd_hash_table *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *),
- unsigned int, unsigned int);
-
-/* Free up a hash table. */
-extern void bfd_hash_table_free
- (struct bfd_hash_table *);
-
-/* Look up a string in a hash table. If CREATE is TRUE, a new entry
- will be created for this string if one does not already exist. The
- COPY argument must be TRUE if this routine should copy the string
- into newly allocated memory when adding an entry. */
-extern struct bfd_hash_entry *bfd_hash_lookup
- (struct bfd_hash_table *, const char *, bool create, bool copy);
-
-/* Insert an entry in a hash table. */
-extern struct bfd_hash_entry *bfd_hash_insert
- (struct bfd_hash_table *, const char *, unsigned long);
-
-/* Rename an entry in a hash table. */
-extern void bfd_hash_rename
- (struct bfd_hash_table *, const char *, struct bfd_hash_entry *);
-
-/* Replace an entry in a hash table. */
-extern void bfd_hash_replace
- (struct bfd_hash_table *, struct bfd_hash_entry *old,
- struct bfd_hash_entry *nw);
-
-/* Base method for creating a hash table entry. */
-extern struct bfd_hash_entry *bfd_hash_newfunc
- (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
-
-/* Grab some space for a hash table entry. */
-extern void *bfd_hash_allocate
- (struct bfd_hash_table *, unsigned int);
-
-/* Traverse a hash table in a random order, calling a function on each
- element. If the function returns FALSE, the traversal stops. The
- INFO argument is passed to the function. */
-extern void bfd_hash_traverse
- (struct bfd_hash_table *,
- bool (*) (struct bfd_hash_entry *, void *),
- void *info);
-
-/* Allows the default size of a hash table to be configured. New hash
- tables allocated using bfd_hash_table_init will be created with
- this size. */
-extern unsigned int bfd_hash_set_default_size (unsigned int);
-
-/* This structure is used to keep track of stabs in sections
- information while linking. */
-
-struct stab_info
-{
- /* A hash table used to hold stabs strings. */
- struct bfd_strtab_hash *strings;
- /* The header file hash table. */
- struct bfd_hash_table includes;
- /* The first .stabstr section. */
- struct bfd_section *stabstr;
-};
-
-#define COFF_SWAP_TABLE (void *) &bfd_coff_std_swap_table
-
-/* User program access to BFD facilities. */
-
-/* Direct I/O routines, for programs which know more about the object
- file than BFD does. Use higher level routines if possible. */
-
-extern bfd_size_type bfd_bread (void *, bfd_size_type, bfd *);
-extern bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *);
-extern int bfd_seek (bfd *, file_ptr, int);
-extern file_ptr bfd_tell (bfd *);
-extern int bfd_flush (bfd *);
-extern int bfd_stat (bfd *, struct stat *);
-
-extern bool bfd_cache_close
- (bfd *abfd);
-/* NB: This declaration should match the autogenerated one in libbfd.h. */
-
-extern bool bfd_cache_close_all (void);
-
-extern bool bfd_record_phdr
- (bfd *, unsigned long, bool, flagword, bool, bfd_vma,
- bool, bool, unsigned int, struct bfd_section **);
-
-/* Byte swapping routines. */
-
-uint64_t bfd_getb64 (const void *);
-uint64_t bfd_getl64 (const void *);
-int64_t bfd_getb_signed_64 (const void *);
-int64_t bfd_getl_signed_64 (const void *);
-bfd_vma bfd_getb32 (const void *);
-bfd_vma bfd_getl32 (const void *);
-bfd_signed_vma bfd_getb_signed_32 (const void *);
-bfd_signed_vma bfd_getl_signed_32 (const void *);
-bfd_vma bfd_getb16 (const void *);
-bfd_vma bfd_getl16 (const void *);
-bfd_signed_vma bfd_getb_signed_16 (const void *);
-bfd_signed_vma bfd_getl_signed_16 (const void *);
-void bfd_putb64 (uint64_t, void *);
-void bfd_putl64 (uint64_t, void *);
-void bfd_putb32 (bfd_vma, void *);
-void bfd_putl32 (bfd_vma, void *);
-void bfd_putb24 (bfd_vma, void *);
-void bfd_putl24 (bfd_vma, void *);
-void bfd_putb16 (bfd_vma, void *);
-void bfd_putl16 (bfd_vma, void *);
-
-/* Byte swapping routines which take size and endiannes as arguments. */
-
-uint64_t bfd_get_bits (const void *, int, bool);
-void bfd_put_bits (uint64_t, void *, int, bool);
-
-
-/* mmap hacks */
-
-struct _bfd_window_internal;
-typedef struct _bfd_window_internal bfd_window_internal;
-
-typedef struct _bfd_window
-{
- /* What the user asked for. */
- void *data;
- bfd_size_type size;
- /* The actual window used by BFD. Small user-requested read-only
- regions sharing a page may share a single window into the object
- file. Read-write versions shouldn't until I've fixed things to
- keep track of which portions have been claimed by the
- application; don't want to give the same region back when the
- application wants two writable copies! */
- struct _bfd_window_internal *i;
-}
-bfd_window;
-
-extern void bfd_init_window
- (bfd_window *);
-extern void bfd_free_window
- (bfd_window *);
-extern bool bfd_get_file_window
- (bfd *, file_ptr, bfd_size_type, bfd_window *, bool);
-/* Forward declarations. */
-struct ecoff_debug_info;
-struct ecoff_debug_swap;
-struct ecoff_extr;
-struct bfd_link_info;
-struct bfd_link_hash_entry;
/* Return TRUE if the start of STR matches PREFIX, FALSE otherwise. */
@@ -441,3 +157,4 @@ startswith (const char *str, const char *prefix)
{
return strncmp (str, prefix, strlen (prefix)) == 0;
}
+
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 0c1844d..a5a9f1c 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -1,8 +1,9 @@
/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically
- generated from "bfd-in.h", "opncls.c", "libbfd.c", "bfdio.c",
- "bfdwin.c", "section.c", "archures.c", "reloc.c", "syms.c", "bfd.c",
- "archive.c", "corefile.c", "targets.c", "format.c", "linker.c",
- "simple.c" and "compress.c".
+ generated from "bfd-in.h", "libbfd.c", "hash.c", "section.c",
+ "syms.c", "archive.c", "archures.c", "bfd.c", "bfdio.c", "bfdwin.c",
+ "cache.c", "compress.c", "corefile.c", "format.c", "linker.c",
+ "opncls.c", "reloc.c", "simple.c", "stab-syms.c", "stabs.c" and
+ "targets.c".
Run "make headers" in your build bfd/ to regenerate. */
/* Main header file for the bfd library -- portable access to object files.
@@ -82,9 +83,6 @@ extern "C" {
#define BFD64
#endif
-/* Forward declaration. */
-typedef struct bfd bfd;
-
/* Boolean type used in bfd.
General rule: Functions which are bfd_boolean return TRUE on
success and FALSE on failure (unless they're a predicate). */
@@ -137,69 +135,16 @@ typedef uint32_t symvalue;
typedef @bfd_file_ptr@ file_ptr;
typedef @bfd_ufile_ptr@ ufile_ptr;
-extern void bfd_sprintf_vma (bfd *, char *, bfd_vma);
-extern void bfd_fprintf_vma (bfd *, void *, bfd_vma);
-
-#define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x)
-
typedef uint32_t flagword; /* 32 bits of flags */
typedef uint8_t bfd_byte;
-
-/* File formats. */
-
-typedef enum bfd_format
-{
- bfd_unknown = 0, /* File format is unknown. */
- bfd_object, /* Linker/assembler/compiler output. */
- bfd_archive, /* Object archive file. */
- bfd_core, /* Core dump. */
- bfd_type_end /* Marks the end; don't use it! */
-}
-bfd_format;
-
-/* Symbols and relocation. */
-
-/* A count of carsyms (canonical archive symbols). */
-typedef unsigned long symindex;
-#define BFD_NO_MORE_SYMBOLS ((symindex) ~0)
-
-/* A canonical archive symbol. */
-/* This is a type pun with struct ranlib on purpose! */
-typedef struct carsym
-{
- const char *name;
- file_ptr file_offset; /* Look here to find the file. */
-}
-carsym; /* To make these you call a carsymogen. */
-
-/* Used in generating armaps (archive tables of contents).
- Perhaps just a forward definition would do? */
-struct orl /* Output ranlib. */
-{
- char **name; /* Symbol name. */
- union
- {
- file_ptr pos;
- bfd *abfd;
- } u; /* bfd* or file position. */
- int namidx; /* Index into string table. */
-};
-
-/* Linenumber stuff. */
-typedef struct lineno_cache_entry
-{
- unsigned int line_number; /* Linenumber from start of function. */
- union
- {
- struct bfd_symbol *sym; /* Function name. */
- bfd_vma offset; /* Offset into section. */
- } u;
-}
-alent;
-
-/* Object and core file sections. */
+/* Forward declarations. */
+typedef struct bfd bfd;
+struct bfd_link_info;
+struct bfd_link_hash_entry;
typedef struct bfd_section *sec_ptr;
+typedef struct reloc_cache_entry arelent;
+struct orl;
#define align_power(addr, align) \
(((addr) + ((bfd_vma) 1 << (align)) - 1) & (-((bfd_vma) 1 << (align))))
@@ -212,234 +157,6 @@ typedef struct bfd_section *sec_ptr;
((((bfd_vma) (this) + (boundary) - 1) >= (bfd_vma) (this)) \
? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \
: ~ (bfd_vma) 0)
-
-typedef enum bfd_print_symbol
-{
- bfd_print_symbol_name,
- bfd_print_symbol_more,
- bfd_print_symbol_all
-} bfd_print_symbol_type;
-
-/* Information about a symbol that nm needs. */
-
-typedef struct _symbol_info
-{
- symvalue value;
- char type;
- const char *name; /* Symbol name. */
- unsigned char stab_type; /* Stab type. */
- char stab_other; /* Stab other. */
- short stab_desc; /* Stab desc. */
- const char *stab_name; /* String for stab type. */
-} symbol_info;
-
-/* Get the name of a stabs type code. */
-
-extern const char *bfd_get_stab_name (int);
-
-/* Hash table routines. There is no way to free up a hash table. */
-
-/* An element in the hash table. Most uses will actually use a larger
- structure, and an instance of this will be the first field. */
-
-struct bfd_hash_entry
-{
- /* Next entry for this hash code. */
- struct bfd_hash_entry *next;
- /* String being hashed. */
- const char *string;
- /* Hash code. This is the full hash code, not the index into the
- table. */
- unsigned long hash;
-};
-
-/* A hash table. */
-
-struct bfd_hash_table
-{
- /* The hash array. */
- struct bfd_hash_entry **table;
- /* A function used to create new elements in the hash table. The
- first entry is itself a pointer to an element. When this
- function is first invoked, this pointer will be NULL. However,
- having the pointer permits a hierarchy of method functions to be
- built each of which calls the function in the superclass. Thus
- each function should be written to allocate a new block of memory
- only if the argument is NULL. */
- struct bfd_hash_entry *(*newfunc)
- (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
- /* An objalloc for this hash table. This is a struct objalloc *,
- but we use void * to avoid requiring the inclusion of objalloc.h. */
- void *memory;
- /* The number of slots in the hash table. */
- unsigned int size;
- /* The number of entries in the hash table. */
- unsigned int count;
- /* The size of elements. */
- unsigned int entsize;
- /* If non-zero, don't grow the hash table. */
- unsigned int frozen:1;
-};
-
-/* Initialize a hash table. */
-extern bool bfd_hash_table_init
- (struct bfd_hash_table *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *),
- unsigned int);
-
-/* Initialize a hash table specifying a size. */
-extern bool bfd_hash_table_init_n
- (struct bfd_hash_table *,
- struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
- struct bfd_hash_table *,
- const char *),
- unsigned int, unsigned int);
-
-/* Free up a hash table. */
-extern void bfd_hash_table_free
- (struct bfd_hash_table *);
-
-/* Look up a string in a hash table. If CREATE is TRUE, a new entry
- will be created for this string if one does not already exist. The
- COPY argument must be TRUE if this routine should copy the string
- into newly allocated memory when adding an entry. */
-extern struct bfd_hash_entry *bfd_hash_lookup
- (struct bfd_hash_table *, const char *, bool create, bool copy);
-
-/* Insert an entry in a hash table. */
-extern struct bfd_hash_entry *bfd_hash_insert
- (struct bfd_hash_table *, const char *, unsigned long);
-
-/* Rename an entry in a hash table. */
-extern void bfd_hash_rename
- (struct bfd_hash_table *, const char *, struct bfd_hash_entry *);
-
-/* Replace an entry in a hash table. */
-extern void bfd_hash_replace
- (struct bfd_hash_table *, struct bfd_hash_entry *old,
- struct bfd_hash_entry *nw);
-
-/* Base method for creating a hash table entry. */
-extern struct bfd_hash_entry *bfd_hash_newfunc
- (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
-
-/* Grab some space for a hash table entry. */
-extern void *bfd_hash_allocate
- (struct bfd_hash_table *, unsigned int);
-
-/* Traverse a hash table in a random order, calling a function on each
- element. If the function returns FALSE, the traversal stops. The
- INFO argument is passed to the function. */
-extern void bfd_hash_traverse
- (struct bfd_hash_table *,
- bool (*) (struct bfd_hash_entry *, void *),
- void *info);
-
-/* Allows the default size of a hash table to be configured. New hash
- tables allocated using bfd_hash_table_init will be created with
- this size. */
-extern unsigned int bfd_hash_set_default_size (unsigned int);
-
-/* This structure is used to keep track of stabs in sections
- information while linking. */
-
-struct stab_info
-{
- /* A hash table used to hold stabs strings. */
- struct bfd_strtab_hash *strings;
- /* The header file hash table. */
- struct bfd_hash_table includes;
- /* The first .stabstr section. */
- struct bfd_section *stabstr;
-};
-
-#define COFF_SWAP_TABLE (void *) &bfd_coff_std_swap_table
-
-/* User program access to BFD facilities. */
-
-/* Direct I/O routines, for programs which know more about the object
- file than BFD does. Use higher level routines if possible. */
-
-extern bfd_size_type bfd_bread (void *, bfd_size_type, bfd *);
-extern bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *);
-extern int bfd_seek (bfd *, file_ptr, int);
-extern file_ptr bfd_tell (bfd *);
-extern int bfd_flush (bfd *);
-extern int bfd_stat (bfd *, struct stat *);
-
-extern bool bfd_cache_close
- (bfd *abfd);
-/* NB: This declaration should match the autogenerated one in libbfd.h. */
-
-extern bool bfd_cache_close_all (void);
-
-extern bool bfd_record_phdr
- (bfd *, unsigned long, bool, flagword, bool, bfd_vma,
- bool, bool, unsigned int, struct bfd_section **);
-
-/* Byte swapping routines. */
-
-uint64_t bfd_getb64 (const void *);
-uint64_t bfd_getl64 (const void *);
-int64_t bfd_getb_signed_64 (const void *);
-int64_t bfd_getl_signed_64 (const void *);
-bfd_vma bfd_getb32 (const void *);
-bfd_vma bfd_getl32 (const void *);
-bfd_signed_vma bfd_getb_signed_32 (const void *);
-bfd_signed_vma bfd_getl_signed_32 (const void *);
-bfd_vma bfd_getb16 (const void *);
-bfd_vma bfd_getl16 (const void *);
-bfd_signed_vma bfd_getb_signed_16 (const void *);
-bfd_signed_vma bfd_getl_signed_16 (const void *);
-void bfd_putb64 (uint64_t, void *);
-void bfd_putl64 (uint64_t, void *);
-void bfd_putb32 (bfd_vma, void *);
-void bfd_putl32 (bfd_vma, void *);
-void bfd_putb24 (bfd_vma, void *);
-void bfd_putl24 (bfd_vma, void *);
-void bfd_putb16 (bfd_vma, void *);
-void bfd_putl16 (bfd_vma, void *);
-
-/* Byte swapping routines which take size and endiannes as arguments. */
-
-uint64_t bfd_get_bits (const void *, int, bool);
-void bfd_put_bits (uint64_t, void *, int, bool);
-
-
-/* mmap hacks */
-
-struct _bfd_window_internal;
-typedef struct _bfd_window_internal bfd_window_internal;
-
-typedef struct _bfd_window
-{
- /* What the user asked for. */
- void *data;
- bfd_size_type size;
- /* The actual window used by BFD. Small user-requested read-only
- regions sharing a page may share a single window into the object
- file. Read-write versions shouldn't until I've fixed things to
- keep track of which portions have been claimed by the
- application; don't want to give the same region back when the
- application wants two writable copies! */
- struct _bfd_window_internal *i;
-}
-bfd_window;
-
-extern void bfd_init_window
- (bfd_window *);
-extern void bfd_free_window
- (bfd_window *);
-extern bool bfd_get_file_window
- (bfd *, file_ptr, bfd_size_type, bfd_window *, bool);
-/* Forward declarations. */
-struct ecoff_debug_info;
-struct ecoff_debug_swap;
-struct ecoff_extr;
-struct bfd_link_info;
-struct bfd_link_hash_entry;
/* Return TRUE if the start of STR matches PREFIX, FALSE otherwise. */
@@ -448,75 +165,6 @@ startswith (const char *str, const char *prefix)
{
return strncmp (str, prefix, strlen (prefix)) == 0;
}
-/* Extracted from opncls.c. */
-/* Set to N to open the next N BFDs using an alternate id space. */
-extern unsigned int bfd_use_reserved_id;
-bfd *bfd_fopen (const char *filename, const char *target,
- const char *mode, int fd);
-
-bfd *bfd_openr (const char *filename, const char *target);
-
-bfd *bfd_fdopenr (const char *filename, const char *target, int fd);
-
-bfd *bfd_fdopenw (const char *filename, const char *target, int fd);
-
-bfd *bfd_openstreamr (const char * filename, const char * target,
- void * stream);
-
-bfd *bfd_openr_iovec (const char *filename, const char *target,
- void *(*open_func) (struct bfd *nbfd,
- void *open_closure),
- void *open_closure,
- file_ptr (*pread_func) (struct bfd *nbfd,
- void *stream,
- void *buf,
- file_ptr nbytes,
- file_ptr offset),
- int (*close_func) (struct bfd *nbfd,
- void *stream),
- int (*stat_func) (struct bfd *abfd,
- void *stream,
- struct stat *sb));
-
-bfd *bfd_openw (const char *filename, const char *target);
-
-bfd *bfd_elf_bfd_from_remote_memory
- (bfd *templ, bfd_vma ehdr_vma, bfd_size_type size, bfd_vma *loadbasep,
- int (*target_read_memory)
- (bfd_vma vma, bfd_byte *myaddr, bfd_size_type len));
-
-bool bfd_close (bfd *abfd);
-
-bool bfd_close_all_done (bfd *);
-
-bfd *bfd_create (const char *filename, bfd *templ);
-
-bool bfd_make_writable (bfd *abfd);
-
-bool bfd_make_readable (bfd *abfd);
-
-uint32_t bfd_calc_gnu_debuglink_crc32
- (uint32_t crc, const bfd_byte *buf, bfd_size_type len);
-
-char *bfd_get_debug_link_info (bfd *abfd, uint32_t *crc32_out);
-
-char *bfd_get_alt_debug_link_info (bfd * abfd,
- bfd_size_type *buildid_len,
- bfd_byte **buildid_out);
-
-char *bfd_follow_gnu_debuglink (bfd *abfd, const char *dir);
-
-char *bfd_follow_gnu_debugaltlink (bfd *abfd, const char *dir);
-
-struct bfd_section *bfd_create_gnu_debuglink_section
- (bfd *abfd, const char *filename);
-
-bool bfd_fill_in_gnu_debuglink_section
- (bfd *abfd, struct bfd_section *sect, const char *filename);
-
-char *bfd_follow_build_id_debuglink (bfd *abfd, const char *dir);
-
-const char *bfd_set_filename (bfd *abfd, const char *filename);
/* Extracted from libbfd.c. */
void *bfd_alloc (bfd *abfd, bfd_size_type wanted);
@@ -651,19 +299,130 @@ bfd_vma bfd_getl24 (const void *p);
#define H_GET_S8 bfd_h_get_signed_8
-/* Extracted from bfdio.c. */
-long bfd_get_mtime (bfd *abfd);
+uint64_t bfd_getb64 (const void *);
+uint64_t bfd_getl64 (const void *);
+int64_t bfd_getb_signed_64 (const void *);
+int64_t bfd_getl_signed_64 (const void *);
+bfd_vma bfd_getb32 (const void *);
+bfd_vma bfd_getl32 (const void *);
+bfd_signed_vma bfd_getb_signed_32 (const void *);
+bfd_signed_vma bfd_getl_signed_32 (const void *);
+bfd_vma bfd_getb16 (const void *);
+bfd_vma bfd_getl16 (const void *);
+bfd_signed_vma bfd_getb_signed_16 (const void *);
+bfd_signed_vma bfd_getl_signed_16 (const void *);
+void bfd_putb64 (uint64_t, void *);
+void bfd_putl64 (uint64_t, void *);
+void bfd_putb32 (bfd_vma, void *);
+void bfd_putl32 (bfd_vma, void *);
+void bfd_putb24 (bfd_vma, void *);
+void bfd_putl24 (bfd_vma, void *);
+void bfd_putb16 (bfd_vma, void *);
+void bfd_putl16 (bfd_vma, void *);
+uint64_t bfd_get_bits (const void *, int, bool);
+void bfd_put_bits (uint64_t, void *, int, bool);
-ufile_ptr bfd_get_size (bfd *abfd);
+/* Extracted from hash.c. */
+/* An element in the hash table. Most uses will actually use a larger
+ structure, and an instance of this will be the first field. */
-ufile_ptr bfd_get_file_size (bfd *abfd);
+struct bfd_hash_entry
+{
+ /* Next entry for this hash code. */
+ struct bfd_hash_entry *next;
+ /* String being hashed. */
+ const char *string;
+ /* Hash code. This is the full hash code, not the index into the
+ table. */
+ unsigned long hash;
+};
-void *bfd_mmap (bfd *abfd, void *addr, bfd_size_type len,
- int prot, int flags, file_ptr offset,
- void **map_addr, bfd_size_type *map_len);
+/* A hash table. */
+
+struct bfd_hash_table
+{
+ /* The hash array. */
+ struct bfd_hash_entry **table;
+ /* A function used to create new elements in the hash table. The
+ first entry is itself a pointer to an element. When this
+ function is first invoked, this pointer will be NULL. However,
+ having the pointer permits a hierarchy of method functions to be
+ built each of which calls the function in the superclass. Thus
+ each function should be written to allocate a new block of memory
+ only if the argument is NULL. */
+ struct bfd_hash_entry *(*newfunc)
+ (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
+ /* An objalloc for this hash table. This is a struct objalloc *,
+ but we use void * to avoid requiring the inclusion of objalloc.h. */
+ void *memory;
+ /* The number of slots in the hash table. */
+ unsigned int size;
+ /* The number of entries in the hash table. */
+ unsigned int count;
+ /* The size of elements. */
+ unsigned int entsize;
+ /* If non-zero, don't grow the hash table. */
+ unsigned int frozen:1;
+};
+
+bool bfd_hash_table_init_n
+ (struct bfd_hash_table *,
+ struct bfd_hash_entry *(* /*newfunc*/)
+ (struct bfd_hash_entry *, struct bfd_hash_table *, const char *),
+ unsigned int /*entsize*/, unsigned int /*size*/);
+
+bool bfd_hash_table_init
+ (struct bfd_hash_table *,
+ struct bfd_hash_entry *(* /*newfunc*/)
+ (struct bfd_hash_entry *, struct bfd_hash_table *, const char *),
+ unsigned int /*entsize*/);
+
+void bfd_hash_table_free (struct bfd_hash_table *);
+
+struct bfd_hash_entry *bfd_hash_lookup
+ (struct bfd_hash_table *, const char *,
+ bool /*create*/, bool /*copy*/);
+
+struct bfd_hash_entry *bfd_hash_insert
+ (struct bfd_hash_table *,
+ const char *,
+ unsigned long /*hash*/);
+
+void bfd_hash_rename (struct bfd_hash_table *,
+ const char *,
+ struct bfd_hash_entry *);
+
+void bfd_hash_replace (struct bfd_hash_table *,
+ struct bfd_hash_entry * /*old*/,
+ struct bfd_hash_entry * /*new*/);
+
+void *bfd_hash_allocate (struct bfd_hash_table *,
+ unsigned int /*size*/);
+
+struct bfd_hash_entry *bfd_hash_newfunc
+ (struct bfd_hash_entry *,
+ struct bfd_hash_table *,
+ const char *);
+
+void bfd_hash_traverse
+ (struct bfd_hash_table *,
+ bool (*) (struct bfd_hash_entry *, void *),
+ void *);
+
+unsigned int bfd_hash_set_default_size (unsigned int);
-/* Extracted from bfdwin.c. */
/* Extracted from section.c. */
+/* Linenumber stuff. */
+typedef struct lineno_cache_entry
+{
+ unsigned int line_number; /* Linenumber from start of function. */
+ union
+ {
+ struct bfd_symbol *sym; /* Function name. */
+ bfd_vma offset; /* Offset into section. */
+ } u;
+}
+alent;
typedef struct bfd_section
{
@@ -1013,7 +772,7 @@ typedef struct bfd_section
/* If the SEC_IN_MEMORY flag is set, this points to the actual
contents. */
- unsigned char *contents;
+ bfd_byte *contents;
/* Attached line number information. */
alent *lineno;
@@ -1192,8 +951,8 @@ static inline bool
bfd_is_const_section (const asection *sec)
{
return (sec >= _bfd_std_section
- && sec < _bfd_std_section + (sizeof (_bfd_std_section)
- / sizeof (_bfd_std_section[0])));
+ && sec < _bfd_std_section + (sizeof (_bfd_std_section)
+ / sizeof (_bfd_std_section[0])));
}
/* Return TRUE if input section SEC has been discarded. */
@@ -1201,48 +960,48 @@ static inline bool
discarded_section (const asection *sec)
{
return (!bfd_is_abs_section (sec)
- && bfd_is_abs_section (sec->output_section)
- && sec->sec_info_type != SEC_INFO_TYPE_MERGE
- && sec->sec_info_type != SEC_INFO_TYPE_JUST_SYMS);
+ && bfd_is_abs_section (sec->output_section)
+ && sec->sec_info_type != SEC_INFO_TYPE_MERGE
+ && sec->sec_info_type != SEC_INFO_TYPE_JUST_SYMS);
}
#define BFD_FAKE_SECTION(SEC, SYM, NAME, IDX, FLAGS) \
/* name, next, prev, id, section_id, index, flags, user_set_vma, */ \
{ NAME, NULL, NULL, IDX, 0, 0, FLAGS, 0, \
- \
+ \
/* linker_mark, linker_has_input, gc_mark, decompress_status, */ \
0, 0, 1, 0, \
- \
+ \
/* segment_mark, sec_info_type, use_rela_p, */ \
0, 0, 0, \
- \
+ \
/* sec_flg0, sec_flg1, sec_flg2, sec_flg3, sec_flg4, sec_flg5, */ \
0, 0, 0, 0, 0, 0, \
- \
+ \
/* vma, lma, size, rawsize, compressed_size, */ \
0, 0, 0, 0, 0, \
- \
+ \
/* output_offset, output_section, relocation, orelocation, */ \
0, &SEC, NULL, NULL, \
- \
+ \
/* reloc_count, alignment_power, filepos, rel_filepos, */ \
0, 0, 0, 0, \
- \
+ \
/* line_filepos, userdata, contents, lineno, lineno_count, */ \
0, NULL, NULL, NULL, 0, \
- \
+ \
/* entsize, kept_section, moving_line_filepos, */ \
0, NULL, 0, \
- \
+ \
/* target_index, used_by_bfd, constructor_chain, owner, */ \
0, NULL, NULL, NULL, \
- \
+ \
/* symbol, symbol_ptr_ptr, */ \
(struct bfd_symbol *) SYM, &SEC.symbol, \
- \
+ \
/* map_head, map_tail, already_assigned, type */ \
{ NULL }, { NULL }, NULL, 0 \
- \
+ \
}
/* We use a macro to initialize the static asymbol structures because
@@ -1319,13 +1078,245 @@ bool bfd_copy_private_section_data
#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \
BFD_SEND (obfd, _bfd_copy_private_section_data, \
- (ibfd, isection, obfd, osection))
+ (ibfd, isection, obfd, osection))
bool bfd_generic_is_group_section (bfd *, const asection *sec);
const char *bfd_generic_group_name (bfd *, const asection *sec);
bool bfd_generic_discard_group (bfd *abfd, asection *group);
+/* Extracted from syms.c. */
+typedef struct bfd_symbol
+{
+ /* A pointer to the BFD which owns the symbol. This information
+ is necessary so that a back end can work out what additional
+ information (invisible to the application writer) is carried
+ with the symbol.
+
+ This field is *almost* redundant, since you can use section->owner
+ instead, except that some symbols point to the global sections
+ bfd_{abs,com,und}_section. This could be fixed by making
+ these globals be per-bfd (or per-target-flavor). FIXME. */
+ struct bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field. */
+
+ /* The text of the symbol. The name is left alone, and not copied; the
+ application may not alter it. */
+ const char *name;
+
+ /* The value of the symbol. This really should be a union of a
+ numeric value with a pointer, since some flags indicate that
+ a pointer to another symbol is stored here. */
+ symvalue value;
+
+ /* Attributes of a symbol. */
+#define BSF_NO_FLAGS 0
+
+ /* The symbol has local scope; <<static>> in <<C>>. The value
+ is the offset into the section of the data. */
+#define BSF_LOCAL (1 << 0)
+
+ /* The symbol has global scope; initialized data in <<C>>. The
+ value is the offset into the section of the data. */
+#define BSF_GLOBAL (1 << 1)
+
+ /* The symbol has global scope and is exported. The value is
+ the offset into the section of the data. */
+#define BSF_EXPORT BSF_GLOBAL /* No real difference. */
+
+ /* A normal C symbol would be one of:
+ <<BSF_LOCAL>>, <<BSF_UNDEFINED>> or <<BSF_GLOBAL>>. */
+
+ /* The symbol is a debugging record. The value has an arbitrary
+ meaning, unless BSF_DEBUGGING_RELOC is also set. */
+#define BSF_DEBUGGING (1 << 2)
+
+ /* The symbol denotes a function entry point. Used in ELF,
+ perhaps others someday. */
+#define BSF_FUNCTION (1 << 3)
+
+ /* Used by the linker. */
+#define BSF_KEEP (1 << 5)
+
+ /* An ELF common symbol. */
+#define BSF_ELF_COMMON (1 << 6)
+
+ /* A weak global symbol, overridable without warnings by
+ a regular global symbol of the same name. */
+#define BSF_WEAK (1 << 7)
+
+ /* This symbol was created to point to a section, e.g. ELF's
+ STT_SECTION symbols. */
+#define BSF_SECTION_SYM (1 << 8)
+
+ /* The symbol used to be a common symbol, but now it is
+ allocated. */
+#define BSF_OLD_COMMON (1 << 9)
+
+ /* In some files the type of a symbol sometimes alters its
+ location in an output file - ie in coff a <<ISFCN>> symbol
+ which is also <<C_EXT>> symbol appears where it was
+ declared and not at the end of a section. This bit is set
+ by the target BFD part to convey this information. */
+#define BSF_NOT_AT_END (1 << 10)
+
+ /* Signal that the symbol is the label of constructor section. */
+#define BSF_CONSTRUCTOR (1 << 11)
+
+ /* Signal that the symbol is a warning symbol. The name is a
+ warning. The name of the next symbol is the one to warn about;
+ if a reference is made to a symbol with the same name as the next
+ symbol, a warning is issued by the linker. */
+#define BSF_WARNING (1 << 12)
+
+ /* Signal that the symbol is indirect. This symbol is an indirect
+ pointer to the symbol with the same name as the next symbol. */
+#define BSF_INDIRECT (1 << 13)
+
+ /* BSF_FILE marks symbols that contain a file name. This is used
+ for ELF STT_FILE symbols. */
+#define BSF_FILE (1 << 14)
+
+ /* Symbol is from dynamic linking information. */
+#define BSF_DYNAMIC (1 << 15)
+
+ /* The symbol denotes a data object. Used in ELF, and perhaps
+ others someday. */
+#define BSF_OBJECT (1 << 16)
+
+ /* This symbol is a debugging symbol. The value is the offset
+ into the section of the data. BSF_DEBUGGING should be set
+ as well. */
+#define BSF_DEBUGGING_RELOC (1 << 17)
+
+ /* This symbol is thread local. Used in ELF. */
+#define BSF_THREAD_LOCAL (1 << 18)
+
+ /* This symbol represents a complex relocation expression,
+ with the expression tree serialized in the symbol name. */
+#define BSF_RELC (1 << 19)
+
+ /* This symbol represents a signed complex relocation expression,
+ with the expression tree serialized in the symbol name. */
+#define BSF_SRELC (1 << 20)
+
+ /* This symbol was created by bfd_get_synthetic_symtab. */
+#define BSF_SYNTHETIC (1 << 21)
+
+ /* This symbol is an indirect code object. Unrelated to BSF_INDIRECT.
+ The dynamic linker will compute the value of this symbol by
+ calling the function that it points to. BSF_FUNCTION must
+ also be also set. */
+#define BSF_GNU_INDIRECT_FUNCTION (1 << 22)
+ /* This symbol is a globally unique data object. The dynamic linker
+ will make sure that in the entire process there is just one symbol
+ with this name and type in use. BSF_OBJECT must also be set. */
+#define BSF_GNU_UNIQUE (1 << 23)
+
+ /* This section symbol should be included in the symbol table. */
+#define BSF_SECTION_SYM_USED (1 << 24)
+
+ flagword flags;
+
+ /* A pointer to the section to which this symbol is
+ relative. This will always be non NULL, there are special
+ sections for undefined and absolute symbols. */
+ struct bfd_section *section;
+
+ /* Back end special data. */
+ union
+ {
+ void *p;
+ bfd_vma i;
+ }
+ udata;
+}
+asymbol;
+
+typedef enum bfd_print_symbol
+{
+ bfd_print_symbol_name,
+ bfd_print_symbol_more,
+ bfd_print_symbol_all
+} bfd_print_symbol_type;
+
+/* Information about a symbol that nm needs. */
+
+typedef struct _symbol_info
+{
+ symvalue value;
+ char type;
+ const char *name; /* Symbol name. */
+ unsigned char stab_type; /* Stab type. */
+ char stab_other; /* Stab other. */
+ short stab_desc; /* Stab desc. */
+ const char *stab_name; /* String for stab type. */
+} symbol_info;
+
+#define bfd_get_symtab_upper_bound(abfd) \
+ BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd))
+
+bool bfd_is_local_label (bfd *abfd, asymbol *sym);
+
+bool bfd_is_local_label_name (bfd *abfd, const char *name);
+
+#define bfd_is_local_label_name(abfd, name) \
+ BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name))
+
+bool bfd_is_target_special_symbol (bfd *abfd, asymbol *sym);
+
+#define bfd_is_target_special_symbol(abfd, sym) \
+ BFD_SEND (abfd, _bfd_is_target_special_symbol, (abfd, sym))
+
+#define bfd_canonicalize_symtab(abfd, location) \
+ BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location))
+
+bool bfd_set_symtab
+ (bfd *abfd, asymbol **location, unsigned int count);
+
+void bfd_print_symbol_vandf (bfd *abfd, void *file, asymbol *symbol);
+
+#define bfd_make_empty_symbol(abfd) \
+ BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
+
+asymbol *_bfd_generic_make_empty_symbol (bfd *);
+
+#define bfd_make_debug_symbol(abfd,ptr,size) \
+ BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
+
+int bfd_decode_symclass (asymbol *symbol);
+
+bool bfd_is_undefined_symclass (int symclass);
+
+void bfd_symbol_info (asymbol *symbol, symbol_info *ret);
+
+bool bfd_copy_private_symbol_data
+ (bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym);
+
+#define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \
+ BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
+ (ibfd, isymbol, obfd, osymbol))
+
+/* Extracted from archive.c. */
+/* A canonical archive symbol. */
+/* This is a type pun with struct symdef/struct ranlib on purpose! */
+typedef struct carsym
+{
+ const char *name;
+ file_ptr file_offset; /* Look here to find the file. */
+}
+carsym;
+
+/* A count of carsyms (canonical archive symbols). */
+ typedef unsigned long symindex;
+#define BFD_NO_MORE_SYMBOLS ((symindex) ~0)
+
+symindex bfd_get_next_mapent
+ (bfd *abfd, symindex previous, carsym **sym);
+
+bool bfd_set_archive_head (bfd *output, bfd *new_head);
+
+bfd *bfd_openr_next_archived_file (bfd *archive, bfd *previous);
+
/* Extracted from archures.c. */
enum bfd_architecture
{
@@ -1843,7 +1834,7 @@ typedef struct bfd_arch_info
all the entries for that arch can be accessed via <<next>>. */
bool the_default;
const struct bfd_arch_info * (*compatible) (const struct bfd_arch_info *,
- const struct bfd_arch_info *);
+ const struct bfd_arch_info *);
bool (*scan) (const struct bfd_arch_info *, const char *);
@@ -1902,8 +1893,1109 @@ unsigned int bfd_octets_per_byte (const bfd *abfd,
unsigned int bfd_arch_mach_octets_per_byte
(enum bfd_architecture arch, unsigned long machine);
-/* Extracted from reloc.c. */
+/* Extracted from bfd.c. */
+typedef enum bfd_format
+ {
+ bfd_unknown = 0, /* File format is unknown. */
+ bfd_object, /* Linker/assembler/compiler output. */
+ bfd_archive, /* Object archive file. */
+ bfd_core, /* Core dump. */
+ bfd_type_end /* Marks the end; don't use it! */
+ }
+bfd_format;
+
+enum bfd_direction
+ {
+ no_direction = 0,
+ read_direction = 1,
+ write_direction = 2,
+ both_direction = 3
+ };
+
+enum bfd_plugin_format
+ {
+ bfd_plugin_unknown = 0,
+ bfd_plugin_yes = 1,
+ bfd_plugin_no = 2
+ };
+
+struct bfd_build_id
+ {
+ bfd_size_type size;
+ bfd_byte data[1];
+ };
+
+struct bfd
+{
+ /* The filename the application opened the BFD with. */
+ const char *filename;
+
+ /* A pointer to the target jump table. */
+ const struct bfd_target *xvec;
+
+ /* The IOSTREAM, and corresponding IO vector that provide access
+ to the file backing the BFD. */
+ void *iostream;
+ const struct bfd_iovec *iovec;
+
+ /* The caching routines use these to maintain a
+ least-recently-used list of BFDs. */
+ struct bfd *lru_prev, *lru_next;
+
+ /* Track current file position (or current buffer offset for
+ in-memory BFDs). When a file is closed by the caching routines,
+ BFD retains state information on the file here. */
+ ufile_ptr where;
+
+ /* File modified time, if mtime_set is TRUE. */
+ long mtime;
+
+ /* A unique identifier of the BFD */
+ unsigned int id;
+
+ /* Format_specific flags. */
+ flagword flags;
+
+ /* Values that may appear in the flags field of a BFD. These also
+ appear in the object_flags field of the bfd_target structure, where
+ they indicate the set of flags used by that backend (not all flags
+ are meaningful for all object file formats) (FIXME: at the moment,
+ the object_flags values have mostly just been copied from backend
+ to another, and are not necessarily correct). */
+
+#define BFD_NO_FLAGS 0x0
+
+ /* BFD contains relocation entries. */
+#define HAS_RELOC 0x1
+
+ /* BFD is directly executable. */
+#define EXEC_P 0x2
+
+ /* BFD has line number information (basically used for F_LNNO in a
+ COFF header). */
+#define HAS_LINENO 0x4
+
+ /* BFD has debugging information. */
+#define HAS_DEBUG 0x08
+
+ /* BFD has symbols. */
+#define HAS_SYMS 0x10
+
+ /* BFD has local symbols (basically used for F_LSYMS in a COFF
+ header). */
+#define HAS_LOCALS 0x20
+
+ /* BFD is a dynamic object. */
+#define DYNAMIC 0x40
+
+ /* Text section is write protected (if D_PAGED is not set, this is
+ like an a.out NMAGIC file) (the linker sets this by default, but
+ clears it for -r or -N). */
+#define WP_TEXT 0x80
+
+ /* BFD is dynamically paged (this is like an a.out ZMAGIC file) (the
+ linker sets this by default, but clears it for -r or -n or -N). */
+#define D_PAGED 0x100
+
+ /* BFD is relaxable (this means that bfd_relax_section may be able to
+ do something) (sometimes bfd_relax_section can do something even if
+ this is not set). */
+#define BFD_IS_RELAXABLE 0x200
+
+ /* This may be set before writing out a BFD to request using a
+ traditional format. For example, this is used to request that when
+ writing out an a.out object the symbols not be hashed to eliminate
+ duplicates. */
+#define BFD_TRADITIONAL_FORMAT 0x400
+
+ /* This flag indicates that the BFD contents are actually cached
+ in memory. If this is set, iostream points to a bfd_in_memory
+ struct. */
+#define BFD_IN_MEMORY 0x800
+
+ /* This BFD has been created by the linker and doesn't correspond
+ to any input file. */
+#define BFD_LINKER_CREATED 0x1000
+
+ /* This may be set before writing out a BFD to request that it
+ be written using values for UIDs, GIDs, timestamps, etc. that
+ will be consistent from run to run. */
+#define BFD_DETERMINISTIC_OUTPUT 0x2000
+
+ /* Compress sections in this BFD. */
+#define BFD_COMPRESS 0x4000
+
+ /* Decompress sections in this BFD. */
+#define BFD_DECOMPRESS 0x8000
+
+ /* BFD is a dummy, for plugins. */
+#define BFD_PLUGIN 0x10000
+
+ /* Compress sections in this BFD with SHF_COMPRESSED from gABI. */
+#define BFD_COMPRESS_GABI 0x20000
+
+ /* Convert ELF common symbol type to STT_COMMON or STT_OBJECT in this
+ BFD. */
+#define BFD_CONVERT_ELF_COMMON 0x40000
+
+ /* Use the ELF STT_COMMON type in this BFD. */
+#define BFD_USE_ELF_STT_COMMON 0x80000
+
+ /* Put pathnames into archives (non-POSIX). */
+#define BFD_ARCHIVE_FULL_PATH 0x100000
+
+#define BFD_CLOSED_BY_CACHE 0x200000
+ /* Compress sections in this BFD with SHF_COMPRESSED zstd. */
+#define BFD_COMPRESS_ZSTD 0x400000
+
+ /* Flags bits which are for BFD use only. */
+#define BFD_FLAGS_FOR_BFD_USE_MASK \
+ (BFD_IN_MEMORY | BFD_COMPRESS | BFD_DECOMPRESS | BFD_LINKER_CREATED \
+ | BFD_PLUGIN | BFD_TRADITIONAL_FORMAT | BFD_DETERMINISTIC_OUTPUT \
+ | BFD_COMPRESS_GABI | BFD_CONVERT_ELF_COMMON | BFD_USE_ELF_STT_COMMON)
+
+ /* The format which belongs to the BFD. (object, core, etc.) */
+ ENUM_BITFIELD (bfd_format) format : 3;
+
+ /* The direction with which the BFD was opened. */
+ ENUM_BITFIELD (bfd_direction) direction : 2;
+
+ /* Is the file descriptor being cached? That is, can it be closed as
+ needed, and re-opened when accessed later? */
+ unsigned int cacheable : 1;
+
+ /* Marks whether there was a default target specified when the
+ BFD was opened. This is used to select which matching algorithm
+ to use to choose the back end. */
+ unsigned int target_defaulted : 1;
+
+ /* ... and here: (``once'' means at least once). */
+ unsigned int opened_once : 1;
+
+ /* Set if we have a locally maintained mtime value, rather than
+ getting it from the file each time. */
+ unsigned int mtime_set : 1;
+
+ /* Flag set if symbols from this BFD should not be exported. */
+ unsigned int no_export : 1;
+
+ /* Remember when output has begun, to stop strange things
+ from happening. */
+ unsigned int output_has_begun : 1;
+
+ /* Have archive map. */
+ unsigned int has_armap : 1;
+
+ /* Set if this is a thin archive. */
+ unsigned int is_thin_archive : 1;
+
+ /* Set if this archive should not cache element positions. */
+ unsigned int no_element_cache : 1;
+
+ /* Set if only required symbols should be added in the link hash table for
+ this object. Used by VMS linkers. */
+ unsigned int selective_search : 1;
+
+ /* Set if this is the linker output BFD. */
+ unsigned int is_linker_output : 1;
+
+ /* Set if this is the linker input BFD. */
+ unsigned int is_linker_input : 1;
+
+ /* If this is an input for a compiler plug-in library. */
+ ENUM_BITFIELD (bfd_plugin_format) plugin_format : 2;
+
+ /* Set if this is a plugin output file. */
+ unsigned int lto_output : 1;
+
+ /* Set if this is a slim LTO object not loaded with a compiler plugin. */
+ unsigned int lto_slim_object : 1;
+
+ /* Do not attempt to modify this file. Set when detecting errors
+ that BFD is not prepared to handle for objcopy/strip. */
+ unsigned int read_only : 1;
+
+ /* Set to dummy BFD created when claimed by a compiler plug-in
+ library. */
+ bfd *plugin_dummy_bfd;
+
+ /* The offset of this bfd in the file, typically 0 if it is not
+ contained in an archive. */
+ ufile_ptr origin;
+
+ /* The origin in the archive of the proxy entry. This will
+ normally be the same as origin, except for thin archives,
+ when it will contain the current offset of the proxy in the
+ thin archive rather than the offset of the bfd in its actual
+ container. */
+ ufile_ptr proxy_origin;
+
+ /* A hash table for section names. */
+ struct bfd_hash_table section_htab;
+
+ /* Pointer to linked list of sections. */
+ struct bfd_section *sections;
+
+ /* The last section on the section list. */
+ struct bfd_section *section_last;
+
+ /* The number of sections. */
+ unsigned int section_count;
+
+ /* The archive plugin file descriptor. */
+ int archive_plugin_fd;
+
+ /* The number of opens on the archive plugin file descriptor. */
+ unsigned int archive_plugin_fd_open_count;
+
+ /* A field used by _bfd_generic_link_add_archive_symbols. This will
+ be used only for archive elements. */
+ int archive_pass;
+
+ /* The total size of memory from bfd_alloc. */
+ bfd_size_type alloc_size;
+
+ /* Stuff only useful for object files:
+ The start address. */
+ bfd_vma start_address;
+
+ /* Symbol table for output BFD (with symcount entries).
+ Also used by the linker to cache input BFD symbols. */
+ struct bfd_symbol **outsymbols;
+
+ /* Used for input and output. */
+ unsigned int symcount;
+
+ /* Used for slurped dynamic symbol tables. */
+ unsigned int dynsymcount;
+
+ /* Pointer to structure which contains architecture information. */
+ const struct bfd_arch_info *arch_info;
+
+ /* Cached length of file for bfd_get_size. 0 until bfd_get_size is
+ called, 1 if stat returns an error or the file size is too large to
+ return in ufile_ptr. Both 0 and 1 should be treated as "unknown". */
+ ufile_ptr size;
+
+ /* Stuff only useful for archives. */
+ void *arelt_data;
+ struct bfd *my_archive; /* The containing archive BFD. */
+ struct bfd *archive_next; /* The next BFD in the archive. */
+ struct bfd *archive_head; /* The first BFD in the archive. */
+ struct bfd *nested_archives; /* List of nested archive in a flattened
+ thin archive. */
+
+ union {
+ /* For input BFDs, a chain of BFDs involved in a link. */
+ struct bfd *next;
+ /* For output BFD, the linker hash table. */
+ struct bfd_link_hash_table *hash;
+ } link;
+
+ /* Used by the back end to hold private data. */
+ union
+ {
+ struct aout_data_struct *aout_data;
+ struct artdata *aout_ar_data;
+ struct coff_tdata *coff_obj_data;
+ struct pe_tdata *pe_obj_data;
+ struct xcoff_tdata *xcoff_obj_data;
+ struct ecoff_tdata *ecoff_obj_data;
+ struct srec_data_struct *srec_data;
+ struct verilog_data_struct *verilog_data;
+ struct ihex_data_struct *ihex_data;
+ struct tekhex_data_struct *tekhex_data;
+ struct elf_obj_tdata *elf_obj_data;
+ struct mmo_data_struct *mmo_data;
+ struct trad_core_struct *trad_core_data;
+ struct som_data_struct *som_data;
+ struct hpux_core_struct *hpux_core_data;
+ struct hppabsd_core_struct *hppabsd_core_data;
+ struct sgi_core_struct *sgi_core_data;
+ struct lynx_core_struct *lynx_core_data;
+ struct osf_core_struct *osf_core_data;
+ struct cisco_core_struct *cisco_core_data;
+ struct netbsd_core_struct *netbsd_core_data;
+ struct mach_o_data_struct *mach_o_data;
+ struct mach_o_fat_data_struct *mach_o_fat_data;
+ struct plugin_data_struct *plugin_data;
+ struct bfd_pef_data_struct *pef_data;
+ struct bfd_pef_xlib_data_struct *pef_xlib_data;
+ struct bfd_sym_data_struct *sym_data;
+ void *any;
+ }
+ tdata;
+
+ /* Used by the application to hold private data. */
+ void *usrdata;
+
+ /* Where all the allocated stuff under this BFD goes. This is a
+ struct objalloc *, but we use void * to avoid requiring the inclusion
+ of objalloc.h. */
+ void *memory;
+
+ /* For input BFDs, the build ID, if the object has one. */
+ const struct bfd_build_id *build_id;
+};
+
+static inline const char *
+bfd_get_filename (const bfd *abfd)
+{
+ return abfd->filename;
+}
+
+static inline bool
+bfd_get_cacheable (const bfd *abfd)
+{
+ return abfd->cacheable;
+}
+
+static inline enum bfd_format
+bfd_get_format (const bfd *abfd)
+{
+ return abfd->format;
+}
+
+static inline flagword
+bfd_get_file_flags (const bfd *abfd)
+{
+ return abfd->flags;
+}
+
+static inline bfd_vma
+bfd_get_start_address (const bfd *abfd)
+{
+ return abfd->start_address;
+}
+
+static inline unsigned int
+bfd_get_symcount (const bfd *abfd)
+{
+ return abfd->symcount;
+}
+
+static inline unsigned int
+bfd_get_dynamic_symcount (const bfd *abfd)
+{
+ return abfd->dynsymcount;
+}
+
+static inline struct bfd_symbol **
+bfd_get_outsymbols (const bfd *abfd)
+{
+ return abfd->outsymbols;
+}
+
+static inline unsigned int
+bfd_count_sections (const bfd *abfd)
+{
+ return abfd->section_count;
+}
+
+static inline bool
+bfd_has_map (const bfd *abfd)
+{
+ return abfd->has_armap;
+}
+
+static inline bool
+bfd_is_thin_archive (const bfd *abfd)
+{
+ return abfd->is_thin_archive;
+}
+
+static inline void *
+bfd_usrdata (const bfd *abfd)
+{
+ return abfd->usrdata;
+}
+
+/* See note beside bfd_set_section_userdata. */
+static inline bool
+bfd_set_cacheable (bfd * abfd, bool val)
+{
+ abfd->cacheable = val;
+ return true;
+}
+
+static inline void
+bfd_set_thin_archive (bfd *abfd, bool val)
+{
+ abfd->is_thin_archive = val;
+}
+
+static inline void
+bfd_set_usrdata (bfd *abfd, void *val)
+{
+ abfd->usrdata = val;
+}
+
+static inline asection *
+bfd_asymbol_section (const asymbol *sy)
+{
+ return sy->section;
+}
+
+static inline bfd_vma
+bfd_asymbol_value (const asymbol *sy)
+{
+ return sy->section->vma + sy->value;
+}
+
+static inline const char *
+bfd_asymbol_name (const asymbol *sy)
+{
+ return sy->name;
+}
+
+static inline struct bfd *
+bfd_asymbol_bfd (const asymbol *sy)
+{
+ return sy->the_bfd;
+}
+
+static inline void
+bfd_set_asymbol_name (asymbol *sy, const char *name)
+{
+ sy->name = name;
+}
+
+/* For input sections return the original size on disk of the
+ section. For output sections return the current size. */
+static inline bfd_size_type
+bfd_get_section_limit_octets (const bfd *abfd, const asection *sec)
+{
+ if (abfd->direction != write_direction && sec->rawsize != 0)
+ return sec->rawsize;
+ return sec->size;
+}
+
+/* Find the address one past the end of SEC. */
+static inline bfd_size_type
+bfd_get_section_limit (const bfd *abfd, const asection *sec)
+{
+ return (bfd_get_section_limit_octets (abfd, sec)
+ / bfd_octets_per_byte (abfd, sec));
+}
+
+/* For input sections return the larger of the current size and the
+ original size on disk of the section. For output sections return
+ the current size. */
+static inline bfd_size_type
+bfd_get_section_alloc_size (const bfd *abfd, const asection *sec)
+{
+ if (abfd->direction != write_direction && sec->rawsize > sec->size)
+ return sec->rawsize;
+ return sec->size;
+}
+
+/* Functions to handle insertion and deletion of a bfd's sections. These
+ only handle the list pointers, ie. do not adjust section_count,
+ target_index etc. */
+static inline void
+bfd_section_list_remove (bfd *abfd, asection *s)
+{
+ asection *next = s->next;
+ asection *prev = s->prev;
+ if (prev)
+ prev->next = next;
+ else
+ abfd->sections = next;
+ if (next)
+ next->prev = prev;
+ else
+ abfd->section_last = prev;
+}
+
+static inline void
+bfd_section_list_append (bfd *abfd, asection *s)
+{
+ s->next = 0;
+ if (abfd->section_last)
+ {
+ s->prev = abfd->section_last;
+ abfd->section_last->next = s;
+ }
+ else
+ {
+ s->prev = 0;
+ abfd->sections = s;
+ }
+ abfd->section_last = s;
+}
+
+static inline void
+bfd_section_list_prepend (bfd *abfd, asection *s)
+{
+ s->prev = 0;
+ if (abfd->sections)
+ {
+ s->next = abfd->sections;
+ abfd->sections->prev = s;
+ }
+ else
+ {
+ s->next = 0;
+ abfd->section_last = s;
+ }
+ abfd->sections = s;
+}
+
+static inline void
+bfd_section_list_insert_after (bfd *abfd, asection *a, asection *s)
+{
+ asection *next = a->next;
+ s->next = next;
+ s->prev = a;
+ a->next = s;
+ if (next)
+ next->prev = s;
+ else
+ abfd->section_last = s;
+}
+
+static inline void
+bfd_section_list_insert_before (bfd *abfd, asection *b, asection *s)
+{
+ asection *prev = b->prev;
+ s->prev = prev;
+ s->next = b;
+ b->prev = s;
+ if (prev)
+ prev->next = s;
+ else
+ abfd->sections = s;
+}
+
+static inline bool
+bfd_section_removed_from_list (const bfd *abfd, const asection *s)
+{
+ return s->next ? s->next->prev != s : abfd->section_last != s;
+}
+
+typedef enum bfd_error
+{
+ bfd_error_no_error = 0,
+ bfd_error_system_call,
+ bfd_error_invalid_target,
+ bfd_error_wrong_format,
+ bfd_error_wrong_object_format,
+ bfd_error_invalid_operation,
+ bfd_error_no_memory,
+ bfd_error_no_symbols,
+ bfd_error_no_armap,
+ bfd_error_no_more_archived_files,
+ bfd_error_malformed_archive,
+ bfd_error_missing_dso,
+ bfd_error_file_not_recognized,
+ bfd_error_file_ambiguously_recognized,
+ bfd_error_no_contents,
+ bfd_error_nonrepresentable_section,
+ bfd_error_no_debug_section,
+ bfd_error_bad_value,
+ bfd_error_file_truncated,
+ bfd_error_file_too_big,
+ bfd_error_sorry,
+ bfd_error_on_input,
+ bfd_error_invalid_error_code
+}
+bfd_error_type;
+
+bfd_error_type bfd_get_error (void);
+
+void bfd_set_error (bfd_error_type error_tag);
+
+void bfd_set_input_error (bfd *input, bfd_error_type error_tag);
+
+const char *bfd_errmsg (bfd_error_type error_tag);
+
+void bfd_perror (const char *message);
+
+typedef void (*bfd_error_handler_type) (const char *, va_list);
+
+void _bfd_error_handler (const char *fmt, ...) ATTRIBUTE_PRINTF_1;
+
+bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type);
+
+void bfd_set_error_program_name (const char *);
+
+typedef void (*bfd_assert_handler_type) (const char *bfd_formatmsg,
+ const char *bfd_version,
+ const char *bfd_file,
+ int bfd_line);
+
+bfd_assert_handler_type bfd_set_assert_handler (bfd_assert_handler_type);
+
+unsigned int bfd_init (void);
+
+/* Value returned by bfd_init. */
+#define BFD_INIT_MAGIC (sizeof (struct bfd_section))
+
+long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect);
+
+long bfd_canonicalize_reloc
+ (bfd *abfd, asection *sec, arelent **loc, asymbol **syms);
+
+void bfd_set_reloc
+ (bfd *abfd, asection *sec, arelent **rel, unsigned int count);
+
+#define bfd_set_reloc(abfd, asect, location, count) \
+ BFD_SEND (abfd, _bfd_set_reloc, (abfd, asect, location, count))
+bool bfd_set_file_flags (bfd *abfd, flagword flags);
+
+int bfd_get_arch_size (bfd *abfd);
+
+int bfd_get_sign_extend_vma (bfd *abfd);
+
+bool bfd_set_start_address (bfd *abfd, bfd_vma vma);
+
+unsigned int bfd_get_gp_size (bfd *abfd);
+
+void bfd_set_gp_size (bfd *abfd, unsigned int i);
+
+void bfd_set_gp_value (bfd *abfd, bfd_vma v);
+
+bfd_vma bfd_scan_vma (const char *string, const char **end, int base);
+
+bool bfd_copy_private_header_data (bfd *ibfd, bfd *obfd);
+
+#define bfd_copy_private_header_data(ibfd, obfd) \
+ BFD_SEND (obfd, _bfd_copy_private_header_data, \
+ (ibfd, obfd))
+bool bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd);
+
+#define bfd_copy_private_bfd_data(ibfd, obfd) \
+ BFD_SEND (obfd, _bfd_copy_private_bfd_data, \
+ (ibfd, obfd))
+bool bfd_set_private_flags (bfd *abfd, flagword flags);
+
+#define bfd_set_private_flags(abfd, flags) \
+ BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags))
+#define bfd_sizeof_headers(abfd, info) \
+ BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, info))
+
+#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
+ BFD_SEND (abfd, _bfd_find_nearest_line, \
+ (abfd, syms, sec, off, file, func, line, NULL))
+
+#define bfd_find_nearest_line_with_alt(abfd, alt_filename, sec, syms, off, \
+ file, func, line, disc) \
+ BFD_SEND (abfd, _bfd_find_nearest_line_with_alt, \
+ (abfd, alt_filename, syms, sec, off, file, func, line, disc))
+
+#define bfd_find_nearest_line_discriminator(abfd, sec, syms, off, file, func, \
+ line, disc) \
+ BFD_SEND (abfd, _bfd_find_nearest_line, \
+ (abfd, syms, sec, off, file, func, line, disc))
+
+#define bfd_find_line(abfd, syms, sym, file, line) \
+ BFD_SEND (abfd, _bfd_find_line, \
+ (abfd, syms, sym, file, line))
+
+#define bfd_find_inliner_info(abfd, file, func, line) \
+ BFD_SEND (abfd, _bfd_find_inliner_info, \
+ (abfd, file, func, line))
+
+#define bfd_debug_info_start(abfd) \
+ BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
+
+#define bfd_debug_info_end(abfd) \
+ BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
+
+#define bfd_debug_info_accumulate(abfd, section) \
+ BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
+
+#define bfd_stat_arch_elt(abfd, stat) \
+ BFD_SEND (abfd->my_archive ? abfd->my_archive : abfd, \
+ _bfd_stat_arch_elt, (abfd, stat))
+
+#define bfd_update_armap_timestamp(abfd) \
+ BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
+
+#define bfd_set_arch_mach(abfd, arch, mach)\
+ BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
+
+#define bfd_relax_section(abfd, section, link_info, again) \
+ BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
+
+#define bfd_gc_sections(abfd, link_info) \
+ BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
+
+#define bfd_lookup_section_flags(link_info, flag_info, section) \
+ BFD_SEND (abfd, _bfd_lookup_section_flags, (link_info, flag_info, section))
+
+#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_group_name(abfd, sec) \
+ BFD_SEND (abfd, _bfd_group_name, (abfd, sec))
+
+#define bfd_discard_group(abfd, sec) \
+ BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
+
+#define bfd_link_hash_table_create(abfd) \
+ BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
+
+#define bfd_link_add_symbols(abfd, info) \
+ BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
+
+#define bfd_link_just_syms(abfd, sec, info) \
+ BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
+
+#define bfd_final_link(abfd, info) \
+ BFD_SEND (abfd, _bfd_final_link, (abfd, info))
+
+#define bfd_free_cached_info(abfd) \
+ BFD_SEND (abfd, _bfd_free_cached_info, (abfd))
+
+#define bfd_get_dynamic_symtab_upper_bound(abfd) \
+ BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd))
+
+#define bfd_print_private_bfd_data(abfd, file)\
+ BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file))
+
+#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
+ BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
+
+#define bfd_get_synthetic_symtab(abfd, count, syms, dyncount, dynsyms, ret) \
+ BFD_SEND (abfd, _bfd_get_synthetic_symtab, (abfd, count, syms, \
+ dyncount, dynsyms, ret))
+
+#define bfd_get_dynamic_reloc_upper_bound(abfd) \
+ BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
+
+#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \
+ BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
+
+bfd_byte *bfd_get_relocated_section_contents
+ (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
+ bool, asymbol **);
+
+bool bfd_record_phdr
+ (bfd *, unsigned long, bool, flagword, bool, bfd_vma,
+ bool, bool, unsigned int, struct bfd_section **);
+
+void bfd_sprintf_vma (bfd *, char *, bfd_vma);
+void bfd_fprintf_vma (bfd *, void *, bfd_vma);
+
+#define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd, stdout, x)
+
+bool bfd_alt_mach_code (bfd *abfd, int alternative);
+
+bfd_vma bfd_emul_get_maxpagesize (const char *);
+
+bfd_vma bfd_emul_get_commonpagesize (const char *);
+
+char *bfd_demangle (bfd *, const char *, int);
+
+/* Extracted from bfdio.c. */
+bfd_size_type bfd_bread (void *, bfd_size_type, bfd *);
+
+bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *);
+
+file_ptr bfd_tell (bfd *);
+
+int bfd_flush (bfd *);
+
+int bfd_stat (bfd *, struct stat *);
+
+int bfd_seek (bfd *, file_ptr, int);
+
+long bfd_get_mtime (bfd *abfd);
+
+ufile_ptr bfd_get_size (bfd *abfd);
+
+ufile_ptr bfd_get_file_size (bfd *abfd);
+
+void *bfd_mmap (bfd *abfd, void *addr, bfd_size_type len,
+ int prot, int flags, file_ptr offset,
+ void **map_addr, bfd_size_type *map_len);
+
+/* Extracted from bfdwin.c. */
+struct _bfd_window_internal;
+
+typedef struct _bfd_window
+{
+ /* What the user asked for. */
+ void *data;
+ bfd_size_type size;
+ /* The actual window used by BFD. Small user-requested read-only
+ regions sharing a page may share a single window into the object
+ file. Read-write versions shouldn't until I've fixed things to
+ keep track of which portions have been claimed by the
+ application; don't want to give the same region back when the
+ application wants two writable copies! */
+ struct _bfd_window_internal *i;
+}
+bfd_window;
+
+void bfd_init_window (bfd_window *);
+
+void bfd_free_window (bfd_window *);
+
+bool bfd_get_file_window
+ (bfd *, file_ptr, bfd_size_type, bfd_window *, bool /*writable*/);
+
+/* Extracted from cache.c. */
+bool bfd_cache_close (bfd *abfd);
+
+bool bfd_cache_close_all (void);
+
+/* Extracted from compress.c. */
+/* Types of compressed DWARF debug sections. */
+enum compressed_debug_section_type
+{
+ COMPRESS_DEBUG_NONE = 0,
+ COMPRESS_DEBUG_GNU_ZLIB = 1 << 1,
+ COMPRESS_DEBUG_GABI_ZLIB = 1 << 2,
+ COMPRESS_DEBUG_ZSTD = 1 << 3,
+ COMPRESS_UNKNOWN = 1 << 4
+};
+
+/* Tuple for compressed_debug_section_type and their name. */
+struct compressed_type_tuple
+{
+ enum compressed_debug_section_type type;
+ const char *name;
+};
+
+/* Compression header ch_type values. */
+enum compression_type
+{
+ ch_none = 0,
+ ch_compress_zlib = 1 , /* Compressed with zlib. */
+ ch_compress_zstd = 2 /* Compressed with zstd (www.zstandard.org). */
+};
+
+static inline char *
+bfd_debug_name_to_zdebug (bfd *abfd, const char *name)
+{
+ size_t len = strlen (name);
+ char *new_name = (char *) bfd_alloc (abfd, len + 2);
+ if (new_name == NULL)
+ return NULL;
+ new_name[0] = '.';
+ new_name[1] = 'z';
+ memcpy (new_name + 2, name + 1, len);
+ return new_name;
+}
+
+static inline char *
+bfd_zdebug_name_to_debug (bfd *abfd, const char *name)
+{
+ size_t len = strlen (name);
+ char *new_name = (char *) bfd_alloc (abfd, len);
+ if (new_name == NULL)
+ return NULL;
+ new_name[0] = '.';
+ memcpy (new_name + 1, name + 2, len - 1);
+ return new_name;
+}
+
+enum compressed_debug_section_type
+bfd_get_compression_algorithm (const char *name);
+
+const char *bfd_get_compression_algorithm_name
+ (enum compressed_debug_section_type type);
+
+void bfd_update_compression_header
+ (bfd *abfd, bfd_byte *contents, asection *sec);
+
+int bfd_get_compression_header_size (bfd *abfd, asection *sec);
+
+bool bfd_convert_section_setup
+ (bfd *ibfd, asection *isec, bfd *obfd,
+ const char **new_name, bfd_size_type *new_size);
+
+bool bfd_convert_section_contents
+ (bfd *ibfd, asection *isec, bfd *obfd,
+ bfd_byte **ptr, bfd_size_type *ptr_size);
+
+bool bfd_get_full_section_contents
+ (bfd *abfd, asection *section, bfd_byte **ptr);
+
+bool bfd_is_section_compressed_info
+ (bfd *abfd, asection *section,
+ int *compression_header_size_p,
+ bfd_size_type *uncompressed_size_p,
+ unsigned int *uncompressed_alignment_power_p,
+ enum compression_type *ch_type);
+
+bool bfd_is_section_compressed
+ (bfd *abfd, asection *section);
+
+bool bfd_init_section_decompress_status
+ (bfd *abfd, asection *section);
+
+bool bfd_init_section_compress_status
+ (bfd *abfd, asection *section);
+
+bool bfd_compress_section
+ (bfd *abfd, asection *section, bfd_byte *uncompressed_buffer);
+
+/* Extracted from corefile.c. */
+const char *bfd_core_file_failing_command (bfd *abfd);
+
+int bfd_core_file_failing_signal (bfd *abfd);
+
+int bfd_core_file_pid (bfd *abfd);
+
+bool core_file_matches_executable_p
+ (bfd *core_bfd, bfd *exec_bfd);
+
+bool generic_core_file_matches_executable_p
+ (bfd *core_bfd, bfd *exec_bfd);
+
+/* Extracted from format.c. */
+bool bfd_check_format (bfd *abfd, bfd_format format);
+
+bool bfd_check_format_matches
+ (bfd *abfd, bfd_format format, char ***matching);
+
+bool bfd_set_format (bfd *abfd, bfd_format format);
+
+const char *bfd_format_string (bfd_format format);
+
+/* Extracted from linker.c. */
+/* Return TRUE if the symbol described by a linker hash entry H
+ is going to be absolute. Linker-script defined symbols can be
+ converted from absolute to section-relative ones late in the
+ link. Use this macro to correctly determine whether the symbol
+ will actually end up absolute in output. */
+#define bfd_is_abs_symbol(H) \
+ (((H)->type == bfd_link_hash_defined \
+ || (H)->type == bfd_link_hash_defweak) \
+ && bfd_is_abs_section ((H)->u.def.section) \
+ && !(H)->rel_from_abs)
+
+bool bfd_link_split_section (bfd *abfd, asection *sec);
+
+#define bfd_link_split_section(abfd, sec) \
+ BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec))
+
+bool bfd_section_already_linked (bfd *abfd,
+ asection *sec,
+ struct bfd_link_info *info);
+
+#define bfd_section_already_linked(abfd, sec, info) \
+ BFD_SEND (abfd, _section_already_linked, (abfd, sec, info))
+
+bool bfd_generic_define_common_symbol
+ (bfd *output_bfd, struct bfd_link_info *info,
+ struct bfd_link_hash_entry *h);
+
+#define bfd_define_common_symbol(output_bfd, info, h) \
+ BFD_SEND (output_bfd, _bfd_define_common_symbol, (output_bfd, info, h))
+
+void _bfd_generic_link_hide_symbol
+ (bfd *output_bfd, struct bfd_link_info *info,
+ struct bfd_link_hash_entry *h);
+
+#define bfd_link_hide_symbol(output_bfd, info, h) \
+ BFD_SEND (output_bfd, _bfd_link_hide_symbol, (output_bfd, info, h))
+
+struct bfd_link_hash_entry *bfd_generic_define_start_stop
+ (struct bfd_link_info *info,
+ const char *symbol, asection *sec);
+
+#define bfd_define_start_stop(output_bfd, info, symbol, sec) \
+ BFD_SEND (output_bfd, _bfd_define_start_stop, (info, symbol, sec))
+
+struct bfd_elf_version_tree * bfd_find_version_for_sym
+ (struct bfd_elf_version_tree *verdefs,
+ const char *sym_name, bool *hide);
+
+bool bfd_hide_sym_by_version
+ (struct bfd_elf_version_tree *verdefs, const char *sym_name);
+
+bool bfd_link_check_relocs
+ (bfd *abfd, struct bfd_link_info *info);
+
+bool _bfd_generic_link_check_relocs
+ (bfd *abfd, struct bfd_link_info *info);
+
+bool bfd_merge_private_bfd_data
+ (bfd *ibfd, struct bfd_link_info *info);
+
+#define bfd_merge_private_bfd_data(ibfd, info) \
+ BFD_SEND ((info)->output_bfd, _bfd_merge_private_bfd_data, \
+ (ibfd, info))
+
+/* Extracted from opncls.c. */
+/* Set to N to open the next N BFDs using an alternate id space. */
+extern unsigned int bfd_use_reserved_id;
+
+bfd *bfd_fopen (const char *filename, const char *target,
+ const char *mode, int fd);
+
+bfd *bfd_openr (const char *filename, const char *target);
+
+bfd *bfd_fdopenr (const char *filename, const char *target, int fd);
+
+bfd *bfd_fdopenw (const char *filename, const char *target, int fd);
+
+bfd *bfd_openstreamr (const char * filename, const char * target,
+ void * stream);
+
+bfd *bfd_openr_iovec (const char *filename, const char *target,
+ void *(*open_func) (struct bfd *nbfd,
+ void *open_closure),
+ void *open_closure,
+ file_ptr (*pread_func) (struct bfd *nbfd,
+ void *stream,
+ void *buf,
+ file_ptr nbytes,
+ file_ptr offset),
+ int (*close_func) (struct bfd *nbfd,
+ void *stream),
+ int (*stat_func) (struct bfd *abfd,
+ void *stream,
+ struct stat *sb));
+
+bfd *bfd_openw (const char *filename, const char *target);
+bfd *bfd_elf_bfd_from_remote_memory
+ (bfd *templ, bfd_vma ehdr_vma, bfd_size_type size, bfd_vma *loadbasep,
+ int (*target_read_memory)
+ (bfd_vma vma, bfd_byte *myaddr, bfd_size_type len));
+
+bool bfd_close (bfd *abfd);
+
+bool bfd_close_all_done (bfd *);
+
+bfd *bfd_create (const char *filename, bfd *templ);
+
+bool bfd_make_writable (bfd *abfd);
+
+bool bfd_make_readable (bfd *abfd);
+
+uint32_t bfd_calc_gnu_debuglink_crc32
+ (uint32_t crc, const bfd_byte *buf, bfd_size_type len);
+
+char *bfd_get_debug_link_info (bfd *abfd, uint32_t *crc32_out);
+
+char *bfd_get_alt_debug_link_info (bfd * abfd,
+ bfd_size_type *buildid_len,
+ bfd_byte **buildid_out);
+
+char *bfd_follow_gnu_debuglink (bfd *abfd, const char *dir);
+
+char *bfd_follow_gnu_debugaltlink (bfd *abfd, const char *dir);
+
+struct bfd_section *bfd_create_gnu_debuglink_section
+ (bfd *abfd, const char *filename);
+
+bool bfd_fill_in_gnu_debuglink_section
+ (bfd *abfd, struct bfd_section *sect, const char *filename);
+
+char *bfd_follow_build_id_debuglink (bfd *abfd, const char *dir);
+
+const char *bfd_set_filename (bfd *abfd, const char *filename);
+
+/* Extracted from reloc.c. */
typedef enum bfd_reloc_status
{
/* No errors detected. Note - the value 2 is used so that it
@@ -1937,7 +3029,7 @@ typedef enum bfd_reloc_status
typedef const struct reloc_howto_struct reloc_howto_type;
-typedef struct reloc_cache_entry
+struct reloc_cache_entry
{
/* A pointer into the canonical table of pointers. */
struct bfd_symbol **sym_ptr_ptr;
@@ -1951,9 +3043,7 @@ typedef struct reloc_cache_entry
/* Pointer to how to perform the required relocation. */
reloc_howto_type *howto;
-}
-arelent;
-
+};
enum complain_overflow
{
@@ -1973,6 +3063,7 @@ enum complain_overflow
unsigned number. */
complain_overflow_unsigned
};
+
struct reloc_howto_struct
{
/* The type field has mainly a documentary use - the back end can
@@ -2063,13 +3154,13 @@ struct reloc_howto_struct
#define HOWTO_INSTALL_ADDEND 0
#define HOWTO_RSIZE(sz) ((sz) < 0 ? -(sz) : (sz))
#define HOWTO(type, right, size, bits, pcrel, left, ovf, func, name, \
- inplace, src_mask, dst_mask, pcrel_off) \
+ inplace, src_mask, dst_mask, pcrel_off) \
{ (unsigned) type, HOWTO_RSIZE (size), bits, right, left, ovf, \
size < 0, pcrel, inplace, pcrel_off, HOWTO_INSTALL_ADDEND, \
src_mask, dst_mask, func, name }
#define EMPTY_HOWTO(C) \
HOWTO ((C), 0, 1, 0, false, 0, complain_overflow_dont, NULL, \
- NULL, false, 0, 0, false)
+ NULL, false, 0, 0, false)
static inline unsigned int
bfd_get_reloc_size (reloc_howto_type *howto)
@@ -6242,8 +7333,8 @@ assembler and not (currently) written to any object files. */
BFD_RELOC_LARCH_32_PCREL,
BFD_RELOC_LARCH_RELAX,
BFD_RELOC_UNUSED };
-
typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
+
reloc_howto_type *bfd_reloc_type_lookup
(bfd *abfd, bfd_reloc_code_real_type code);
reloc_howto_type *bfd_reloc_name_lookup
@@ -6251,1002 +7342,27 @@ reloc_howto_type *bfd_reloc_name_lookup
const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code);
-/* Extracted from syms.c. */
-
-typedef struct bfd_symbol
-{
- /* A pointer to the BFD which owns the symbol. This information
- is necessary so that a back end can work out what additional
- information (invisible to the application writer) is carried
- with the symbol.
-
- This field is *almost* redundant, since you can use section->owner
- instead, except that some symbols point to the global sections
- bfd_{abs,com,und}_section. This could be fixed by making
- these globals be per-bfd (or per-target-flavor). FIXME. */
- struct bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field. */
-
- /* The text of the symbol. The name is left alone, and not copied; the
- application may not alter it. */
- const char *name;
-
- /* The value of the symbol. This really should be a union of a
- numeric value with a pointer, since some flags indicate that
- a pointer to another symbol is stored here. */
- symvalue value;
-
- /* Attributes of a symbol. */
-#define BSF_NO_FLAGS 0
-
- /* The symbol has local scope; <<static>> in <<C>>. The value
- is the offset into the section of the data. */
-#define BSF_LOCAL (1 << 0)
-
- /* The symbol has global scope; initialized data in <<C>>. The
- value is the offset into the section of the data. */
-#define BSF_GLOBAL (1 << 1)
-
- /* The symbol has global scope and is exported. The value is
- the offset into the section of the data. */
-#define BSF_EXPORT BSF_GLOBAL /* No real difference. */
-
- /* A normal C symbol would be one of:
- <<BSF_LOCAL>>, <<BSF_UNDEFINED>> or <<BSF_GLOBAL>>. */
-
- /* The symbol is a debugging record. The value has an arbitrary
- meaning, unless BSF_DEBUGGING_RELOC is also set. */
-#define BSF_DEBUGGING (1 << 2)
-
- /* The symbol denotes a function entry point. Used in ELF,
- perhaps others someday. */
-#define BSF_FUNCTION (1 << 3)
-
- /* Used by the linker. */
-#define BSF_KEEP (1 << 5)
-
- /* An ELF common symbol. */
-#define BSF_ELF_COMMON (1 << 6)
-
- /* A weak global symbol, overridable without warnings by
- a regular global symbol of the same name. */
-#define BSF_WEAK (1 << 7)
-
- /* This symbol was created to point to a section, e.g. ELF's
- STT_SECTION symbols. */
-#define BSF_SECTION_SYM (1 << 8)
-
- /* The symbol used to be a common symbol, but now it is
- allocated. */
-#define BSF_OLD_COMMON (1 << 9)
-
- /* In some files the type of a symbol sometimes alters its
- location in an output file - ie in coff a <<ISFCN>> symbol
- which is also <<C_EXT>> symbol appears where it was
- declared and not at the end of a section. This bit is set
- by the target BFD part to convey this information. */
-#define BSF_NOT_AT_END (1 << 10)
-
- /* Signal that the symbol is the label of constructor section. */
-#define BSF_CONSTRUCTOR (1 << 11)
-
- /* Signal that the symbol is a warning symbol. The name is a
- warning. The name of the next symbol is the one to warn about;
- if a reference is made to a symbol with the same name as the next
- symbol, a warning is issued by the linker. */
-#define BSF_WARNING (1 << 12)
-
- /* Signal that the symbol is indirect. This symbol is an indirect
- pointer to the symbol with the same name as the next symbol. */
-#define BSF_INDIRECT (1 << 13)
-
- /* BSF_FILE marks symbols that contain a file name. This is used
- for ELF STT_FILE symbols. */
-#define BSF_FILE (1 << 14)
-
- /* Symbol is from dynamic linking information. */
-#define BSF_DYNAMIC (1 << 15)
-
- /* The symbol denotes a data object. Used in ELF, and perhaps
- others someday. */
-#define BSF_OBJECT (1 << 16)
-
- /* This symbol is a debugging symbol. The value is the offset
- into the section of the data. BSF_DEBUGGING should be set
- as well. */
-#define BSF_DEBUGGING_RELOC (1 << 17)
-
- /* This symbol is thread local. Used in ELF. */
-#define BSF_THREAD_LOCAL (1 << 18)
-
- /* This symbol represents a complex relocation expression,
- with the expression tree serialized in the symbol name. */
-#define BSF_RELC (1 << 19)
-
- /* This symbol represents a signed complex relocation expression,
- with the expression tree serialized in the symbol name. */
-#define BSF_SRELC (1 << 20)
-
- /* This symbol was created by bfd_get_synthetic_symtab. */
-#define BSF_SYNTHETIC (1 << 21)
-
- /* This symbol is an indirect code object. Unrelated to BSF_INDIRECT.
- The dynamic linker will compute the value of this symbol by
- calling the function that it points to. BSF_FUNCTION must
- also be also set. */
-#define BSF_GNU_INDIRECT_FUNCTION (1 << 22)
- /* This symbol is a globally unique data object. The dynamic linker
- will make sure that in the entire process there is just one symbol
- with this name and type in use. BSF_OBJECT must also be set. */
-#define BSF_GNU_UNIQUE (1 << 23)
-
- /* This section symbol should be included in the symbol table. */
-#define BSF_SECTION_SYM_USED (1 << 24)
-
- flagword flags;
-
- /* A pointer to the section to which this symbol is
- relative. This will always be non NULL, there are special
- sections for undefined and absolute symbols. */
- struct bfd_section *section;
-
- /* Back end special data. */
- union
- {
- void *p;
- bfd_vma i;
- }
- udata;
-}
-asymbol;
-
-#define bfd_get_symtab_upper_bound(abfd) \
- BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd))
-
-bool bfd_is_local_label (bfd *abfd, asymbol *sym);
-
-bool bfd_is_local_label_name (bfd *abfd, const char *name);
-
-#define bfd_is_local_label_name(abfd, name) \
- BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name))
-
-bool bfd_is_target_special_symbol (bfd *abfd, asymbol *sym);
-
-#define bfd_is_target_special_symbol(abfd, sym) \
- BFD_SEND (abfd, _bfd_is_target_special_symbol, (abfd, sym))
-
-#define bfd_canonicalize_symtab(abfd, location) \
- BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location))
-
-bool bfd_set_symtab
- (bfd *abfd, asymbol **location, unsigned int count);
-
-void bfd_print_symbol_vandf (bfd *abfd, void *file, asymbol *symbol);
-
-#define bfd_make_empty_symbol(abfd) \
- BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
-
-asymbol *_bfd_generic_make_empty_symbol (bfd *);
-
-#define bfd_make_debug_symbol(abfd,ptr,size) \
- BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
-
-int bfd_decode_symclass (asymbol *symbol);
-
-bool bfd_is_undefined_symclass (int symclass);
-
-void bfd_symbol_info (asymbol *symbol, symbol_info *ret);
-
-bool bfd_copy_private_symbol_data
- (bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym);
-
-#define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \
- BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
- (ibfd, isymbol, obfd, osymbol))
-
-/* Extracted from bfd.c. */
+/* Extracted from simple.c. */
+bfd_byte *bfd_simple_get_relocated_section_contents
+ (bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table);
-enum bfd_direction
- {
- no_direction = 0,
- read_direction = 1,
- write_direction = 2,
- both_direction = 3
- };
+/* Extracted from stab-syms.c. */
+const char *bfd_get_stab_name (int);
-enum bfd_plugin_format
- {
- bfd_plugin_unknown = 0,
- bfd_plugin_yes = 1,
- bfd_plugin_no = 2
- };
-
-struct bfd_build_id
- {
- bfd_size_type size;
- bfd_byte data[1];
- };
+/* Extracted from stabs.c. */
+/* This structure is used to keep track of stabs in sections
+ information while linking. */
-struct bfd
+struct stab_info
{
- /* The filename the application opened the BFD with. */
- const char *filename;
-
- /* A pointer to the target jump table. */
- const struct bfd_target *xvec;
-
- /* The IOSTREAM, and corresponding IO vector that provide access
- to the file backing the BFD. */
- void *iostream;
- const struct bfd_iovec *iovec;
-
- /* The caching routines use these to maintain a
- least-recently-used list of BFDs. */
- struct bfd *lru_prev, *lru_next;
-
- /* Track current file position (or current buffer offset for
- in-memory BFDs). When a file is closed by the caching routines,
- BFD retains state information on the file here. */
- ufile_ptr where;
-
- /* File modified time, if mtime_set is TRUE. */
- long mtime;
-
- /* A unique identifier of the BFD */
- unsigned int id;
-
- /* Format_specific flags. */
- flagword flags;
-
- /* Values that may appear in the flags field of a BFD. These also
- appear in the object_flags field of the bfd_target structure, where
- they indicate the set of flags used by that backend (not all flags
- are meaningful for all object file formats) (FIXME: at the moment,
- the object_flags values have mostly just been copied from backend
- to another, and are not necessarily correct). */
-
-#define BFD_NO_FLAGS 0x0
-
- /* BFD contains relocation entries. */
-#define HAS_RELOC 0x1
-
- /* BFD is directly executable. */
-#define EXEC_P 0x2
-
- /* BFD has line number information (basically used for F_LNNO in a
- COFF header). */
-#define HAS_LINENO 0x4
-
- /* BFD has debugging information. */
-#define HAS_DEBUG 0x08
-
- /* BFD has symbols. */
-#define HAS_SYMS 0x10
-
- /* BFD has local symbols (basically used for F_LSYMS in a COFF
- header). */
-#define HAS_LOCALS 0x20
-
- /* BFD is a dynamic object. */
-#define DYNAMIC 0x40
-
- /* Text section is write protected (if D_PAGED is not set, this is
- like an a.out NMAGIC file) (the linker sets this by default, but
- clears it for -r or -N). */
-#define WP_TEXT 0x80
-
- /* BFD is dynamically paged (this is like an a.out ZMAGIC file) (the
- linker sets this by default, but clears it for -r or -n or -N). */
-#define D_PAGED 0x100
-
- /* BFD is relaxable (this means that bfd_relax_section may be able to
- do something) (sometimes bfd_relax_section can do something even if
- this is not set). */
-#define BFD_IS_RELAXABLE 0x200
-
- /* This may be set before writing out a BFD to request using a
- traditional format. For example, this is used to request that when
- writing out an a.out object the symbols not be hashed to eliminate
- duplicates. */
-#define BFD_TRADITIONAL_FORMAT 0x400
-
- /* This flag indicates that the BFD contents are actually cached
- in memory. If this is set, iostream points to a bfd_in_memory
- struct. */
-#define BFD_IN_MEMORY 0x800
-
- /* This BFD has been created by the linker and doesn't correspond
- to any input file. */
-#define BFD_LINKER_CREATED 0x1000
-
- /* This may be set before writing out a BFD to request that it
- be written using values for UIDs, GIDs, timestamps, etc. that
- will be consistent from run to run. */
-#define BFD_DETERMINISTIC_OUTPUT 0x2000
-
- /* Compress sections in this BFD. */
-#define BFD_COMPRESS 0x4000
-
- /* Decompress sections in this BFD. */
-#define BFD_DECOMPRESS 0x8000
-
- /* BFD is a dummy, for plugins. */
-#define BFD_PLUGIN 0x10000
-
- /* Compress sections in this BFD with SHF_COMPRESSED from gABI. */
-#define BFD_COMPRESS_GABI 0x20000
-
- /* Convert ELF common symbol type to STT_COMMON or STT_OBJECT in this
- BFD. */
-#define BFD_CONVERT_ELF_COMMON 0x40000
-
- /* Use the ELF STT_COMMON type in this BFD. */
-#define BFD_USE_ELF_STT_COMMON 0x80000
-
- /* Put pathnames into archives (non-POSIX). */
-#define BFD_ARCHIVE_FULL_PATH 0x100000
-
-#define BFD_CLOSED_BY_CACHE 0x200000
- /* Compress sections in this BFD with SHF_COMPRESSED zstd. */
-#define BFD_COMPRESS_ZSTD 0x400000
-
- /* Flags bits which are for BFD use only. */
-#define BFD_FLAGS_FOR_BFD_USE_MASK \
- (BFD_IN_MEMORY | BFD_COMPRESS | BFD_DECOMPRESS | BFD_LINKER_CREATED \
- | BFD_PLUGIN | BFD_TRADITIONAL_FORMAT | BFD_DETERMINISTIC_OUTPUT \
- | BFD_COMPRESS_GABI | BFD_CONVERT_ELF_COMMON | BFD_USE_ELF_STT_COMMON)
-
- /* The format which belongs to the BFD. (object, core, etc.) */
- ENUM_BITFIELD (bfd_format) format : 3;
-
- /* The direction with which the BFD was opened. */
- ENUM_BITFIELD (bfd_direction) direction : 2;
-
- /* Is the file descriptor being cached? That is, can it be closed as
- needed, and re-opened when accessed later? */
- unsigned int cacheable : 1;
-
- /* Marks whether there was a default target specified when the
- BFD was opened. This is used to select which matching algorithm
- to use to choose the back end. */
- unsigned int target_defaulted : 1;
-
- /* ... and here: (``once'' means at least once). */
- unsigned int opened_once : 1;
-
- /* Set if we have a locally maintained mtime value, rather than
- getting it from the file each time. */
- unsigned int mtime_set : 1;
-
- /* Flag set if symbols from this BFD should not be exported. */
- unsigned int no_export : 1;
-
- /* Remember when output has begun, to stop strange things
- from happening. */
- unsigned int output_has_begun : 1;
-
- /* Have archive map. */
- unsigned int has_armap : 1;
-
- /* Set if this is a thin archive. */
- unsigned int is_thin_archive : 1;
-
- /* Set if this archive should not cache element positions. */
- unsigned int no_element_cache : 1;
-
- /* Set if only required symbols should be added in the link hash table for
- this object. Used by VMS linkers. */
- unsigned int selective_search : 1;
-
- /* Set if this is the linker output BFD. */
- unsigned int is_linker_output : 1;
-
- /* Set if this is the linker input BFD. */
- unsigned int is_linker_input : 1;
-
- /* If this is an input for a compiler plug-in library. */
- ENUM_BITFIELD (bfd_plugin_format) plugin_format : 2;
-
- /* Set if this is a plugin output file. */
- unsigned int lto_output : 1;
-
- /* Set if this is a slim LTO object not loaded with a compiler plugin. */
- unsigned int lto_slim_object : 1;
-
- /* Do not attempt to modify this file. Set when detecting errors
- that BFD is not prepared to handle for objcopy/strip. */
- unsigned int read_only : 1;
-
- /* Set to dummy BFD created when claimed by a compiler plug-in
- library. */
- bfd *plugin_dummy_bfd;
-
- /* The offset of this bfd in the file, typically 0 if it is not
- contained in an archive. */
- ufile_ptr origin;
-
- /* The origin in the archive of the proxy entry. This will
- normally be the same as origin, except for thin archives,
- when it will contain the current offset of the proxy in the
- thin archive rather than the offset of the bfd in its actual
- container. */
- ufile_ptr proxy_origin;
-
- /* A hash table for section names. */
- struct bfd_hash_table section_htab;
-
- /* Pointer to linked list of sections. */
- struct bfd_section *sections;
-
- /* The last section on the section list. */
- struct bfd_section *section_last;
-
- /* The number of sections. */
- unsigned int section_count;
-
- /* The archive plugin file descriptor. */
- int archive_plugin_fd;
-
- /* The number of opens on the archive plugin file descriptor. */
- unsigned int archive_plugin_fd_open_count;
-
- /* A field used by _bfd_generic_link_add_archive_symbols. This will
- be used only for archive elements. */
- int archive_pass;
-
- /* The total size of memory from bfd_alloc. */
- bfd_size_type alloc_size;
-
- /* Stuff only useful for object files:
- The start address. */
- bfd_vma start_address;
-
- /* Symbol table for output BFD (with symcount entries).
- Also used by the linker to cache input BFD symbols. */
- struct bfd_symbol **outsymbols;
-
- /* Used for input and output. */
- unsigned int symcount;
-
- /* Used for slurped dynamic symbol tables. */
- unsigned int dynsymcount;
-
- /* Pointer to structure which contains architecture information. */
- const struct bfd_arch_info *arch_info;
-
- /* Cached length of file for bfd_get_size. 0 until bfd_get_size is
- called, 1 if stat returns an error or the file size is too large to
- return in ufile_ptr. Both 0 and 1 should be treated as "unknown". */
- ufile_ptr size;
-
- /* Stuff only useful for archives. */
- void *arelt_data;
- struct bfd *my_archive; /* The containing archive BFD. */
- struct bfd *archive_next; /* The next BFD in the archive. */
- struct bfd *archive_head; /* The first BFD in the archive. */
- struct bfd *nested_archives; /* List of nested archive in a flattened
- thin archive. */
-
- union {
- /* For input BFDs, a chain of BFDs involved in a link. */
- struct bfd *next;
- /* For output BFD, the linker hash table. */
- struct bfd_link_hash_table *hash;
- } link;
-
- /* Used by the back end to hold private data. */
- union
- {
- struct aout_data_struct *aout_data;
- struct artdata *aout_ar_data;
- struct coff_tdata *coff_obj_data;
- struct pe_tdata *pe_obj_data;
- struct xcoff_tdata *xcoff_obj_data;
- struct ecoff_tdata *ecoff_obj_data;
- struct srec_data_struct *srec_data;
- struct verilog_data_struct *verilog_data;
- struct ihex_data_struct *ihex_data;
- struct tekhex_data_struct *tekhex_data;
- struct elf_obj_tdata *elf_obj_data;
- struct mmo_data_struct *mmo_data;
- struct trad_core_struct *trad_core_data;
- struct som_data_struct *som_data;
- struct hpux_core_struct *hpux_core_data;
- struct hppabsd_core_struct *hppabsd_core_data;
- struct sgi_core_struct *sgi_core_data;
- struct lynx_core_struct *lynx_core_data;
- struct osf_core_struct *osf_core_data;
- struct cisco_core_struct *cisco_core_data;
- struct netbsd_core_struct *netbsd_core_data;
- struct mach_o_data_struct *mach_o_data;
- struct mach_o_fat_data_struct *mach_o_fat_data;
- struct plugin_data_struct *plugin_data;
- struct bfd_pef_data_struct *pef_data;
- struct bfd_pef_xlib_data_struct *pef_xlib_data;
- struct bfd_sym_data_struct *sym_data;
- void *any;
- }
- tdata;
-
- /* Used by the application to hold private data. */
- void *usrdata;
-
- /* Where all the allocated stuff under this BFD goes. This is a
- struct objalloc *, but we use void * to avoid requiring the inclusion
- of objalloc.h. */
- void *memory;
-
- /* For input BFDs, the build ID, if the object has one. */
- const struct bfd_build_id *build_id;
+ /* A hash table used to hold stabs strings. */
+ struct bfd_strtab_hash *strings;
+ /* The header file hash table. */
+ struct bfd_hash_table includes;
+ /* The first .stabstr section. */
+ struct bfd_section *stabstr;
};
-static inline const char *
-bfd_get_filename (const bfd *abfd)
-{
- return abfd->filename;
-}
-
-static inline bool
-bfd_get_cacheable (const bfd *abfd)
-{
- return abfd->cacheable;
-}
-
-static inline enum bfd_format
-bfd_get_format (const bfd *abfd)
-{
- return abfd->format;
-}
-
-static inline flagword
-bfd_get_file_flags (const bfd *abfd)
-{
- return abfd->flags;
-}
-
-static inline bfd_vma
-bfd_get_start_address (const bfd *abfd)
-{
- return abfd->start_address;
-}
-
-static inline unsigned int
-bfd_get_symcount (const bfd *abfd)
-{
- return abfd->symcount;
-}
-
-static inline unsigned int
-bfd_get_dynamic_symcount (const bfd *abfd)
-{
- return abfd->dynsymcount;
-}
-
-static inline struct bfd_symbol **
-bfd_get_outsymbols (const bfd *abfd)
-{
- return abfd->outsymbols;
-}
-
-static inline unsigned int
-bfd_count_sections (const bfd *abfd)
-{
- return abfd->section_count;
-}
-
-static inline bool
-bfd_has_map (const bfd *abfd)
-{
- return abfd->has_armap;
-}
-
-static inline bool
-bfd_is_thin_archive (const bfd *abfd)
-{
- return abfd->is_thin_archive;
-}
-
-static inline void *
-bfd_usrdata (const bfd *abfd)
-{
- return abfd->usrdata;
-}
-
-/* See note beside bfd_set_section_userdata. */
-static inline bool
-bfd_set_cacheable (bfd * abfd, bool val)
-{
- abfd->cacheable = val;
- return true;
-}
-
-static inline void
-bfd_set_thin_archive (bfd *abfd, bool val)
-{
- abfd->is_thin_archive = val;
-}
-
-static inline void
-bfd_set_usrdata (bfd *abfd, void *val)
-{
- abfd->usrdata = val;
-}
-
-static inline asection *
-bfd_asymbol_section (const asymbol *sy)
-{
- return sy->section;
-}
-
-static inline bfd_vma
-bfd_asymbol_value (const asymbol *sy)
-{
- return sy->section->vma + sy->value;
-}
-
-static inline const char *
-bfd_asymbol_name (const asymbol *sy)
-{
- return sy->name;
-}
-
-static inline struct bfd *
-bfd_asymbol_bfd (const asymbol *sy)
-{
- return sy->the_bfd;
-}
-
-static inline void
-bfd_set_asymbol_name (asymbol *sy, const char *name)
-{
- sy->name = name;
-}
-
-/* For input sections return the original size on disk of the
- section. For output sections return the current size. */
-static inline bfd_size_type
-bfd_get_section_limit_octets (const bfd *abfd, const asection *sec)
-{
- if (abfd->direction != write_direction && sec->rawsize != 0)
- return sec->rawsize;
- return sec->size;
-}
-
-/* Find the address one past the end of SEC. */
-static inline bfd_size_type
-bfd_get_section_limit (const bfd *abfd, const asection *sec)
-{
- return (bfd_get_section_limit_octets (abfd, sec)
- / bfd_octets_per_byte (abfd, sec));
-}
-
-/* For input sections return the larger of the current size and the
- original size on disk of the section. For output sections return
- the current size. */
-static inline bfd_size_type
-bfd_get_section_alloc_size (const bfd *abfd, const asection *sec)
-{
- if (abfd->direction != write_direction && sec->rawsize > sec->size)
- return sec->rawsize;
- return sec->size;
-}
-
-/* Functions to handle insertion and deletion of a bfd's sections. These
- only handle the list pointers, ie. do not adjust section_count,
- target_index etc. */
-static inline void
-bfd_section_list_remove (bfd *abfd, asection *s)
-{
- asection *next = s->next;
- asection *prev = s->prev;
- if (prev)
- prev->next = next;
- else
- abfd->sections = next;
- if (next)
- next->prev = prev;
- else
- abfd->section_last = prev;
-}
-
-static inline void
-bfd_section_list_append (bfd *abfd, asection *s)
-{
- s->next = 0;
- if (abfd->section_last)
- {
- s->prev = abfd->section_last;
- abfd->section_last->next = s;
- }
- else
- {
- s->prev = 0;
- abfd->sections = s;
- }
- abfd->section_last = s;
-}
-
-static inline void
-bfd_section_list_prepend (bfd *abfd, asection *s)
-{
- s->prev = 0;
- if (abfd->sections)
- {
- s->next = abfd->sections;
- abfd->sections->prev = s;
- }
- else
- {
- s->next = 0;
- abfd->section_last = s;
- }
- abfd->sections = s;
-}
-
-static inline void
-bfd_section_list_insert_after (bfd *abfd, asection *a, asection *s)
-{
- asection *next = a->next;
- s->next = next;
- s->prev = a;
- a->next = s;
- if (next)
- next->prev = s;
- else
- abfd->section_last = s;
-}
-
-static inline void
-bfd_section_list_insert_before (bfd *abfd, asection *b, asection *s)
-{
- asection *prev = b->prev;
- s->prev = prev;
- s->next = b;
- b->prev = s;
- if (prev)
- prev->next = s;
- else
- abfd->sections = s;
-}
-
-static inline bool
-bfd_section_removed_from_list (const bfd *abfd, const asection *s)
-{
- return s->next ? s->next->prev != s : abfd->section_last != s;
-}
-
-
-typedef enum bfd_error
-{
- bfd_error_no_error = 0,
- bfd_error_system_call,
- bfd_error_invalid_target,
- bfd_error_wrong_format,
- bfd_error_wrong_object_format,
- bfd_error_invalid_operation,
- bfd_error_no_memory,
- bfd_error_no_symbols,
- bfd_error_no_armap,
- bfd_error_no_more_archived_files,
- bfd_error_malformed_archive,
- bfd_error_missing_dso,
- bfd_error_file_not_recognized,
- bfd_error_file_ambiguously_recognized,
- bfd_error_no_contents,
- bfd_error_nonrepresentable_section,
- bfd_error_no_debug_section,
- bfd_error_bad_value,
- bfd_error_file_truncated,
- bfd_error_file_too_big,
- bfd_error_sorry,
- bfd_error_on_input,
- bfd_error_invalid_error_code
-}
-bfd_error_type;
-
-bfd_error_type bfd_get_error (void);
-
-void bfd_set_error (bfd_error_type error_tag);
-
-void bfd_set_input_error (bfd *input, bfd_error_type error_tag);
-
-const char *bfd_errmsg (bfd_error_type error_tag);
-
-void bfd_perror (const char *message);
-
-
-typedef void (*bfd_error_handler_type) (const char *, va_list);
-
-void _bfd_error_handler (const char *fmt, ...) ATTRIBUTE_PRINTF_1;
-
-bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type);
-
-void bfd_set_error_program_name (const char *);
-
-
-typedef void (*bfd_assert_handler_type) (const char *bfd_formatmsg,
- const char *bfd_version,
- const char *bfd_file,
- int bfd_line);
-
-bfd_assert_handler_type bfd_set_assert_handler (bfd_assert_handler_type);
-
-unsigned int bfd_init (void);
-
-/* Value returned by bfd_init. */
-#define BFD_INIT_MAGIC (sizeof (struct bfd_section))
-
-long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect);
-
-long bfd_canonicalize_reloc
- (bfd *abfd, asection *sec, arelent **loc, asymbol **syms);
-
-void bfd_set_reloc
- (bfd *abfd, asection *sec, arelent **rel, unsigned int count);
-
-#define bfd_set_reloc(abfd, asect, location, count) \
- BFD_SEND (abfd, _bfd_set_reloc, (abfd, asect, location, count))
-bool bfd_set_file_flags (bfd *abfd, flagword flags);
-
-int bfd_get_arch_size (bfd *abfd);
-
-int bfd_get_sign_extend_vma (bfd *abfd);
-
-bool bfd_set_start_address (bfd *abfd, bfd_vma vma);
-
-unsigned int bfd_get_gp_size (bfd *abfd);
-
-void bfd_set_gp_size (bfd *abfd, unsigned int i);
-
-void bfd_set_gp_value (bfd *abfd, bfd_vma v);
-
-bfd_vma bfd_scan_vma (const char *string, const char **end, int base);
-
-bool bfd_copy_private_header_data (bfd *ibfd, bfd *obfd);
-
-#define bfd_copy_private_header_data(ibfd, obfd) \
- BFD_SEND (obfd, _bfd_copy_private_header_data, \
- (ibfd, obfd))
-bool bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd);
-
-#define bfd_copy_private_bfd_data(ibfd, obfd) \
- BFD_SEND (obfd, _bfd_copy_private_bfd_data, \
- (ibfd, obfd))
-bool bfd_set_private_flags (bfd *abfd, flagword flags);
-
-#define bfd_set_private_flags(abfd, flags) \
- BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags))
-#define bfd_sizeof_headers(abfd, info) \
- BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, info))
-
-#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
- BFD_SEND (abfd, _bfd_find_nearest_line, \
- (abfd, syms, sec, off, file, func, line, NULL))
-
-#define bfd_find_nearest_line_with_alt(abfd, alt_filename, sec, syms, off, \
- file, func, line, disc) \
- BFD_SEND (abfd, _bfd_find_nearest_line_with_alt, \
- (abfd, alt_filename, syms, sec, off, file, func, line, disc))
-
-#define bfd_find_nearest_line_discriminator(abfd, sec, syms, off, file, func, \
- line, disc) \
- BFD_SEND (abfd, _bfd_find_nearest_line, \
- (abfd, syms, sec, off, file, func, line, disc))
-
-#define bfd_find_line(abfd, syms, sym, file, line) \
- BFD_SEND (abfd, _bfd_find_line, \
- (abfd, syms, sym, file, line))
-
-#define bfd_find_inliner_info(abfd, file, func, line) \
- BFD_SEND (abfd, _bfd_find_inliner_info, \
- (abfd, file, func, line))
-
-#define bfd_debug_info_start(abfd) \
- BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
-
-#define bfd_debug_info_end(abfd) \
- BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
-
-#define bfd_debug_info_accumulate(abfd, section) \
- BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
-
-#define bfd_stat_arch_elt(abfd, stat) \
- BFD_SEND (abfd->my_archive ? abfd->my_archive : abfd, \
- _bfd_stat_arch_elt, (abfd, stat))
-
-#define bfd_update_armap_timestamp(abfd) \
- BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
-
-#define bfd_set_arch_mach(abfd, arch, mach)\
- BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
-
-#define bfd_relax_section(abfd, section, link_info, again) \
- BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
-
-#define bfd_gc_sections(abfd, link_info) \
- BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
-
-#define bfd_lookup_section_flags(link_info, flag_info, section) \
- BFD_SEND (abfd, _bfd_lookup_section_flags, (link_info, flag_info, section))
-
-#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_group_name(abfd, sec) \
- BFD_SEND (abfd, _bfd_group_name, (abfd, sec))
-
-#define bfd_discard_group(abfd, sec) \
- BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
-
-#define bfd_link_hash_table_create(abfd) \
- BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
-
-#define bfd_link_add_symbols(abfd, info) \
- BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
-
-#define bfd_link_just_syms(abfd, sec, info) \
- BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
-
-#define bfd_final_link(abfd, info) \
- BFD_SEND (abfd, _bfd_final_link, (abfd, info))
-
-#define bfd_free_cached_info(abfd) \
- BFD_SEND (abfd, _bfd_free_cached_info, (abfd))
-
-#define bfd_get_dynamic_symtab_upper_bound(abfd) \
- BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd))
-
-#define bfd_print_private_bfd_data(abfd, file)\
- BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file))
-
-#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
- BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
-
-#define bfd_get_synthetic_symtab(abfd, count, syms, dyncount, dynsyms, ret) \
- BFD_SEND (abfd, _bfd_get_synthetic_symtab, (abfd, count, syms, \
- dyncount, dynsyms, ret))
-
-#define bfd_get_dynamic_reloc_upper_bound(abfd) \
- BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
-
-#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \
- BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
-
-extern bfd_byte *bfd_get_relocated_section_contents
- (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
- bool, asymbol **);
-
-bool bfd_alt_mach_code (bfd *abfd, int alternative);
-
-bfd_vma bfd_emul_get_maxpagesize (const char *);
-
-bfd_vma bfd_emul_get_commonpagesize (const char *);
-
-char *bfd_demangle (bfd *, const char *, int);
-
-/* Extracted from archive.c. */
-symindex bfd_get_next_mapent
- (bfd *abfd, symindex previous, carsym **sym);
-
-bool bfd_set_archive_head (bfd *output, bfd *new_head);
-
-bfd *bfd_openr_next_archived_file (bfd *archive, bfd *previous);
-
-/* Extracted from corefile.c. */
-const char *bfd_core_file_failing_command (bfd *abfd);
-
-int bfd_core_file_failing_signal (bfd *abfd);
-
-int bfd_core_file_pid (bfd *abfd);
-
-bool core_file_matches_executable_p
- (bfd *core_bfd, bfd *exec_bfd);
-
-bool generic_core_file_matches_executable_p
- (bfd *core_bfd, bfd *exec_bfd);
-
/* Extracted from targets.c. */
#define BFD_SEND(bfd, message, arglist) \
((*((bfd)->xvec->message)) arglist)
@@ -7299,12 +7415,8 @@ enum bfd_flavour
enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
-/* Forward declaration. */
-typedef struct bfd_link_info _bfd_link_info;
-
-/* Forward declaration. */
-typedef struct flag_info flag_info;
-
+/* Forward declarations. */
+struct flag_info;
typedef void (*bfd_cleanup) (bfd *);
typedef struct bfd_target
@@ -7384,7 +7496,6 @@ typedef struct bfd_target
/* Write cached information into a file being written, at <<bfd_close>>. */
bool (*_bfd_write_contents[bfd_type_end]) (bfd *);
-
/* Generic entry points. */
#define BFD_JUMP_TABLE_GENERIC(NAME) \
NAME##_close_and_cleanup, \
@@ -7401,9 +7512,9 @@ typedef struct bfd_target
bool (*_new_section_hook) (bfd *, sec_ptr);
/* Read the contents of a section. */
bool (*_bfd_get_section_contents) (bfd *, sec_ptr, void *, file_ptr,
- bfd_size_type);
+ bfd_size_type);
bool (*_bfd_get_section_contents_in_window) (bfd *, sec_ptr, bfd_window *,
- file_ptr, bfd_size_type);
+ file_ptr, bfd_size_type);
/* Entry points to copy private data. */
#define BFD_JUMP_TABLE_COPY(NAME) \
@@ -7426,16 +7537,16 @@ typedef struct bfd_target
to another. */
#define bfd_init_private_section_data(ibfd, isec, obfd, osec, link_info) \
BFD_SEND (obfd, _bfd_init_private_section_data, \
- (ibfd, isec, obfd, osec, link_info))
+ (ibfd, isec, obfd, osec, link_info))
bool (*_bfd_init_private_section_data) (bfd *, sec_ptr, bfd *, sec_ptr,
- struct bfd_link_info *);
+ struct bfd_link_info *);
/* Called to copy BFD private section data from one object file
to another. */
bool (*_bfd_copy_private_section_data) (bfd *, sec_ptr, bfd *, sec_ptr);
/* Called to copy BFD private symbol data from one symbol
to another. */
bool (*_bfd_copy_private_symbol_data) (bfd *, asymbol *,
- bfd *, asymbol *);
+ bfd *, asymbol *);
/* Called to copy BFD private header data from one object file
to another. */
bool (*_bfd_copy_private_header_data) (bfd *, bfd *);
@@ -7474,8 +7585,8 @@ typedef struct bfd_target
bool (*_bfd_slurp_armap) (bfd *);
bool (*_bfd_slurp_extended_name_table) (bfd *);
bool (*_bfd_construct_extended_name_table) (bfd *, char **,
- bfd_size_type *,
- const char **);
+ bfd_size_type *,
+ const char **);
void (*_bfd_truncate_arname) (bfd *, const char *, char *);
bool (*write_armap) (bfd *, unsigned, struct orl *, unsigned, int);
void *(*_bfd_read_ar_hdr_fn) (bfd *);
@@ -7511,7 +7622,7 @@ typedef struct bfd_target
struct bfd_symbol *
(*_bfd_make_empty_symbol) (bfd *);
void (*_bfd_print_symbol) (bfd *, void *, struct bfd_symbol *,
- bfd_print_symbol_type);
+ bfd_print_symbol_type);
#define bfd_print_symbol(b,p,s,e) \
BFD_SEND (b, _bfd_print_symbol, (b,p,s,e))
void (*_bfd_get_symbol_info) (bfd *, struct bfd_symbol *, symbol_info *);
@@ -7519,7 +7630,7 @@ typedef struct bfd_target
BFD_SEND (b, _bfd_get_symbol_info, (b,p,e))
const char *
(*_bfd_get_symbol_version_string) (bfd *, struct bfd_symbol *,
- bool, bool *);
+ bool, bool *);
#define bfd_get_symbol_version_string(b,s,p,h) \
BFD_SEND (b, _bfd_get_symbol_version_string, (b,s,p,h))
bool (*_bfd_is_local_label_name) (bfd *, const char *);
@@ -7527,17 +7638,17 @@ typedef struct bfd_target
alent *
(*_get_lineno) (bfd *, struct bfd_symbol *);
bool (*_bfd_find_nearest_line) (bfd *, struct bfd_symbol **,
- struct bfd_section *, bfd_vma,
- const char **, const char **,
- unsigned int *, unsigned int *);
+ struct bfd_section *, bfd_vma,
+ const char **, const char **,
+ unsigned int *, unsigned int *);
bool (*_bfd_find_nearest_line_with_alt) (bfd *, const char *,
- struct bfd_symbol **,
- struct bfd_section *, bfd_vma,
- const char **, const char **,
- unsigned int *, unsigned int *);
+ struct bfd_symbol **,
+ struct bfd_section *, bfd_vma,
+ const char **, const char **,
+ unsigned int *, unsigned int *);
bool (*_bfd_find_line) (bfd *, struct bfd_symbol **,
- struct bfd_symbol *, const char **,
- unsigned int *);
+ struct bfd_symbol *, const char **,
+ unsigned int *);
bool (*_bfd_find_inliner_info)
(bfd *, const char **, const char **, unsigned int *);
/* Back-door to allow format-aware applications to create debug symbols
@@ -7563,7 +7674,7 @@ typedef struct bfd_target
long (*_get_reloc_upper_bound) (bfd *, sec_ptr);
long (*_bfd_canonicalize_reloc) (bfd *, sec_ptr, arelent **,
- struct bfd_symbol **);
+ struct bfd_symbol **);
void (*_bfd_set_reloc) (bfd *, sec_ptr, arelent **, unsigned int);
/* See documentation on reloc types. */
reloc_howto_type *
@@ -7577,9 +7688,9 @@ typedef struct bfd_target
NAME##_set_section_contents
bool (*_bfd_set_arch_mach) (bfd *, enum bfd_architecture,
- unsigned long);
+ unsigned long);
bool (*_bfd_set_section_contents) (bfd *, sec_ptr, const void *,
- file_ptr, bfd_size_type);
+ file_ptr, bfd_size_type);
/* Routines used by the linker. */
#define BFD_JUMP_TABLE_LINK(NAME) \
@@ -7607,13 +7718,13 @@ typedef struct bfd_target
int (*_bfd_sizeof_headers) (bfd *, struct bfd_link_info *);
bfd_byte *
(*_bfd_get_relocated_section_contents) (bfd *,
- struct bfd_link_info *,
- struct bfd_link_order *,
- bfd_byte *, bool,
- struct bfd_symbol **);
+ struct bfd_link_info *,
+ struct bfd_link_order *,
+ bfd_byte *, bool,
+ struct bfd_symbol **);
bool (*_bfd_relax_section) (bfd *, struct bfd_section *,
- struct bfd_link_info *, bool *);
+ struct bfd_link_info *, bool *);
/* Create a hash table for the linker. Different backends store
different information in this table. */
@@ -7631,8 +7742,8 @@ typedef struct bfd_target
#define bfd_copy_link_hash_symbol_type(b, t, f) \
BFD_SEND (b, _bfd_copy_link_hash_symbol_type, (b, t, f))
void (*_bfd_copy_link_hash_symbol_type) (bfd *,
- struct bfd_link_hash_entry *,
- struct bfd_link_hash_entry *);
+ struct bfd_link_hash_entry *,
+ struct bfd_link_hash_entry *);
/* Do a link based on the link_order structures attached to each
section of the BFD. */
@@ -7649,7 +7760,7 @@ typedef struct bfd_target
/* Sets the bitmask of allowed and disallowed section flags. */
bool (*_bfd_lookup_section_flags) (struct bfd_link_info *,
- struct flag_info *, asection *);
+ struct flag_info *, asection *);
/* Attempt to merge SEC_MERGE sections. */
bool (*_bfd_merge_sections) (bfd *, struct bfd_link_info *);
@@ -7666,20 +7777,20 @@ typedef struct bfd_target
/* Check if SEC has been already linked during a reloceatable or
final link. */
bool (*_section_already_linked) (bfd *, asection *,
- struct bfd_link_info *);
+ struct bfd_link_info *);
/* Define a common symbol. */
bool (*_bfd_define_common_symbol) (bfd *, struct bfd_link_info *,
- struct bfd_link_hash_entry *);
+ struct bfd_link_hash_entry *);
/* Hide a symbol. */
void (*_bfd_link_hide_symbol) (bfd *, struct bfd_link_info *,
- struct bfd_link_hash_entry *);
+ struct bfd_link_hash_entry *);
/* Define a __start, __stop, .startof. or .sizeof. symbol. */
struct bfd_link_hash_entry *
(*_bfd_define_start_stop) (struct bfd_link_info *, const char *,
- asection *);
+ asection *);
/* Routines to handle dynamic symbols and relocs. */
#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
@@ -7695,13 +7806,13 @@ typedef struct bfd_target
long (*_bfd_canonicalize_dynamic_symtab) (bfd *, struct bfd_symbol **);
/* Create synthetized symbols. */
long (*_bfd_get_synthetic_symtab) (bfd *, long, struct bfd_symbol **,
- long, struct bfd_symbol **,
- struct bfd_symbol **);
+ long, struct bfd_symbol **,
+ struct bfd_symbol **);
/* Get the amount of memory required to hold the dynamic relocs. */
long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *);
/* Read in the dynamic relocs. */
long (*_bfd_canonicalize_dynamic_reloc) (bfd *, arelent **,
- struct bfd_symbol **);
+ struct bfd_symbol **);
/* Opposite endian version of this target. */
const struct bfd_target *alternative_target;
@@ -7734,7 +7845,7 @@ static inline bool
bfd_family_coff (const bfd *abfd)
{
return (bfd_get_flavour (abfd) == bfd_target_coff_flavour
- || bfd_get_flavour (abfd) == bfd_target_xcoff_flavour);
+ || bfd_get_flavour (abfd) == bfd_target_xcoff_flavour);
}
static inline bool
@@ -7786,13 +7897,6 @@ bfd_keep_unused_section_symbols (const bfd *abfd)
return abfd->xvec->keep_unused_section_symbols;
}
-/* Cached _bfd_check_format messages are put in this. */
-struct per_xvec_message
-{
- struct per_xvec_message *next;
- char message[];
-};
-
bool bfd_set_default_target (const char *name);
const bfd_target *bfd_find_target (const char *target_name, bfd *abfd);
@@ -7802,6 +7906,7 @@ const bfd_target *bfd_get_target_info (const char *target_name,
bool *is_bigendian,
int *underscoring,
const char **def_target_arch);
+
const char ** bfd_target_list (void);
const bfd_target *bfd_iterate_over_targets
@@ -7810,174 +7915,6 @@ const bfd_target *bfd_iterate_over_targets
const char *bfd_flavour_name (enum bfd_flavour flavour);
-/* Extracted from format.c. */
-bool bfd_check_format (bfd *abfd, bfd_format format);
-
-bool bfd_check_format_matches
- (bfd *abfd, bfd_format format, char ***matching);
-
-bool bfd_set_format (bfd *abfd, bfd_format format);
-
-const char *bfd_format_string (bfd_format format);
-
-/* Extracted from linker.c. */
-/* Return TRUE if the symbol described by a linker hash entry H
- is going to be absolute. Linker-script defined symbols can be
- converted from absolute to section-relative ones late in the
- link. Use this macro to correctly determine whether the symbol
- will actually end up absolute in output. */
-#define bfd_is_abs_symbol(H) \
- (((H)->type == bfd_link_hash_defined \
- || (H)->type == bfd_link_hash_defweak) \
- && bfd_is_abs_section ((H)->u.def.section) \
- && !(H)->rel_from_abs)
-
-bool bfd_link_split_section (bfd *abfd, asection *sec);
-
-#define bfd_link_split_section(abfd, sec) \
- BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec))
-
-bool bfd_section_already_linked (bfd *abfd,
- asection *sec,
- struct bfd_link_info *info);
-
-#define bfd_section_already_linked(abfd, sec, info) \
- BFD_SEND (abfd, _section_already_linked, (abfd, sec, info))
-
-bool bfd_generic_define_common_symbol
- (bfd *output_bfd, struct bfd_link_info *info,
- struct bfd_link_hash_entry *h);
-
-#define bfd_define_common_symbol(output_bfd, info, h) \
- BFD_SEND (output_bfd, _bfd_define_common_symbol, (output_bfd, info, h))
-
-void _bfd_generic_link_hide_symbol
- (bfd *output_bfd, struct bfd_link_info *info,
- struct bfd_link_hash_entry *h);
-
-#define bfd_link_hide_symbol(output_bfd, info, h) \
- BFD_SEND (output_bfd, _bfd_link_hide_symbol, (output_bfd, info, h))
-
-struct bfd_link_hash_entry *bfd_generic_define_start_stop
- (struct bfd_link_info *info,
- const char *symbol, asection *sec);
-
-#define bfd_define_start_stop(output_bfd, info, symbol, sec) \
- BFD_SEND (output_bfd, _bfd_define_start_stop, (info, symbol, sec))
-
-struct bfd_elf_version_tree * bfd_find_version_for_sym
- (struct bfd_elf_version_tree *verdefs,
- const char *sym_name, bool *hide);
-
-bool bfd_hide_sym_by_version
- (struct bfd_elf_version_tree *verdefs, const char *sym_name);
-
-bool bfd_link_check_relocs
- (bfd *abfd, struct bfd_link_info *info);
-
-bool _bfd_generic_link_check_relocs
- (bfd *abfd, struct bfd_link_info *info);
-
-bool bfd_merge_private_bfd_data
- (bfd *ibfd, struct bfd_link_info *info);
-
-#define bfd_merge_private_bfd_data(ibfd, info) \
- BFD_SEND ((info)->output_bfd, _bfd_merge_private_bfd_data, \
- (ibfd, info))
-/* Extracted from simple.c. */
-bfd_byte *bfd_simple_get_relocated_section_contents
- (bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table);
-
-/* Extracted from compress.c. */
-/* Types of compressed DWARF debug sections. */
-enum compressed_debug_section_type
-{
- COMPRESS_DEBUG_NONE = 0,
- COMPRESS_DEBUG_GNU_ZLIB = 1 << 1,
- COMPRESS_DEBUG_GABI_ZLIB = 1 << 2,
- COMPRESS_DEBUG_ZSTD = 1 << 3,
- COMPRESS_UNKNOWN = 1 << 4
-};
-
-/* Tuple for compressed_debug_section_type and their name. */
-struct compressed_type_tuple
-{
- enum compressed_debug_section_type type;
- const char *name;
-};
-
-/* Compression header ch_type values. */
-enum compression_type
-{
- ch_none = 0,
- ch_compress_zlib = 1 , /* Compressed with zlib. */
- ch_compress_zstd = 2 /* Compressed with zstd (www.zstandard.org). */
-};
-
-static inline char *
-bfd_debug_name_to_zdebug (bfd *abfd, const char *name)
-{
- size_t len = strlen (name);
- char *new_name = (char *) bfd_alloc (abfd, len + 2);
- if (new_name == NULL)
- return NULL;
- new_name[0] = '.';
- new_name[1] = 'z';
- memcpy (new_name + 2, name + 1, len);
- return new_name;
-}
-
-static inline char *
-bfd_zdebug_name_to_debug (bfd *abfd, const char *name)
-{
- size_t len = strlen (name);
- char *new_name = (char *) bfd_alloc (abfd, len);
- if (new_name == NULL)
- return NULL;
- new_name[0] = '.';
- memcpy (new_name + 1, name + 2, len - 1);
- return new_name;
-}
-
-enum compressed_debug_section_type
-bfd_get_compression_algorithm (const char *name);
-const char *bfd_get_compression_algorithm_name
- (enum compressed_debug_section_type type);
-void bfd_update_compression_header
- (bfd *abfd, bfd_byte *contents, asection *sec);
-
-int bfd_get_compression_header_size (bfd *abfd, asection *sec);
-
-bool bfd_convert_section_setup
- (bfd *ibfd, asection *isec, bfd *obfd,
- const char **new_name, bfd_size_type *new_size);
-
-bool bfd_convert_section_contents
- (bfd *ibfd, asection *isec, bfd *obfd,
- bfd_byte **ptr, bfd_size_type *ptr_size);
-
-bool bfd_get_full_section_contents
- (bfd *abfd, asection *section, bfd_byte **ptr);
-
-bool bfd_is_section_compressed_info
- (bfd *abfd, asection *section,
- int *compression_header_size_p,
- bfd_size_type *uncompressed_size_p,
- unsigned int *uncompressed_alignment_power_p,
- enum compression_type *ch_type);
-
-bool bfd_is_section_compressed
- (bfd *abfd, asection *section);
-
-bool bfd_init_section_decompress_status
- (bfd *abfd, asection *section);
-
-bool bfd_init_section_compress_status
- (bfd *abfd, asection *section);
-
-bool bfd_compress_section
- (bfd *abfd, asection *section, bfd_byte *uncompressed_buffer);
-
#ifdef __cplusplus
}
#endif
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 650df1c..71debd7 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -34,7 +34,16 @@ SECTION
contains the major data about the file and pointers
to the rest of the data.
-CODE_FRAGMENT
+EXTERNAL
+.typedef enum bfd_format
+. {
+. bfd_unknown = 0, {* File format is unknown. *}
+. bfd_object, {* Linker/assembler/compiler output. *}
+. bfd_archive, {* Object archive file. *}
+. bfd_core, {* Core dump. *}
+. bfd_type_end {* Marks the end; don't use it! *}
+. }
+.bfd_format;
.
.enum bfd_direction
. {
@@ -57,6 +66,8 @@ CODE_FRAGMENT
. bfd_byte data[1];
. };
.
+
+CODE_FRAGMENT
.struct bfd
.{
. {* The filename the application opened the BFD with. *}
@@ -371,6 +382,8 @@ CODE_FRAGMENT
. const struct bfd_build_id *build_id;
.};
.
+
+EXTERNAL
.static inline const char *
.bfd_get_filename (const bfd *abfd)
.{
@@ -659,7 +672,6 @@ SUBSECTION
enumerated type <<bfd_error_type>>.
CODE_FRAGMENT
-.
.typedef enum bfd_error
.{
. bfd_error_no_error = 0,
@@ -863,7 +875,6 @@ SUBSECTION
The BFD error handler acts like vprintf.
CODE_FRAGMENT
-.
.typedef void (*bfd_error_handler_type) (const char *, va_list);
.
*/
@@ -1571,7 +1582,6 @@ SUBSECTION
_bfd_error_handler and continues.
CODE_FRAGMENT
-.
.typedef void (*bfd_assert_handler_type) (const char *bfd_formatmsg,
. const char *bfd_version,
. const char *bfd_file,
@@ -2289,11 +2299,21 @@ DESCRIPTION
.#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \
. BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
.
-.extern bfd_byte *bfd_get_relocated_section_contents
-. (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
-. bool, asymbol **);
-.
+*/
+
+/*
+FUNCTION
+ bfd_get_relocated_section_contents
+
+SYNOPSIS
+ bfd_byte *bfd_get_relocated_section_contents
+ (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
+ bool, asymbol **);
+DESCRIPTION
+ Read and relocate the indirect link_order section, into DATA
+ (if non-NULL) or to a malloc'd buffer. Return the buffer, or
+ NULL on errors.
*/
bfd_byte *
@@ -2322,7 +2342,18 @@ bfd_get_relocated_section_contents (bfd *abfd,
return (*fn) (abfd, link_info, link_order, data, relocatable, symbols);
}
-/* Record information about an ELF program header. */
+/*
+FUNCTION
+ bfd_record_phdr
+
+SYNOPSIS
+ bool bfd_record_phdr
+ (bfd *, unsigned long, bool, flagword, bool, bfd_vma,
+ bool, bool, unsigned int, struct bfd_section **);
+
+DESCRIPTION
+ Record information about an ELF program header.
+*/
bool
bfd_record_phdr (bfd *abfd,
@@ -2384,8 +2415,23 @@ is32bit (bfd *abfd)
}
#endif
-/* bfd_sprintf_vma and bfd_fprintf_vma display an address in the
- target's address size. */
+/*
+FUNCTION
+ bfd_sprintf_vma
+ bfd_fprintf_vma
+
+SYNOPSIS
+ void bfd_sprintf_vma (bfd *, char *, bfd_vma);
+ void bfd_fprintf_vma (bfd *, void *, bfd_vma);
+
+DESCRIPTION
+ bfd_sprintf_vma and bfd_fprintf_vma display an address in the
+ target's address size.
+
+EXTERNAL
+.#define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd, stdout, x)
+.
+*/
void
bfd_sprintf_vma (bfd *abfd ATTRIBUTE_UNUSED, char *buf, bfd_vma value)
diff --git a/bfd/bfdio.c b/bfd/bfdio.c
index 990d349..75a3309 100644
--- a/bfd/bfdio.c
+++ b/bfd/bfdio.c
@@ -225,11 +225,21 @@ DESCRIPTION
.};
.extern const struct bfd_iovec _bfd_memory_iovec;
-
+.
*/
-/* Return value is amount read. */
+/*
+FUNCTION
+ bfd_bread
+
+SYNOPSIS
+ bfd_size_type bfd_bread (void *, bfd_size_type, bfd *);
+
+DESCRIPTION
+ Attempt to read SIZE bytes from ABFD's iostream to PTR.
+ Return the amount read.
+*/
bfd_size_type
bfd_bread (void *ptr, bfd_size_type size, bfd *abfd)
@@ -276,6 +286,18 @@ bfd_bread (void *ptr, bfd_size_type size, bfd *abfd)
return nread;
}
+/*
+FUNCTION
+ bfd_bwrite
+
+SYNOPSIS
+ bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *);
+
+DESCRIPTION
+ Attempt to write SIZE bytes to ABFD's iostream from PTR.
+ Return the amount written.
+*/
+
bfd_size_type
bfd_bwrite (const void *ptr, bfd_size_type size, bfd *abfd)
{
@@ -304,6 +326,17 @@ bfd_bwrite (const void *ptr, bfd_size_type size, bfd *abfd)
return nwrote;
}
+/*
+FUNCTION
+ bfd_tell
+
+SYNOPSIS
+ file_ptr bfd_tell (bfd *);
+
+DESCRIPTION
+ Return ABFD's iostream file position.
+*/
+
file_ptr
bfd_tell (bfd *abfd)
{
@@ -326,6 +359,17 @@ bfd_tell (bfd *abfd)
return ptr - offset;
}
+/*
+FUNCTION
+ bfd_flush
+
+SYNOPSIS
+ int bfd_flush (bfd *);
+
+DESCRIPTION
+ Flush ABFD's iostream pending IO.
+*/
+
int
bfd_flush (bfd *abfd)
{
@@ -339,8 +383,18 @@ bfd_flush (bfd *abfd)
return abfd->iovec->bflush (abfd);
}
-/* Returns 0 for success, negative value for failure (in which case
- bfd_get_error can retrieve the error code). */
+/*
+FUNCTION
+ bfd_stat
+
+SYNOPSIS
+ int bfd_stat (bfd *, struct stat *);
+
+DESCRIPTION
+ Call fstat on ABFD's iostream. Return 0 on success, and a
+ negative value on failure.
+*/
+
int
bfd_stat (bfd *abfd, struct stat *statbuf)
{
@@ -362,8 +416,17 @@ bfd_stat (bfd *abfd, struct stat *statbuf)
return result;
}
-/* Returns 0 for success, nonzero for failure (in which case bfd_get_error
- can retrieve the error code). */
+/*
+FUNCTION
+ bfd_seek
+
+SYNOPSIS
+ int bfd_seek (bfd *, file_ptr, int);
+
+DESCRIPTION
+ Call fseek on ABFD's iostream. Return 0 on success, and a
+ negative value on failure.
+*/
int
bfd_seek (bfd *abfd, file_ptr position, int direction)
diff --git a/bfd/bfdwin.c b/bfd/bfdwin.c
index 49b751c..5ecf2f9 100644
--- a/bfd/bfdwin.c
+++ b/bfd/bfdwin.c
@@ -47,15 +47,47 @@ static int debug_windows;
though. */
/*
-INTERNAL_DEFINITION
-
-.struct _bfd_window_internal {
+INTERNAL
+.typedef struct _bfd_window_internal
+.{
. struct _bfd_window_internal *next;
. void *data;
. bfd_size_type size;
. int refcount : 31; {* should be enough... *}
. unsigned mapped : 1; {* 1 = mmap, 0 = malloc *}
-.};
+.}
+.bfd_window_internal;
+.
+
+EXTERNAL
+.struct _bfd_window_internal;
+.
+.typedef struct _bfd_window
+.{
+. {* What the user asked for. *}
+. void *data;
+. bfd_size_type size;
+. {* The actual window used by BFD. Small user-requested read-only
+. regions sharing a page may share a single window into the object
+. file. Read-write versions shouldn't until I've fixed things to
+. keep track of which portions have been claimed by the
+. application; don't want to give the same region back when the
+. application wants two writable copies! *}
+. struct _bfd_window_internal *i;
+.}
+.bfd_window;
+.
+*/
+
+/*
+FUNCTION
+ bfd_init_window
+
+SYNOPSIS
+ void bfd_init_window (bfd_window *);
+
+DESCRIPTION
+ Initialise mmap window.
*/
void
@@ -66,6 +98,17 @@ bfd_init_window (bfd_window *windowp)
windowp->size = 0;
}
+/*
+FUNCTION
+ bfd_free_window
+
+SYNOPSIS
+ void bfd_free_window (bfd_window *);
+
+DESCRIPTION
+ Finalise mmap window struct.
+*/
+
void
bfd_free_window (bfd_window *windowp)
{
@@ -102,7 +145,17 @@ bfd_free_window (bfd_window *windowp)
free (i);
}
-static int ok_to_map = 1;
+/*
+FUNCTION
+ bfd_get_file_window
+
+SYNOPSIS
+ bool bfd_get_file_window
+ (bfd *, file_ptr, bfd_size_type, bfd_window *, bool {*writable*});
+
+DESCRIPTION
+ mmap from a bfd's iostream.
+*/
bool
bfd_get_file_window (bfd *abfd,
@@ -111,6 +164,7 @@ bfd_get_file_window (bfd *abfd,
bfd_window *windowp,
bool writable)
{
+ static int ok_to_map = 1;
static size_t pagesize;
bfd_window_internal *i = windowp->i;
bfd_size_type size_to_alloc = size;
diff --git a/bfd/cache.c b/bfd/cache.c
index 3b91cce..0c6a948 100644
--- a/bfd/cache.c
+++ b/bfd/cache.c
@@ -509,7 +509,7 @@ bfd_cache_init (bfd *abfd)
}
/*
-INTERNAL_FUNCTION
+FUNCTION
bfd_cache_close
SYNOPSIS
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 594f3e0..96c53aa 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -290,7 +290,6 @@ DESCRIPTION
<<combined_entry_type>>:
CODE_FRAGMENT
-.
.typedef struct coff_ptr_struct
.{
. {* Remembers the offset from the first symbol in the file for
@@ -333,7 +332,6 @@ CODE_FRAGMENT
. void *extrap;
.} combined_entry_type;
.
-.
.{* Each canonical asymbol really looks like this: *}
.
.typedef struct coff_symbol_struct
@@ -350,7 +348,7 @@ CODE_FRAGMENT
. {* Have the line numbers been relocated yet ? *}
. bool done_lineno;
.} coff_symbol_type;
-
+.
*/
#include "libiberty.h"
@@ -1380,8 +1378,7 @@ styp_to_sec_flags (bfd *abfd,
INTERNAL_DEFINITION
bfd_coff_backend_data
-CODE_FRAGMENT
-
+INTERNAL
.{* COFF symbol classifications. *}
.
.enum coff_symbol_classification
@@ -1402,7 +1399,10 @@ CODE_FRAGMENT
. (asection *, struct bfd_link_info *, struct internal_reloc *,
. struct coff_link_hash_entry *, struct internal_syment *);
.
+
Special entry points for gdb to swap in coff symbol table parts:
+
+CODE_FRAGMENT
.typedef struct
.{
. void (*_bfd_coff_swap_aux_in)
@@ -1540,6 +1540,8 @@ Special entry points for gdb to swap in coff symbol table parts:
.
.} bfd_coff_backend_data;
.
+
+INTERNAL
.#define coff_backend_info(abfd) \
. ((const bfd_coff_backend_data *) (abfd)->xvec->backend_data)
.
@@ -5460,6 +5462,8 @@ coff_final_link_postscript (bfd * abfd ATTRIBUTE_UNUSED,
#define coff_SWAP_scnhdr_in coff_swap_scnhdr_in
#endif
+#define COFF_SWAP_TABLE (void *) &bfd_coff_std_swap_table
+
static const bfd_coff_backend_data bfd_coff_std_swap_table ATTRIBUTE_UNUSED =
{
coff_SWAP_aux_in, coff_SWAP_sym_in, coff_SWAP_lineno_in,
diff --git a/bfd/compress.c b/bfd/compress.c
index 844328b..83564fea 100644
--- a/bfd/compress.c
+++ b/bfd/compress.c
@@ -32,7 +32,7 @@
#define MAX_COMPRESSION_HEADER_SIZE 24
/*
-CODE_FRAGMENT
+EXTERNAL
.{* Types of compressed DWARF debug sections. *}
.enum compressed_debug_section_type
.{
diff --git a/bfd/doc/chew.c b/bfd/doc/chew.c
index 5257bf4..c0bd24c 100644
--- a/bfd/doc/chew.c
+++ b/bfd/doc/chew.c
@@ -515,11 +515,31 @@ outputdots (void)
if (at (tos, idx) == '.')
{
char c;
+ int spaces;
idx++;
-
+ spaces = 0;
while ((c = at (tos, idx)) && c != '\n')
{
+ if (spaces >= 0)
+ {
+ if (c == ' ')
+ {
+ spaces++;
+ idx++;
+ continue;
+ }
+ else
+ {
+ while (spaces >= 8)
+ {
+ catchar (&out, '\t');
+ spaces -= 8;
+ }
+ while (spaces-- > 0)
+ catchar (&out, ' ');
+ }
+ }
if (c == '{' && at (tos, idx + 1) == '*')
{
cattext (&out, "/*");
@@ -795,9 +815,6 @@ icopy_past_newline (void)
pc++;
}
-/* indent
- Take the string at the top of the stack, do some prettying. */
-
static void
kill_bogus_lines (void)
{
@@ -917,6 +934,9 @@ collapse_whitespace (void)
*tos = out;
}
+/* indent
+ Take the string at the top of the stack, do some prettying. */
+
static void
indent (void)
{
@@ -930,33 +950,42 @@ indent (void)
switch (at (tos, idx))
{
case '\n':
- cattext (&out, "\n");
+ catchar (&out, '\n');
idx++;
if (tab && at (tos, idx))
{
- cattext (&out, " ");
+ int i;
+ for (i = 0; i < tab - 1; i += 2)
+ catchar (&out, '\t');
+ if (i < tab)
+ cattext (&out, " ");
}
ol = 0;
break;
case '(':
- tab++;
if (ol == 0)
- cattext (&out, " ");
+ {
+ int i;
+ for (i = 1; i < tab - 1; i += 2)
+ catchar (&out, '\t');
+ if (i < tab)
+ cattext (&out, " ");
+ cattext (&out, " ");
+ }
+ tab++;
idx++;
- cattext (&out, "(");
+ catchar (&out, '(');
ol = 1;
break;
case ')':
tab--;
- cattext (&out, ")");
+ catchar (&out, ')');
idx++;
ol = 1;
-
break;
default:
catchar (&out, at (tos, idx));
ol = 1;
-
idx++;
break;
}
diff --git a/bfd/doc/doc.str b/bfd/doc/doc.str
index f59ff2e..dd0bfe4 100644
--- a/bfd/doc/doc.str
+++ b/bfd/doc/doc.str
@@ -16,6 +16,9 @@
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+- chew.c keywords defined here put output into doc/*.texi files
+- from comments in the source. See also proto.str.
+
- True if SYNOPSIS was seen.
variable synopsis_seen
@@ -32,7 +35,6 @@ variable synopsis_seen
skip_past_newline
get_stuff_in_command kill_bogus_lines do_fancy_stuff translatecomments
courierize catstr
-
;
: INODE
@@ -73,10 +75,6 @@ variable synopsis_seen
catstr catstr catstr catstr catstr
;
-: FUNCTION
- func
- ;
-
: bodytext
get_stuff_in_command
bulletize
@@ -109,28 +107,29 @@ variable synopsis_seen
bodytext
;
-
-
-
: DESCRIPTION
subhead
"@end deftypefn\n" synopsis_seen @ catstrif
0 synopsis_seen !
;
+: FUNCTION
+ func ;
+
: INTERNAL_FUNCTION
func ;
+: DEFINITION
+ func ;
-: INTERNAL_DEFINITION
+: INTERNAL_DEFINITION
func ;
+: EXTERNAL
+ COMMENT ;
: INTERNAL
- func ;
-
-: TYPEDEF
- FUNCTION ;
+ COMMENT ;
: SENUM
skip_past_newline
diff --git a/bfd/doc/proto.str b/bfd/doc/proto.str
index 3b77673..90ee011 100644
--- a/bfd/doc/proto.str
+++ b/bfd/doc/proto.str
@@ -16,13 +16,35 @@
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+- chew.c keywords defined here put output into bfd-in2.h and libbfd.h or
+- libcoff.h, from comments in the source. See also doc.str.
+- Output lines generally come from comment lines starting with a dot,
+- or from keywords like SYNOPSIS. Output switches to bfd-in2.h at the
+- end of each comment. Use INTERNAL* to output to libbfd.h.
+-
+- EXTERNAL: output to bfd-in2.h, nothing to docs
+- INTERNAL: output to libbfd.h, nothing to docs
+- CODE_FRAGMENT: output to header and docs
+- FUNCTION: output to bfd-in2.h and docs
+- INTERNAL_FUNCTION: output to libbfd.h and docs
+- DEFINITION: alias for FUNCTION, but generally doesn't have SYNOPSIS,
+- used for structs and other random code
+- INTERNAL_DEFINITION: as above, but output to libbfd.h and docs
+- ENUM* outputs to bfd-in2.h, libbfd.h and docs.
+
: SYNOPSIS
skip_past_newline
get_stuff_in_command
+ translatecomments
+ strip_trailing_newlines
+ remchar
+ " ATTRIBUTE_HIDDEN" internalmode @ catstrif
+ ";\n\n" catstr
indent
maybecatstr
;
+- Ignore stuff that is for the docs. Output lines starting with dots.
: ignore
skip_past_newline
get_stuff_in_command
@@ -33,10 +55,12 @@
: CODE_FRAGMENT
ignore ;
-: external
+- Output goes to bfd-in2.h
+: EXTERNAL
0 internalmode ! ignore ;
-: internal
+- Output goes to libbfd.h/libcoff.h
+: INTERNAL
1 internalmode ! ignore ;
- input stack { a b } output b if internal, a if external
@@ -137,14 +161,13 @@
swap
catstr catstr
;
-: ENDDD external ;
: SECTION ignore ;
: SUBSECTION ignore ;
: SUBSUBSECTION ignore ;
-: INTERNAL_DEFINITION internal ;
-: DESCRIPTION ignore ;
-: FUNCTION external ;
-: TYPEDEF external ;
-: INTERNAL_FUNCTION internal ;
-: INTERNAL internal ;
: INODE ignore ;
+: DESCRIPTION ignore ;
+: ENDDD EXTERNAL ;
+: FUNCTION EXTERNAL ;
+: INTERNAL_FUNCTION INTERNAL ;
+: DEFINITION EXTERNAL ;
+: INTERNAL_DEFINITION INTERNAL ;
diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h
index f15dcea..2c790ed 100644
--- a/bfd/elfxx-mips.h
+++ b/bfd/elfxx-mips.h
@@ -33,6 +33,8 @@ enum reloc_check
#define MIPS_DEFAULT_R6 0
#endif
+struct ecoff_debug_info;
+
extern bool _bfd_mips_elf_mkobject
(bfd *);
extern bool _bfd_mips_elf_close_and_cleanup
diff --git a/bfd/hash.c b/bfd/hash.c
index add7d10..483593e 100644
--- a/bfd/hash.c
+++ b/bfd/hash.c
@@ -295,6 +295,50 @@ SUBSUBSECTION
linker hash table, uses macros for the lookup and traversal
routines. These are <<aout_link_hash_lookup>> and
<<aout_link_hash_traverse>> in aoutx.h.
+
+EXTERNAL
+.{* An element in the hash table. Most uses will actually use a larger
+. structure, and an instance of this will be the first field. *}
+.
+.struct bfd_hash_entry
+.{
+. {* Next entry for this hash code. *}
+. struct bfd_hash_entry *next;
+. {* String being hashed. *}
+. const char *string;
+. {* Hash code. This is the full hash code, not the index into the
+. table. *}
+. unsigned long hash;
+.};
+.
+.{* A hash table. *}
+.
+.struct bfd_hash_table
+.{
+. {* The hash array. *}
+. struct bfd_hash_entry **table;
+. {* A function used to create new elements in the hash table. The
+. first entry is itself a pointer to an element. When this
+. function is first invoked, this pointer will be NULL. However,
+. having the pointer permits a hierarchy of method functions to be
+. built each of which calls the function in the superclass. Thus
+. each function should be written to allocate a new block of memory
+. only if the argument is NULL. *}
+. struct bfd_hash_entry *(*newfunc)
+. (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
+. {* An objalloc for this hash table. This is a struct objalloc *,
+. but we use void * to avoid requiring the inclusion of objalloc.h. *}
+. void *memory;
+. {* The number of slots in the hash table. *}
+. unsigned int size;
+. {* The number of entries in the hash table. *}
+. unsigned int count;
+. {* The size of elements. *}
+. unsigned int entsize;
+. {* If non-zero, don't grow the hash table. *}
+. unsigned int frozen:1;
+.};
+.
*/
/* The default number of entries to use when creating a hash table. */
@@ -361,7 +405,20 @@ higher_prime_number (uint32_t n)
static unsigned int bfd_default_hash_table_size = DEFAULT_SIZE;
-/* Create a new hash table, given a number of entries. */
+/*
+FUNCTION
+ bfd_hash_table_init_n
+
+SYNOPSIS
+ bool bfd_hash_table_init_n
+ (struct bfd_hash_table *,
+ struct bfd_hash_entry *(* {*newfunc*})
+ (struct bfd_hash_entry *, struct bfd_hash_table *, const char *),
+ unsigned int {*entsize*}, unsigned int {*size*});
+
+DESCRIPTION
+ Create a new hash table, given a number of entries.
+*/
bool
bfd_hash_table_init_n (struct bfd_hash_table *table,
@@ -404,7 +461,20 @@ bfd_hash_table_init_n (struct bfd_hash_table *table,
return true;
}
-/* Create a new hash table with the default number of entries. */
+/*
+FUNCTION
+ bfd_hash_table_init
+
+SYNOPSIS
+ bool bfd_hash_table_init
+ (struct bfd_hash_table *,
+ struct bfd_hash_entry *(* {*newfunc*})
+ (struct bfd_hash_entry *, struct bfd_hash_table *, const char *),
+ unsigned int {*entsize*});
+
+DESCRIPTION
+ Create a new hash table with the default number of entries.
+*/
bool
bfd_hash_table_init (struct bfd_hash_table *table,
@@ -417,7 +487,16 @@ bfd_hash_table_init (struct bfd_hash_table *table,
bfd_default_hash_table_size);
}
-/* Free a hash table. */
+/*
+FUNCTION
+ bfd_hash_table_free
+
+SYNOPSIS
+ void bfd_hash_table_free (struct bfd_hash_table *);
+
+DESCRIPTION
+ Free a hash table.
+*/
void
bfd_hash_table_free (struct bfd_hash_table *table)
@@ -451,7 +530,18 @@ bfd_hash_hash (const char *string, unsigned int *lenp)
return hash;
}
-/* Look up a string in a hash table. */
+/*
+FUNCTION
+ bfd_hash_lookup
+
+SYNOPSIS
+ struct bfd_hash_entry *bfd_hash_lookup
+ (struct bfd_hash_table *, const char *,
+ bool {*create*}, bool {*copy*});
+
+DESCRIPTION
+ Look up a string in a hash table.
+*/
struct bfd_hash_entry *
bfd_hash_lookup (struct bfd_hash_table *table,
@@ -496,7 +586,19 @@ bfd_hash_lookup (struct bfd_hash_table *table,
return bfd_hash_insert (table, string, hash);
}
-/* Insert an entry in a hash table. */
+/*
+FUNCTION
+ bfd_hash_insert
+
+SYNOPSIS
+ struct bfd_hash_entry *bfd_hash_insert
+ (struct bfd_hash_table *,
+ const char *,
+ unsigned long {*hash*});
+
+DESCRIPTION
+ Insert an entry in a hash table.
+*/
struct bfd_hash_entry *
bfd_hash_insert (struct bfd_hash_table *table,
@@ -561,7 +663,18 @@ bfd_hash_insert (struct bfd_hash_table *table,
return hashp;
}
-/* Rename an entry in a hash table. */
+/*
+FUNCTION
+ bfd_hash_rename
+
+SYNOPSIS
+ void bfd_hash_rename (struct bfd_hash_table *,
+ const char *,
+ struct bfd_hash_entry *);
+
+DESCRIPTION
+ Rename an entry in a hash table.
+*/
void
bfd_hash_rename (struct bfd_hash_table *table,
@@ -586,7 +699,18 @@ bfd_hash_rename (struct bfd_hash_table *table,
table->table[_index] = ent;
}
-/* Replace an entry in a hash table. */
+/*
+FUNCTION
+ bfd_hash_replace
+
+SYNOPSIS
+ void bfd_hash_replace (struct bfd_hash_table *,
+ struct bfd_hash_entry * {*old*},
+ struct bfd_hash_entry * {*new*});
+
+DESCRIPTION
+ Replace an entry in a hash table.
+*/
void
bfd_hash_replace (struct bfd_hash_table *table,
@@ -611,7 +735,17 @@ bfd_hash_replace (struct bfd_hash_table *table,
abort ();
}
-/* Allocate space in a hash table. */
+/*
+FUNCTION
+ bfd_hash_allocate
+
+SYNOPSIS
+ void *bfd_hash_allocate (struct bfd_hash_table *,
+ unsigned int {*size*});
+
+DESCRIPTION
+ Allocate space in a hash table.
+*/
void *
bfd_hash_allocate (struct bfd_hash_table *table,
@@ -625,7 +759,19 @@ bfd_hash_allocate (struct bfd_hash_table *table,
return ret;
}
-/* Base method for creating a new hash table entry. */
+/*
+FUNCTION
+ bfd_hash_newfunc
+
+SYNOPSIS
+ struct bfd_hash_entry *bfd_hash_newfunc
+ (struct bfd_hash_entry *,
+ struct bfd_hash_table *,
+ const char *);
+
+DESCRIPTION
+ Base method for creating a new hash table entry.
+*/
struct bfd_hash_entry *
bfd_hash_newfunc (struct bfd_hash_entry *entry,
@@ -638,12 +784,24 @@ bfd_hash_newfunc (struct bfd_hash_entry *entry,
return entry;
}
-/* Traverse a hash table. */
+/*
+FUNCTION
+ bfd_hash_traverse
+
+SYNOPSIS
+ void bfd_hash_traverse
+ (struct bfd_hash_table *,
+ bool (*) (struct bfd_hash_entry *, void *),
+ void *);
+
+DESCRIPTION
+ Traverse a hash table.
+*/
void
bfd_hash_traverse (struct bfd_hash_table *table,
bool (*func) (struct bfd_hash_entry *, void *),
- void * info)
+ void *info)
{
unsigned int i;
@@ -660,6 +818,17 @@ bfd_hash_traverse (struct bfd_hash_table *table,
table->frozen = 0;
}
+/*
+FUNCTION
+ bfd_hash_set_default_size
+
+SYNOPSIS
+ unsigned int bfd_hash_set_default_size (unsigned int);
+
+DESCRIPTION
+ Set hash table default size.
+*/
+
unsigned int
bfd_hash_set_default_size (unsigned int hash_size)
{
@@ -755,7 +924,16 @@ strtab_hash_newfunc (struct bfd_hash_entry *entry,
((struct strtab_hash_entry *) \
bfd_hash_lookup (&(t)->table, (string), (create), (copy)))
-/* Create a new strtab. */
+/*
+INTERNAL_FUNCTION
+ _bfd_stringtab_init
+
+SYNOPSIS
+ struct bfd_strtab_hash *_bfd_stringtab_init (void);
+
+DESCRIPTION
+ Create a new strtab.
+*/
struct bfd_strtab_hash *
_bfd_stringtab_init (void)
@@ -782,9 +960,19 @@ _bfd_stringtab_init (void)
return table;
}
-/* Create a new strtab in which the strings are output in the format
- used in the XCOFF .debug section: a two byte length precedes each
- string. */
+/*
+INTERNAL_FUNCTION
+ _bfd_xcoff_stringtab_init
+
+SYNOPSIS
+ struct bfd_strtab_hash *_bfd_xcoff_stringtab_init
+ (bool {*isxcoff64*});
+
+DESCRIPTION
+ Create a new strtab in which the strings are output in the format
+ used in the XCOFF .debug section: a two byte length precedes each
+ string.
+*/
struct bfd_strtab_hash *
_bfd_xcoff_stringtab_init (bool isxcoff64)
@@ -797,7 +985,16 @@ _bfd_xcoff_stringtab_init (bool isxcoff64)
return ret;
}
-/* Free a strtab. */
+/*
+INTERNAL_FUNCTION
+ _bfd_stringtab_free
+
+SYNOPSIS
+ void _bfd_stringtab_free (struct bfd_strtab_hash *);
+
+DESCRIPTION
+ Free a strtab.
+*/
void
_bfd_stringtab_free (struct bfd_strtab_hash *table)
@@ -806,10 +1003,21 @@ _bfd_stringtab_free (struct bfd_strtab_hash *table)
free (table);
}
-/* Get the index of a string in a strtab, adding it if it is not
- already present. If HASH is FALSE, we don't really use the hash
- table, and we don't eliminate duplicate strings. If COPY is true
- then store a copy of STR if creating a new entry. */
+/*
+INTERNAL_FUNCTION
+ _bfd_stringtab_add
+
+SYNOPSIS
+ bfd_size_type _bfd_stringtab_add
+ (struct bfd_strtab_hash *, const char *,
+ bool {*hash*}, bool {*copy*});
+
+DESCRIPTION
+ Get the index of a string in a strtab, adding it if it is not
+ already present. If HASH is FALSE, we don't really use the hash
+ table, and we don't eliminate duplicate strings. If COPY is true
+ then store a copy of STR if creating a new entry.
+*/
bfd_size_type
_bfd_stringtab_add (struct bfd_strtab_hash *tab,
@@ -864,7 +1072,16 @@ _bfd_stringtab_add (struct bfd_strtab_hash *tab,
return entry->index;
}
-/* Get the number of bytes in a strtab. */
+/*
+INTERNAL_FUNCTION
+ _bfd_stringtab_size
+
+SYNOPSIS
+ bfd_size_type _bfd_stringtab_size (struct bfd_strtab_hash *);
+
+DESCRIPTION
+ Get the number of bytes in a strtab.
+*/
bfd_size_type
_bfd_stringtab_size (struct bfd_strtab_hash *tab)
@@ -872,8 +1089,17 @@ _bfd_stringtab_size (struct bfd_strtab_hash *tab)
return tab->size;
}
-/* Write out a strtab. ABFD must already be at the right location in
- the file. */
+/*
+INTERNAL_FUNCTION
+ _bfd_stringtab_emit
+
+SYNOPSIS
+ bool _bfd_stringtab_emit (bfd *, struct bfd_strtab_hash *);
+
+DESCRIPTION
+ Write out a strtab. ABFD must already be at the right location in
+ the file.
+*/
bool
_bfd_stringtab_emit (bfd *abfd, struct bfd_strtab_hash *tab)
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
index ca15b8b..b3f5190 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -170,10 +170,6 @@ extern bfd *_bfd_get_elt_at_filepos
(bfd *, file_ptr, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
extern bfd *_bfd_generic_get_elt_at_index
(bfd *, symindex) ATTRIBUTE_HIDDEN;
-extern bfd * _bfd_new_bfd
- (void) ATTRIBUTE_HIDDEN;
-extern bool _bfd_free_cached_info
- (bfd *) ATTRIBUTE_HIDDEN;
extern bool _bfd_bool_bfd_false
(bfd *) ATTRIBUTE_HIDDEN;
@@ -214,8 +210,6 @@ extern void _bfd_void_bfd_link
extern void _bfd_void_bfd_asection
(bfd *, asection *) ATTRIBUTE_HIDDEN;
-extern bfd *_bfd_new_bfd_contained_in
- (bfd *) ATTRIBUTE_HIDDEN;
extern bfd_cleanup _bfd_dummy_target
(bfd *) ATTRIBUTE_HIDDEN;
#define _bfd_no_cleanup _bfd_void_bfd
@@ -709,34 +703,6 @@ extern bfd_reloc_status_type _bfd_relocate_contents
extern bfd_reloc_status_type _bfd_clear_contents
(reloc_howto_type *, bfd *, asection *, bfd_byte *, bfd_vma) ATTRIBUTE_HIDDEN;
-/* Link stabs in sections in the first pass. */
-
-extern bool _bfd_link_section_stabs
- (bfd *, struct stab_info *, asection *, asection *, void **,
- bfd_size_type *) ATTRIBUTE_HIDDEN;
-
-/* Eliminate stabs for discarded functions and symbols. */
-extern bool _bfd_discard_section_stabs
- (bfd *, asection *, void *, bool (*) (bfd_vma, void *), void *)
- ATTRIBUTE_HIDDEN;
-
-/* Write out the .stab section when linking stabs in sections. */
-
-extern bool _bfd_write_section_stabs
- (bfd *, struct stab_info *, asection *, void **, bfd_byte *)
- ATTRIBUTE_HIDDEN;
-
-/* Write out the .stabstr string table when linking stabs in sections. */
-
-extern bool _bfd_write_stab_strings
- (bfd *, struct stab_info *) ATTRIBUTE_HIDDEN;
-
-/* Find an offset within a .stab section when linking stabs in
- sections. */
-
-extern bfd_vma _bfd_stab_section_offset
- (asection *, void *, bfd_vma) ATTRIBUTE_HIDDEN;
-
/* Register a SEC_MERGE section as a candidate for merging. */
extern bool _bfd_add_merge_section
@@ -762,31 +728,6 @@ extern bfd_vma _bfd_merged_section_offset
extern void _bfd_merge_sections_free (void *) ATTRIBUTE_HIDDEN;
-/* Create a string table. */
-extern struct bfd_strtab_hash *_bfd_stringtab_init
- (void) ATTRIBUTE_HIDDEN;
-
-/* Create an XCOFF .debug section style string table. */
-extern struct bfd_strtab_hash *_bfd_xcoff_stringtab_init
- (bool isxcoff64) ATTRIBUTE_HIDDEN;
-
-/* Free a string table. */
-extern void _bfd_stringtab_free
- (struct bfd_strtab_hash *) ATTRIBUTE_HIDDEN;
-
-/* Get the size of a string table. */
-extern bfd_size_type _bfd_stringtab_size
- (struct bfd_strtab_hash *) ATTRIBUTE_HIDDEN;
-
-/* Add a string to a string table. */
-extern bfd_size_type _bfd_stringtab_add
- (struct bfd_strtab_hash *, const char *, bool hash, bool copy)
- ATTRIBUTE_HIDDEN;
-
-/* Write out a string table. */
-extern bool _bfd_stringtab_emit
- (bfd *, struct bfd_strtab_hash *) ATTRIBUTE_HIDDEN;
-
/* Macros to tell if bfds are read or write enabled.
Note that bfds open for read may be scribbled into if the fd passed
@@ -841,9 +782,10 @@ extern const bfd_target *const *const bfd_associated_vector ATTRIBUTE_HIDDEN;
/* Functions shared by the ECOFF and MIPS ELF backends, which have no
other common header files. */
-#if defined(__STDC__) || defined(ALMOST_STDC)
+struct ecoff_debug_info;
+struct ecoff_debug_swap;
+struct ecoff_extr;
struct ecoff_find_line;
-#endif
extern bool _bfd_ecoff_locate_line
(bfd *, asection *, bfd_vma, struct ecoff_debug_info * const,
diff --git a/bfd/libbfd.c b/bfd/libbfd.c
index 66ef324..7c75047 100644
--- a/bfd/libbfd.c
+++ b/bfd/libbfd.c
@@ -264,7 +264,7 @@ INTERNAL_FUNCTION
bfd_malloc
SYNOPSIS
- extern void * bfd_malloc (bfd_size_type SIZE) ATTRIBUTE_HIDDEN;
+ void *bfd_malloc (bfd_size_type {*size*});
DESCRIPTION
Returns a pointer to an allocated block of memory that is at least
@@ -299,7 +299,7 @@ INTERNAL_FUNCTION
bfd_realloc
SYNOPSIS
- extern void * bfd_realloc (void * MEM, bfd_size_type SIZE) ATTRIBUTE_HIDDEN;
+ void *bfd_realloc (void *{*mem*}, bfd_size_type {*size*});
DESCRIPTION
Returns a pointer to an allocated block of memory that is at least
@@ -349,7 +349,7 @@ INTERNAL_FUNCTION
bfd_realloc_or_free
SYNOPSIS
- extern void * bfd_realloc_or_free (void * MEM, bfd_size_type SIZE) ATTRIBUTE_HIDDEN;
+ void *bfd_realloc_or_free (void *{*mem*}, bfd_size_type {*size*});
DESCRIPTION
Returns a pointer to an allocated block of memory that is at least
@@ -394,7 +394,7 @@ INTERNAL_FUNCTION
bfd_zmalloc
SYNOPSIS
- extern void * bfd_zmalloc (bfd_size_type SIZE) ATTRIBUTE_HIDDEN;
+ void *bfd_zmalloc (bfd_size_type {*size*});
DESCRIPTION
Returns a pointer to an allocated block of memory that is at least
@@ -701,6 +701,35 @@ DESCRIPTION
#define COERCE64(x) \
(((uint64_t) (x) ^ ((uint64_t) 1 << 63)) - ((uint64_t) 1 << 63))
+/*
+FUNCTION
+ Byte swapping routines.
+
+SYNOPSIS
+ uint64_t bfd_getb64 (const void *);
+ uint64_t bfd_getl64 (const void *);
+ int64_t bfd_getb_signed_64 (const void *);
+ int64_t bfd_getl_signed_64 (const void *);
+ bfd_vma bfd_getb32 (const void *);
+ bfd_vma bfd_getl32 (const void *);
+ bfd_signed_vma bfd_getb_signed_32 (const void *);
+ bfd_signed_vma bfd_getl_signed_32 (const void *);
+ bfd_vma bfd_getb16 (const void *);
+ bfd_vma bfd_getl16 (const void *);
+ bfd_signed_vma bfd_getb_signed_16 (const void *);
+ bfd_signed_vma bfd_getl_signed_16 (const void *);
+ void bfd_putb64 (uint64_t, void *);
+ void bfd_putl64 (uint64_t, void *);
+ void bfd_putb32 (bfd_vma, void *);
+ void bfd_putl32 (bfd_vma, void *);
+ void bfd_putb24 (bfd_vma, void *);
+ void bfd_putl24 (bfd_vma, void *);
+ void bfd_putb16 (bfd_vma, void *);
+ void bfd_putl16 (bfd_vma, void *);
+ uint64_t bfd_get_bits (const void *, int, bool);
+ void bfd_put_bits (uint64_t, void *, int, bool);
+*/
+
bfd_vma
bfd_getb16 (const void *p)
{
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index 3bd79d2..f56f2b8 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -1,7 +1,7 @@
/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically
generated from "libbfd-in.h", "libbfd.c", "bfd.c", "bfdio.c",
- "bfdwin.c", "cache.c", "reloc.c", "section.c", "targets.c", "archures.c"
- and "linker.c".
+ "archive.c", "archures.c", "bfdwin.c", "cache.c", "hash.c", "linker.c",
+ "opncls.c", "reloc.c", "section.c", "stabs.c" and "targets.c".
Run "make headers" in your build bfd/ to regenerate. */
/* libbfd.h -- Declarations used by bfd library *implementation*.
@@ -176,10 +176,6 @@ extern bfd *_bfd_get_elt_at_filepos
(bfd *, file_ptr, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
extern bfd *_bfd_generic_get_elt_at_index
(bfd *, symindex) ATTRIBUTE_HIDDEN;
-extern bfd * _bfd_new_bfd
- (void) ATTRIBUTE_HIDDEN;
-extern bool _bfd_free_cached_info
- (bfd *) ATTRIBUTE_HIDDEN;
extern bool _bfd_bool_bfd_false
(bfd *) ATTRIBUTE_HIDDEN;
@@ -220,8 +216,6 @@ extern void _bfd_void_bfd_link
extern void _bfd_void_bfd_asection
(bfd *, asection *) ATTRIBUTE_HIDDEN;
-extern bfd *_bfd_new_bfd_contained_in
- (bfd *) ATTRIBUTE_HIDDEN;
extern bfd_cleanup _bfd_dummy_target
(bfd *) ATTRIBUTE_HIDDEN;
#define _bfd_no_cleanup _bfd_void_bfd
@@ -715,34 +709,6 @@ extern bfd_reloc_status_type _bfd_relocate_contents
extern bfd_reloc_status_type _bfd_clear_contents
(reloc_howto_type *, bfd *, asection *, bfd_byte *, bfd_vma) ATTRIBUTE_HIDDEN;
-/* Link stabs in sections in the first pass. */
-
-extern bool _bfd_link_section_stabs
- (bfd *, struct stab_info *, asection *, asection *, void **,
- bfd_size_type *) ATTRIBUTE_HIDDEN;
-
-/* Eliminate stabs for discarded functions and symbols. */
-extern bool _bfd_discard_section_stabs
- (bfd *, asection *, void *, bool (*) (bfd_vma, void *), void *)
- ATTRIBUTE_HIDDEN;
-
-/* Write out the .stab section when linking stabs in sections. */
-
-extern bool _bfd_write_section_stabs
- (bfd *, struct stab_info *, asection *, void **, bfd_byte *)
- ATTRIBUTE_HIDDEN;
-
-/* Write out the .stabstr string table when linking stabs in sections. */
-
-extern bool _bfd_write_stab_strings
- (bfd *, struct stab_info *) ATTRIBUTE_HIDDEN;
-
-/* Find an offset within a .stab section when linking stabs in
- sections. */
-
-extern bfd_vma _bfd_stab_section_offset
- (asection *, void *, bfd_vma) ATTRIBUTE_HIDDEN;
-
/* Register a SEC_MERGE section as a candidate for merging. */
extern bool _bfd_add_merge_section
@@ -768,31 +734,6 @@ extern bfd_vma _bfd_merged_section_offset
extern void _bfd_merge_sections_free (void *) ATTRIBUTE_HIDDEN;
-/* Create a string table. */
-extern struct bfd_strtab_hash *_bfd_stringtab_init
- (void) ATTRIBUTE_HIDDEN;
-
-/* Create an XCOFF .debug section style string table. */
-extern struct bfd_strtab_hash *_bfd_xcoff_stringtab_init
- (bool isxcoff64) ATTRIBUTE_HIDDEN;
-
-/* Free a string table. */
-extern void _bfd_stringtab_free
- (struct bfd_strtab_hash *) ATTRIBUTE_HIDDEN;
-
-/* Get the size of a string table. */
-extern bfd_size_type _bfd_stringtab_size
- (struct bfd_strtab_hash *) ATTRIBUTE_HIDDEN;
-
-/* Add a string to a string table. */
-extern bfd_size_type _bfd_stringtab_add
- (struct bfd_strtab_hash *, const char *, bool hash, bool copy)
- ATTRIBUTE_HIDDEN;
-
-/* Write out a string table. */
-extern bool _bfd_stringtab_emit
- (bfd *, struct bfd_strtab_hash *) ATTRIBUTE_HIDDEN;
-
/* Macros to tell if bfds are read or write enabled.
Note that bfds open for read may be scribbled into if the fd passed
@@ -847,9 +788,10 @@ extern const bfd_target *const *const bfd_associated_vector ATTRIBUTE_HIDDEN;
/* Functions shared by the ECOFF and MIPS ELF backends, which have no
other common header files. */
-#if defined(__STDC__) || defined(ALMOST_STDC)
+struct ecoff_debug_info;
+struct ecoff_debug_swap;
+struct ecoff_extr;
struct ecoff_find_line;
-#endif
extern bool _bfd_ecoff_locate_line
(bfd *, asection *, bfd_vma, struct ecoff_debug_info * const,
@@ -976,22 +918,22 @@ _bfd_malloc_and_read (bfd *abfd, bfd_size_type asize, bfd_size_type rsize)
return NULL;
}
/* Extracted from libbfd.c. */
-extern void * bfd_malloc (bfd_size_type SIZE) ATTRIBUTE_HIDDEN;
+void *bfd_malloc (bfd_size_type /*size*/) ATTRIBUTE_HIDDEN;
-extern void * bfd_realloc (void * MEM, bfd_size_type SIZE) ATTRIBUTE_HIDDEN;
+void *bfd_realloc (void */*mem*/, bfd_size_type /*size*/) ATTRIBUTE_HIDDEN;
-extern void * bfd_realloc_or_free (void * MEM, bfd_size_type SIZE) ATTRIBUTE_HIDDEN;
+void *bfd_realloc_or_free (void */*mem*/, bfd_size_type /*size*/) ATTRIBUTE_HIDDEN;
-extern void * bfd_zmalloc (bfd_size_type SIZE) ATTRIBUTE_HIDDEN;
+void *bfd_zmalloc (bfd_size_type /*size*/) ATTRIBUTE_HIDDEN;
-bool bfd_write_bigendian_4byte_int (bfd *, unsigned int);
+bool bfd_write_bigendian_4byte_int (bfd *, unsigned int) ATTRIBUTE_HIDDEN;
-unsigned int bfd_log2 (bfd_vma x);
+unsigned int bfd_log2 (bfd_vma x) ATTRIBUTE_HIDDEN;
/* Extracted from bfd.c. */
-bfd_error_handler_type _bfd_set_error_handler_caching (bfd *);
+bfd_error_handler_type _bfd_set_error_handler_caching (bfd *) ATTRIBUTE_HIDDEN;
-const char *_bfd_get_error_program_name (void);
+const char *_bfd_get_error_program_name (void) ATTRIBUTE_HIDDEN;
/* Extracted from bfdio.c. */
struct bfd_iovec
@@ -1004,7 +946,7 @@ struct bfd_iovec
or -1 (setting <<bfd_error>>) if an error occurs. */
file_ptr (*bread) (struct bfd *abfd, void *ptr, file_ptr nbytes);
file_ptr (*bwrite) (struct bfd *abfd, const void *ptr,
- file_ptr nbytes);
+ file_ptr nbytes);
/* Return the current IOSTREAM file offset, or -1 (setting <<bfd_error>>
if an error occurs. */
file_ptr (*btell) (struct bfd *abfd);
@@ -1021,24 +963,79 @@ struct bfd_iovec
MAP_LEN the size mapped (a page multiple). Use unmap with MAP_ADDR and
MAP_LEN to unmap. */
void *(*bmmap) (struct bfd *abfd, void *addr, bfd_size_type len,
- int prot, int flags, file_ptr offset,
- void **map_addr, bfd_size_type *map_len);
+ int prot, int flags, file_ptr offset,
+ void **map_addr, bfd_size_type *map_len);
};
extern const struct bfd_iovec _bfd_memory_iovec;
+
+/* Extracted from archive.c. */
+/* Used in generating armaps (archive tables of contents). */
+struct orl /* Output ranlib. */
+{
+ char **name; /* Symbol name. */
+ union
+ {
+ file_ptr pos;
+ bfd *abfd;
+ } u; /* bfd* or file position. */
+ int namidx; /* Index into string table. */
+};
+
+/* Extracted from archures.c. */
+extern const bfd_arch_info_type bfd_default_arch_struct;
+
+const bfd_arch_info_type *bfd_default_compatible
+ (const bfd_arch_info_type *a, const bfd_arch_info_type *b) ATTRIBUTE_HIDDEN;
+
+bool bfd_default_scan
+ (const struct bfd_arch_info *info, const char *string) ATTRIBUTE_HIDDEN;
+
+void *bfd_arch_default_fill (bfd_size_type count,
+ bool is_bigendian,
+ bool code) ATTRIBUTE_HIDDEN;
+
/* Extracted from bfdwin.c. */
-struct _bfd_window_internal {
+typedef struct _bfd_window_internal
+{
struct _bfd_window_internal *next;
void *data;
bfd_size_type size;
int refcount : 31; /* should be enough... */
unsigned mapped : 1; /* 1 = mmap, 0 = malloc */
-};
+}
+bfd_window_internal;
+
/* Extracted from cache.c. */
-bool bfd_cache_init (bfd *abfd);
+bool bfd_cache_init (bfd *abfd) ATTRIBUTE_HIDDEN;
+
+FILE* bfd_open_file (bfd *abfd) ATTRIBUTE_HIDDEN;
+
+/* Extracted from hash.c. */
+struct bfd_strtab_hash *_bfd_stringtab_init (void) ATTRIBUTE_HIDDEN;
+
+struct bfd_strtab_hash *_bfd_xcoff_stringtab_init
+ (bool /*isxcoff64*/) ATTRIBUTE_HIDDEN;
+
+void _bfd_stringtab_free (struct bfd_strtab_hash *) ATTRIBUTE_HIDDEN;
+
+bfd_size_type _bfd_stringtab_add
+ (struct bfd_strtab_hash *, const char *,
+ bool /*hash*/, bool /*copy*/) ATTRIBUTE_HIDDEN;
+
+bfd_size_type _bfd_stringtab_size (struct bfd_strtab_hash *) ATTRIBUTE_HIDDEN;
+
+bool _bfd_stringtab_emit (bfd *, struct bfd_strtab_hash *) ATTRIBUTE_HIDDEN;
+
+/* Extracted from linker.c. */
+bool _bfd_generic_verify_endian_match
+ (bfd *ibfd, struct bfd_link_info *info) ATTRIBUTE_HIDDEN;
+
+/* Extracted from opncls.c. */
+bfd *_bfd_new_bfd (void) ATTRIBUTE_HIDDEN;
-bool bfd_cache_close (bfd *abfd);
+bfd *_bfd_new_bfd_contained_in (bfd *) ATTRIBUTE_HIDDEN;
-FILE* bfd_open_file (bfd *abfd);
+bool _bfd_free_cached_info (bfd *) ATTRIBUTE_HIDDEN;
/* Extracted from reloc.c. */
#ifdef _BFD_MAKE_TABLE_bfd_reloc_code_real
@@ -3515,22 +3512,22 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
#endif
reloc_howto_type *bfd_default_reloc_type_lookup
- (bfd *abfd, bfd_reloc_code_real_type code);
+ (bfd *abfd, bfd_reloc_code_real_type code) ATTRIBUTE_HIDDEN;
bool bfd_generic_relax_section
(bfd *abfd,
asection *section,
struct bfd_link_info *,
- bool *);
+ bool *) ATTRIBUTE_HIDDEN;
bool bfd_generic_gc_sections
- (bfd *, struct bfd_link_info *);
+ (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
bool bfd_generic_lookup_section_flags
- (struct bfd_link_info *, struct flag_info *, asection *);
+ (struct bfd_link_info *, struct flag_info *, asection *) ATTRIBUTE_HIDDEN;
bool bfd_generic_merge_sections
- (bfd *, struct bfd_link_info *);
+ (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
bfd_byte *bfd_generic_get_relocated_section_contents
(bfd *abfd,
@@ -3538,40 +3535,46 @@ bfd_byte *bfd_generic_get_relocated_section_contents
struct bfd_link_order *link_order,
bfd_byte *data,
bool relocatable,
- asymbol **symbols);
+ asymbol **symbols) ATTRIBUTE_HIDDEN;
void _bfd_generic_set_reloc
(bfd *abfd,
sec_ptr section,
arelent **relptr,
- unsigned int count);
+ unsigned int count) ATTRIBUTE_HIDDEN;
bool _bfd_unrecognized_reloc
(bfd * abfd,
sec_ptr section,
- unsigned int r_type);
+ unsigned int r_type) ATTRIBUTE_HIDDEN;
/* Extracted from section.c. */
-bool _bfd_section_size_insane (bfd *abfd, asection *sec);
+bool _bfd_section_size_insane (bfd *abfd, asection *sec) ATTRIBUTE_HIDDEN;
-/* Extracted from targets.c. */
-struct per_xvec_message **_bfd_per_xvec_warn (const bfd_target *, size_t);
+/* Extracted from stabs.c. */
+bool _bfd_link_section_stabs
+ (bfd *, struct stab_info *, asection *, asection *, void **,
+ bfd_size_type *) ATTRIBUTE_HIDDEN;
-/* Extracted from archures.c. */
-extern const bfd_arch_info_type bfd_default_arch_struct;
-const bfd_arch_info_type *bfd_default_compatible
- (const bfd_arch_info_type *a, const bfd_arch_info_type *b);
+bool _bfd_discard_section_stabs
+ (bfd *, asection *, void *, bool (*) (bfd_vma, void *), void *) ATTRIBUTE_HIDDEN;
-bool bfd_default_scan
- (const struct bfd_arch_info *info, const char *string);
+bool _bfd_write_section_stabs
+ (bfd *, struct stab_info *, asection *, void **, bfd_byte *) ATTRIBUTE_HIDDEN;
-void *bfd_arch_default_fill (bfd_size_type count,
- bool is_bigendian,
- bool code);
+bool _bfd_write_stab_strings (bfd *, struct stab_info *) ATTRIBUTE_HIDDEN;
-/* Extracted from linker.c. */
-bool _bfd_generic_verify_endian_match
- (bfd *ibfd, struct bfd_link_info *info);
+bfd_vma _bfd_stab_section_offset (asection *, void *, bfd_vma) ATTRIBUTE_HIDDEN;
+
+/* Extracted from targets.c. */
+/* Cached _bfd_check_format messages are put in this. */
+struct per_xvec_message
+{
+ struct per_xvec_message *next;
+ char message[];
+};
+
+struct per_xvec_message **_bfd_per_xvec_warn (const bfd_target *, size_t) ATTRIBUTE_HIDDEN;
#ifdef __cplusplus
}
diff --git a/bfd/libcoff.h b/bfd/libcoff.h
index b58ee8a..12bd758 100644
--- a/bfd/libcoff.h
+++ b/bfd/libcoff.h
@@ -629,7 +629,6 @@ extern bool _bfd_ppc_xcoff_relocate_section
(bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
struct internal_reloc *, struct internal_syment *, asection **);
/* Extracted from coffcode.h. */
-
typedef struct coff_ptr_struct
{
/* Remembers the offset from the first symbol in the file for
@@ -672,7 +671,6 @@ typedef struct coff_ptr_struct
void *extrap;
} combined_entry_type;
-
/* Each canonical asymbol really looks like this: */
typedef struct coff_symbol_struct
@@ -689,6 +687,7 @@ typedef struct coff_symbol_struct
/* Have the line numbers been relocated yet ? */
bool done_lineno;
} coff_symbol_type;
+
/* COFF symbol classifications. */
enum coff_symbol_classification
@@ -943,7 +942,7 @@ typedef struct
(abfd, file, base, symbol, aux, indaux))
#define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order,\
- reloc, data, src_ptr, dst_ptr)\
+ reloc, data, src_ptr, dst_ptr)\
((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\
(abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr))
@@ -972,7 +971,7 @@ typedef struct
((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\
(obfd, info, ibfd, sec, rel, adjustedp))
#define bfd_coff_link_add_one_symbol(info, abfd, name, flags, section,\
- value, string, cp, coll, hashp)\
+ value, string, cp, coll, hashp)\
((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\
(info, abfd, name, flags, section, value, string, cp, coll, hashp))
diff --git a/bfd/linker.c b/bfd/linker.c
index e57c9ee..0f4f9a1 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -3399,6 +3399,7 @@ DESCRIPTION
.#define bfd_merge_private_bfd_data(ibfd, info) \
. BFD_SEND ((info)->output_bfd, _bfd_merge_private_bfd_data, \
. (ibfd, info))
+.
*/
/*
diff --git a/bfd/opncls.c b/bfd/opncls.c
index b7b9d8f..f006495 100644
--- a/bfd/opncls.c
+++ b/bfd/opncls.c
@@ -51,16 +51,26 @@ static unsigned int bfd_id_counter = 0;
static unsigned int bfd_reserved_id_counter = 0;
/*
-CODE_FRAGMENT
+EXTERNAL
.{* Set to N to open the next N BFDs using an alternate id space. *}
.extern unsigned int bfd_use_reserved_id;
+.
*/
unsigned int bfd_use_reserved_id = 0;
/* fdopen is a loser -- we should use stdio exclusively. Unfortunately
if we do that we can't use fcntl. */
-/* Return a new BFD. All BFD's are allocated through this routine. */
+/*
+INTERNAL_FUNCTION
+ _bfd_new_bfd
+
+SYNOPSIS
+ bfd *_bfd_new_bfd (void);
+
+DESCRIPTION
+ Return a new BFD. All BFD's are allocated through this routine.
+*/
bfd *
_bfd_new_bfd (void)
@@ -104,7 +114,16 @@ _bfd_new_bfd (void)
static const struct bfd_iovec opncls_iovec;
-/* Allocate a new BFD as a member of archive OBFD. */
+/*
+INTERNAL_FUNCTION
+ _bfd_new_bfd_contained_in
+
+SYNOPSIS
+ bfd *_bfd_new_bfd_contained_in (bfd *);
+
+DESCRIPTION
+ Allocate a new BFD as a member of archive OBFD.
+*/
bfd *
_bfd_new_bfd_contained_in (bfd *obfd)
@@ -149,7 +168,16 @@ _bfd_delete_bfd (bfd *abfd)
free (abfd);
}
-/* Free objalloc memory. */
+/*
+INTERNAL_FUNCTION
+ _bfd_free_cached_info
+
+SYNOPSIS
+ bool _bfd_free_cached_info (bfd *);
+
+DESCRIPTION
+ Free objalloc memory.
+*/
bool
_bfd_free_cached_info (bfd *abfd)
diff --git a/bfd/reloc.c b/bfd/reloc.c
index 1654063..aab5d49 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -62,8 +62,7 @@ SUBSECTION
This is the structure of a relocation entry:
-CODE_FRAGMENT
-.
+EXTERNAL
.typedef enum bfd_reloc_status
.{
. {* No errors detected. Note - the value 2 is used so that it
@@ -97,7 +96,9 @@ CODE_FRAGMENT
.
.typedef const struct reloc_howto_struct reloc_howto_type;
.
-.typedef struct reloc_cache_entry
+
+CODE_FRAGMENT
+.struct reloc_cache_entry
.{
. {* A pointer into the canonical table of pointers. *}
. struct bfd_symbol **sym_ptr_ptr;
@@ -111,8 +112,7 @@ CODE_FRAGMENT
. {* Pointer to how to perform the required relocation. *}
. reloc_howto_type *howto;
.
-.}
-.arelent;
+.};
.
*/
@@ -251,7 +251,6 @@ SUBSUBSECTION
performing a relocation.
CODE_FRAGMENT
-.
.enum complain_overflow
.{
. {* Do not complain on overflow. *}
@@ -270,7 +269,7 @@ CODE_FRAGMENT
. unsigned number. *}
. complain_overflow_unsigned
.};
-
+.
*/
/*
@@ -402,11 +401,10 @@ DESCRIPTION
*/
/*
-TYPEDEF
+DEFINITION
arelent_chain
DESCRIPTION
-
How relocs are tied together in an <<asection>>:
.typedef struct relent_chain
@@ -1372,8 +1370,8 @@ SUBSECTION
*/
/*
-TYPEDEF
- bfd_reloc_code_type
+DEFINITION
+ bfd_reloc_code_real_type
DESCRIPTION
The insides of a reloc code. The idea is that, eventually, there
@@ -8134,9 +8132,10 @@ ENUMDOC
ENDSENUM
BFD_RELOC_UNUSED
+
CODE_FRAGMENT
-.
.typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
+.
*/
/*
@@ -8154,7 +8153,6 @@ DESCRIPTION
Return a pointer to a howto structure which, when
invoked, will perform the relocation @var{code} on data from the
architecture noted.
-
*/
reloc_howto_type *
@@ -8182,7 +8180,6 @@ SYNOPSIS
DESCRIPTION
Provides a default relocation lookup routine for any architecture.
-
*/
reloc_howto_type *
@@ -8329,7 +8326,6 @@ SYNOPSIS
DESCRIPTION
Provides default handling of relocation effort for back ends
which can't be bothered to do it efficiently.
-
*/
bfd_byte *
diff --git a/bfd/section.c b/bfd/section.c
index 1e7e8ac..7377029 100644
--- a/bfd/section.c
+++ b/bfd/section.c
@@ -137,14 +137,27 @@ SUBSECTION
/*
DOCDD
INODE
-typedef asection, section prototypes, Section Output, Sections
+ typedef asection, section prototypes, Section Output, Sections
SUBSECTION
typedef asection
Here is the section structure:
-CODE_FRAGMENT
+EXTERNAL
+.{* Linenumber stuff. *}
+.typedef struct lineno_cache_entry
+.{
+. unsigned int line_number; {* Linenumber from start of function. *}
+. union
+. {
+. struct bfd_symbol *sym; {* Function name. *}
+. bfd_vma offset; {* Offset into section. *}
+. } u;
+.}
+.alent;
.
+
+CODE_FRAGMENT
.typedef struct bfd_section
.{
. {* The name of the section; the name isn't a copy, the pointer is
@@ -493,7 +506,7 @@ CODE_FRAGMENT
.
. {* If the SEC_IN_MEMORY flag is set, this points to the actual
. contents. *}
-. unsigned char *contents;
+. bfd_byte *contents;
.
. {* Attached line number information. *}
. alent *lineno;
@@ -549,6 +562,8 @@ CODE_FRAGMENT
.
.} asection;
.
+
+EXTERNAL
.static inline const char *
.bfd_section_name (const asection *sec)
.{
diff --git a/bfd/stab-syms.c b/bfd/stab-syms.c
index 3b2e42d..eeb8c61 100644
--- a/bfd/stab-syms.c
+++ b/bfd/stab-syms.c
@@ -44,6 +44,17 @@
__define_name (N_INDR, "INDR") \
__define_name (N_WARNING, "WARNING")
+/*
+FUNCTION
+ bfd_get_stab_name
+
+SYNOPSIS
+ const char *bfd_get_stab_name (int);
+
+DESCRIPTION
+ Get the name of a stabs type code.
+*/
+
const char *
bfd_get_stab_name (int code)
{
diff --git a/bfd/stabs.c b/bfd/stabs.c
index 1cce2ae..455bf8b 100644
--- a/bfd/stabs.c
+++ b/bfd/stabs.c
@@ -112,7 +112,23 @@ struct stab_section_info
bfd_size_type stridxs[1];
};
-
+/*
+EXTERNAL
+.{* This structure is used to keep track of stabs in sections
+. information while linking. *}
+.
+.struct stab_info
+.{
+. {* A hash table used to hold stabs strings. *}
+. struct bfd_strtab_hash *strings;
+. {* The header file hash table. *}
+. struct bfd_hash_table includes;
+. {* The first .stabstr section. *}
+. struct bfd_section *stabstr;
+.};
+.
+*/
+
/* The function to create a new entry in the header file hash table. */
static struct bfd_hash_entry *
@@ -140,9 +156,20 @@ stab_link_includes_newfunc (struct bfd_hash_entry *entry,
return (struct bfd_hash_entry *) ret;
}
-
-/* This function is called for each input file from the add_symbols
- pass of the linker. */
+
+/*
+INTERNAL_FUNCTION
+ _bfd_link_section_stabs
+
+SYNOPSIS
+ bool _bfd_link_section_stabs
+ (bfd *, struct stab_info *, asection *, asection *, void **,
+ bfd_size_type *);
+
+DESCRIPTION
+ This function is called for each input file from the add_symbols
+ pass of the linker.
+*/
bool
_bfd_link_section_stabs (bfd *abfd,
@@ -500,11 +527,20 @@ _bfd_link_section_stabs (bfd *abfd,
free (stabstrbuf);
return false;
}
-
-/* This function is called for each input file before the stab
- section is relocated. It discards stab entries for discarded
- functions and variables. The function returns TRUE iff
- any entries have been deleted.
+
+/*
+INTERNAL_FUNCTION
+ _bfd_discard_section_stabs
+
+SYNOPSIS
+ bool _bfd_discard_section_stabs
+ (bfd *, asection *, void *, bool (*) (bfd_vma, void *), void *);
+
+DESCRIPTION
+ This function is called for each input file before the stab
+ section is relocated. It discards stab entries for discarded
+ functions and variables. The function returns TRUE iff
+ any entries have been deleted.
*/
bool
@@ -652,8 +688,18 @@ _bfd_discard_section_stabs (bfd *abfd,
return false;
}
-/* Write out the stab section. This is called with the relocated
- contents. */
+/*
+INTERNAL_FUNCTION
+ _bfd_write_section_stabs
+
+SYNOPSIS
+ bool _bfd_write_section_stabs
+ (bfd *, struct stab_info *, asection *, void **, bfd_byte *);
+
+DESCRIPTION
+ Write out the stab section. This is called with the relocated
+ contents.
+*/
bool
_bfd_write_section_stabs (bfd *output_bfd,
@@ -724,7 +770,16 @@ _bfd_write_section_stabs (bfd *output_bfd,
stabsec->size);
}
-/* Write out the .stabstr section. */
+/*
+INTERNAL_FUNCTION
+ _bfd_write_stab_strings
+
+SYNOPSIS
+ bool _bfd_write_stab_strings (bfd *, struct stab_info *);
+
+DESCRIPTION
+ Write out the .stabstr section.
+*/
bool
_bfd_write_stab_strings (bfd *output_bfd, struct stab_info *sinfo)
@@ -753,9 +808,18 @@ _bfd_write_stab_strings (bfd *output_bfd, struct stab_info *sinfo)
return true;
}
-/* Adjust an address in the .stab section. Given OFFSET within
- STABSEC, this returns the new offset in the adjusted stab section,
- or -1 if the address refers to a stab which has been removed. */
+/*
+INTERNAL_FUNCTION
+ _bfd_stab_section_offset
+
+SYNOPSIS
+ bfd_vma _bfd_stab_section_offset (asection *, void *, bfd_vma);
+
+DESCRIPTION
+ Adjust an address in the .stab section. Given OFFSET within
+ STABSEC, this returns the new offset in the adjusted stab section,
+ or -1 if the address refers to a stab which has been removed.
+*/
bfd_vma
_bfd_stab_section_offset (asection *stabsec,
diff --git a/bfd/syms.c b/bfd/syms.c
index c460e37..57ac52f 100644
--- a/bfd/syms.c
+++ b/bfd/syms.c
@@ -168,19 +168,12 @@ DOCDD
INODE
typedef asymbol, symbol handling functions, Mini Symbols, Symbols
-*/
-/*
SUBSECTION
typedef asymbol
An <<asymbol>> has the form:
-*/
-
-/*
CODE_FRAGMENT
-
-.
.typedef struct bfd_symbol
.{
. {* A pointer to the BFD which owns the symbol. This information
@@ -327,6 +320,28 @@ CODE_FRAGMENT
.}
.asymbol;
.
+
+EXTERNAL
+.typedef enum bfd_print_symbol
+.{
+. bfd_print_symbol_name,
+. bfd_print_symbol_more,
+. bfd_print_symbol_all
+.} bfd_print_symbol_type;
+.
+.{* Information about a symbol that nm needs. *}
+.
+.typedef struct _symbol_info
+.{
+. symvalue value;
+. char type;
+. const char *name; {* Symbol name. *}
+. unsigned char stab_type; {* Stab type. *}
+. char stab_other; {* Stab other. *}
+. short stab_desc; {* Stab desc. *}
+. const char *stab_name; {* String for stab type. *}
+.} symbol_info;
+.
*/
#include "sysdep.h"
diff --git a/bfd/targets.c b/bfd/targets.c
index 44fb5a3..021c808 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -148,6 +148,7 @@ DESCRIPTION
the entry points which call them. Too bad we can't have one
macro to define them both!
+EXTERNAL
.enum bfd_flavour
.{
. {* N.B. Update bfd_flavour_name if you change this. *}
@@ -173,14 +174,12 @@ DESCRIPTION
.
.enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
.
-.{* Forward declaration. *}
-.typedef struct bfd_link_info _bfd_link_info;
-.
-.{* Forward declaration. *}
-.typedef struct flag_info flag_info;
-.
+.{* Forward declarations. *}
+.struct flag_info;
.typedef void (*bfd_cleanup) (bfd *);
.
+
+CODE_FRAGMENT
.typedef struct bfd_target
.{
. {* Identifies the kind of target, e.g., SunOS4, Ultrix, etc. *}
@@ -258,9 +257,10 @@ DESCRIPTION
. {* Write cached information into a file being written, at <<bfd_close>>. *}
. bool (*_bfd_write_contents[bfd_type_end]) (bfd *);
.
+
The general target vector. These vectors are initialized using the
BFD_JUMP_TABLE macros.
-.
+
. {* Generic entry points. *}
.#define BFD_JUMP_TABLE_GENERIC(NAME) \
. NAME##_close_and_cleanup, \
@@ -1471,7 +1471,7 @@ static const struct targmatch bfd_target_match[] = {
};
/*
-CODE_FRAGMENT
+INTERNAL
.{* Cached _bfd_check_format messages are put in this. *}
.struct per_xvec_message
.{
diff --git a/gas/obj.h b/gas/obj.h
index e103692..6d92c36 100644
--- a/gas/obj.h
+++ b/gas/obj.h
@@ -37,6 +37,8 @@ void obj_symbol_to_chars (char **where, symbolS * symbolP);
extern const pseudo_typeS obj_pseudo_table[];
+struct ecoff_extr;
+
struct format_ops {
int flavor;
unsigned dfl_leading_underscore : 1;