/* Main header file for the bfd library -- portable access to object files.
- Copyright 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
Contributed by Cygnus Support.
** NOTE: bfd.h and bfd-in2.h are GENERATED files. Don't change them;
/* typedef enum boolean {false, true} boolean; */
/* Yup, SVR4 has a "typedef enum boolean" in <sys/types.h> -fnf */
/* It gets worse if the host also defines a true/false enum... -sts */
+/* And even worse if your compiler has built-in boolean types... -law */
+#if defined (__GNUG__) && (__GNUC_MINOR__ > 5)
+#define TRUE_FALSE_ALREADY_DEFINED
+#endif
#ifndef TRUE_FALSE_ALREADY_DEFINED
typedef enum bfd_boolean {false, true} boolean;
#define BFD_TRUE_FALSE
#else
-typedef enum bfd_boolean {bfd_false, bfd_true} boolean;
+/* Use enum names that will appear nowhere else. */
+typedef enum bfd_boolean {bfd_fffalse, bfd_tttrue} boolean;
#endif
/* A pointer to a position in a file. */
/* typedef off_t file_ptr; */
typedef long int file_ptr;
-/* Support for different sizes of target format ints and addresses. If the
- host implements 64-bit values, it defines BFD_HOST_64_BIT to be the appropriate
- type. Otherwise, this code will fall back on gcc's "long long" type if gcc
- is being used. BFD_HOST_64_BIT must be defined in such a way as to be a valid
- type name by itself or with "unsigned" prefixed. It should be a signed
- type by itself.
+/* Support for different sizes of target format ints and addresses.
+ If the host implements 64-bit values, it defines BFD_HOST_64_BIT to
+ be the appropriate type. Otherwise, this code will fall back on
+ gcc's "long long" type if gcc is being used. BFD_HOST_64_BIT must
+ be defined in such a way as to be a valid type name by itself or
+ with "unsigned" prefixed. It should be a signed type by itself.
- If neither is the case, then compilation will fail if 64-bit targets are
- requested. If you don't request any 64-bit targets, you should be safe. */
+ If neither is the case, then compilation will fail if 64-bit
+ targets are requested. If you don't request any 64-bit targets,
+ you should be safe. */
#ifdef BFD64
#define printf_vma(x) fprintf_vma(stdout,x)
typedef unsigned int flagword; /* 32 bits of flags */
+typedef unsigned char bfd_byte;
\f
/** File formats */
#define D_PAGED 0x100
/* BFD is relaxable (this means that bfd_relax_section may be able to
- do something). */
+ 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
\f
/* symbols and relocation */
/* A count of carsyms (canonical archive symbols). */
typedef unsigned long symindex;
+/* How to perform a relocation. */
+typedef const struct reloc_howto_struct reloc_howto_type;
+
#define BFD_NO_MORE_SYMBOLS ((symindex) ~0)
/* General purpose part of a symbol X;
file_ptr pos; /* bfd* or file position */
int namidx; /* index into string table */
};
-
\f
/* Linenumber stuff */
\f
/* object and core file sections */
-
#define align_power(addr, align) \
( ((addr) + ((1<<(align))-1)) & (-1 << (align)))
#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
-#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma= (val)), ((ptr)->user_set_vma = true), true)
+#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma= (val)), ((ptr)->user_set_vma = (boolean)true), true)
#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true)
#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),true)
\f
/* 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_read
+ PARAMS ((PTR, bfd_size_type size, bfd_size_type nitems, bfd *abfd));
+extern bfd_size_type bfd_write
+ PARAMS ((const PTR, bfd_size_type size, bfd_size_type nitems, bfd *abfd));
+extern int bfd_seek PARAMS ((bfd *abfd, file_ptr fp, int direction));
+extern long bfd_tell PARAMS ((bfd *abfd));
+extern int bfd_flush PARAMS ((bfd *abfd));
+extern int bfd_stat PARAMS ((bfd *abfd, struct stat *));
+
+/* PE STUFF */
+/* Also define some types which are used within bfdlink.h for the
+ bfd_link_info struct. These are not defined in bfdlink.h for a reason.
+ When the link_info data is passed to bfd from ld, it is copied into
+ extern variables defined in internal.h. The type class for these must
+ be available to any thing that includes internal.h. When internal.h is
+ included, it is always preceeded by an include on this file. If I leave the
+ type definitions in bfdlink.h, then I must include that file when ever
+ I include internal.h, and this is not always a good thing */
+
+/* These are the different types of subsystems to be used when linking for
+ Windows NT. This information is passed in as an input parameter (default
+ is console) and ultimately ends up in the optional header data */
+enum bfd_link_subsystem
+{
+ native, /* image doesn't require a subsystem */
+ windows, /* image runs in the Windows GUI subsystem */
+ console, /* image runs in the Windows CUI (character) subsystem */
+ os2, /* image runs in the OS/2 character subsystem */
+ posix /* image runs in the posix character subsystem */
+};
+/* The NT optional header file allows input of the stack and heap reserve
+ and commit size. This data may be input on the command line and will
+ end up in the optional header. Default sizes are provided. */
+struct _bfd_link_stack_heap
+{
+ boolean stack_defined;
+ boolean heap_defined;
+ bfd_vma stack_reserve;
+ bfd_vma stack_commit;
+ bfd_vma heap_reserve;
+ bfd_vma heap_commit;
+};
+typedef struct _bfd_link_stack_heap bfd_link_stack_heap;
+
+/* END OF PE STUFF */
+
/* Cast from const char * to char * so that caller can assign to
a char * without a warning. */
#define bfd_get_filename(abfd) ((char *) (abfd)->filename)
#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
-#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (bool)), true)
+#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = (boolean)(bool)), true)
/* Byte swapping routines. */
PARAMS ((PTR handle, bfd *abfd, struct ecoff_debug_info *debug,
const struct ecoff_debug_swap *swap,
struct bfd_link_info *info, file_ptr where));
+extern boolean bfd_mips_ecoff_create_embedded_relocs
+ PARAMS ((bfd *, struct bfd_link_info *, struct sec *, struct sec *,
+ char **));
+
+/* Externally visible ELF routines. */
+
+extern boolean bfd_elf32_record_link_assignment
+ PARAMS ((bfd *, struct bfd_link_info *, const char *));
+extern boolean bfd_elf64_record_link_assignment
+ PARAMS ((bfd *, struct bfd_link_info *, const char *));
+extern boolean bfd_elf32_size_dynamic_sections
+ PARAMS ((bfd *, const char *, const char *, boolean,
+ struct bfd_link_info *, struct sec **));
+extern boolean bfd_elf64_size_dynamic_sections
+ PARAMS ((bfd *, const char *, const char *, boolean,
+ struct bfd_link_info *, struct sec **));
+extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *));
+
+/* SunOS shared library support routines for the linker. */
+
+extern boolean bfd_sunos_record_link_assignment
+ PARAMS ((bfd *, struct bfd_link_info *, const char *));
+extern boolean bfd_sunos_size_dynamic_sections
+ PARAMS ((bfd *, struct bfd_link_info *, struct sec **, struct sec **,
+ struct sec **));
+
+/* Linux shared library support routines for the linker. */
+
+extern boolean bfd_linux_size_dynamic_sections
+ PARAMS ((bfd *, struct bfd_link_info *));
/* And more from the source. */
+
+/* provide storage for subsystem, stack and heap data which may have been
+ passed in on the command line. Ld puts this data into a bfd_link_info
+ struct which ultimately gets passed in to the bfd. When it arrives, copy
+ it to the following struct so that the data will be available in coffcode.h
+ where it is needed. The typedef's used are defined in bfd.h */
+enum bfd_link_subsystem NT_subsystem;
+bfd_link_stack_heap NT_stack_heap;
void
bfd_init PARAMS ((void));
bfd *
bfd_fdopenr PARAMS ((CONST char *filename, CONST char *target, int fd));
+bfd *
+bfd_openstreamr PARAMS (());
+
bfd *
bfd_openw PARAMS ((CONST char *filename, CONST char *target));
multiple times, the value of a symbol is the amount of
space it requires, and the largest symbol value is the one
used). Most targets have exactly one of these (which we
- translate to bfd_com_section), but ECOFF has two. */
+ translate to bfd_com_section_ptr), but ECOFF has two. */
#define SEC_IS_COMMON 0x8000
/* The section contains only debugging information. For
struct bfd_link_order *link_order_tail;
} asection ;
-
/* These sections are global, and are managed by BFD. The application
and target back end are not permitted to change the values in
- these sections. */
+ these sections. New code should use the section_ptr macros rather
+ than referring directly to the const sections. The const sections
+ may eventually vanish. */
#define BFD_ABS_SECTION_NAME "*ABS*"
#define BFD_UND_SECTION_NAME "*UND*"
#define BFD_COM_SECTION_NAME "*COM*"
#define BFD_IND_SECTION_NAME "*IND*"
/* the absolute section */
-extern asection bfd_abs_section;
+extern const asection bfd_abs_section;
+#define bfd_abs_section_ptr ((asection *) &bfd_abs_section)
+#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
/* Pointer to the undefined section */
-extern asection bfd_und_section;
+extern const asection bfd_und_section;
+#define bfd_und_section_ptr ((asection *) &bfd_und_section)
+#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
/* Pointer to the common section */
-extern asection bfd_com_section;
+extern const asection bfd_com_section;
+#define bfd_com_section_ptr ((asection *) &bfd_com_section)
/* Pointer to the indirect section */
-extern asection bfd_ind_section;
-
-extern struct symbol_cache_entry *bfd_abs_symbol;
-extern struct symbol_cache_entry *bfd_com_symbol;
-extern struct symbol_cache_entry *bfd_und_symbol;
-extern struct symbol_cache_entry *bfd_ind_symbol;
+extern const asection bfd_ind_section;
+#define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
+#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
+
+extern const struct symbol_cache_entry * const bfd_abs_symbol;
+extern const struct symbol_cache_entry * const bfd_com_symbol;
+extern const struct symbol_cache_entry * const bfd_und_symbol;
+extern const struct symbol_cache_entry * const bfd_ind_symbol;
#define bfd_get_section_size_before_reloc(section) \
(section->reloc_done ? (abort(),1): (section)->_raw_size)
#define bfd_get_section_size_after_reloc(section) \
#define bfd_mach_i960_mc 4
#define bfd_mach_i960_xa 5
#define bfd_mach_i960_ca 6
+ /* start-sanitize-i960xl */
+#define bfd_mach_i960_xl 7
+ /* end-sanitize-i960xl */
bfd_arch_a29k, /* AMD 29000 */
bfd_arch_sparc, /* SPARC */
bfd_arch_h8500, /* Hitachi H8/500 */
bfd_arch_sh, /* Hitachi SH */
bfd_arch_alpha, /* Dec Alpha */
+ bfd_arch_arm, /* Advanced Risc Machines ARM */
+ bfd_arch_ns32k, /* National Semiconductors ns32000 */
+ bfd_arch_w65, /* WDC 65816 */
+ /* start-sanitize-rce */
+ bfd_arch_rce, /* Motorola RCE */
+ /* end-sanitize-rce */
+ /* start-sanitize-arc */
+ bfd_arch_arc, /* Argonaut RISC Core */
+#define bfd_mach_arc_base 0
+#define bfd_mach_arc_host 1
+#define bfd_mach_arc_graphics 2
+#define bfd_mach_arc_audio 3
+ /* end-sanitize-arc */
bfd_arch_last
};
bfd_vma addend;
/* Pointer to how to perform the required relocation */
- const struct reloc_howto_struct *howto;
+ reloc_howto_type *howto;
} arelent;
enum complain_overflow
complain_overflow_unsigned
};
-typedef struct reloc_howto_struct
+struct reloc_howto_struct
{
/* The type field has mainly a documetary use - the back end can
do what it wants with it, though normally the back end's
empty (e.g., m88k bcs); this flag signals the fact.*/
boolean pcrel_offset;
-} reloc_howto_type;
+};
#define HOWTO(C, R,S,B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
{(unsigned)C,R,S,B, P, BI, O,SF,NAME,INPLACE,MASKSRC,MASKDST,PC}
#define NEWHOWTO( FUNCTION, NAME,SIZE,REL,IN) HOWTO(0,0,SIZE,0,REL,0,complain_overflow_dont,FUNCTION, NAME,false,0,0,IN)
} \
}
int
-bfd_get_reloc_size PARAMS ((const reloc_howto_type *));
-
-typedef unsigned char bfd_byte;
+bfd_get_reloc_size PARAMS ((reloc_howto_type *));
typedef struct relent_chain {
arelent relent;
bfd *output_bfd,
char **error_message));
-typedef enum bfd_reloc_code_real
-{
- /* Basic absolute relocations */
+bfd_reloc_status_type
+
+bfd_install_relocation
+ PARAMS ((bfd *abfd,
+ arelent *reloc_entry,
+ PTR data, bfd_vma data_start,
+ asection *input_section,
+ char **error_message));
+
+enum bfd_reloc_code_real {
+ _dummy_first_bfd_reloc_code_real,
+
+
+/* Basic absolute relocations of N bits. */
BFD_RELOC_64,
BFD_RELOC_32,
BFD_RELOC_26,
BFD_RELOC_14,
BFD_RELOC_8,
- /* PC-relative relocations */
+/* PC-relative relocations. Sometimes these are relative to the address
+of the relocation itself; sometimes they are relative to the start of
+the section containing the relocation. It depends on the specific target.
+
+The 24-bit relocation is used in some Intel 960 configurations. */
BFD_RELOC_64_PCREL,
BFD_RELOC_32_PCREL,
- BFD_RELOC_24_PCREL, /* used by i960 */
+ BFD_RELOC_24_PCREL,
BFD_RELOC_16_PCREL,
+ BFD_RELOC_12_PCREL,
BFD_RELOC_8_PCREL,
- /* Linkage-table relative */
+/* For ELF. */
+ BFD_RELOC_32_GOT_PCREL,
+ BFD_RELOC_16_GOT_PCREL,
+ BFD_RELOC_8_GOT_PCREL,
+ BFD_RELOC_32_GOTOFF,
+ BFD_RELOC_16_GOTOFF,
+ BFD_RELOC_8_GOTOFF,
+ BFD_RELOC_32_PLT_PCREL,
+ BFD_RELOC_16_PLT_PCREL,
+ BFD_RELOC_8_PLT_PCREL,
+ BFD_RELOC_32_PLTOFF,
+ BFD_RELOC_16_PLTOFF,
+ BFD_RELOC_8_PLTOFF,
+
+/* Relocations used by 68K ELF. */
+ BFD_RELOC_68K_GLOB_DAT,
+ BFD_RELOC_68K_JMP_SLOT,
+ BFD_RELOC_68K_RELATIVE,
+
+/* Linkage-table relative. */
BFD_RELOC_32_BASEREL,
BFD_RELOC_16_BASEREL,
BFD_RELOC_8_BASEREL,
- /* The type of reloc used to build a contructor table - at the moment
- probably a 32 bit wide abs address, but the cpu can choose. */
- BFD_RELOC_CTOR,
-
- /* 8 bits wide, but used to form an address like 0xffnn */
+/* Absolute 8-bit relocation, but used to form an address like 0xFFnn. */
BFD_RELOC_8_FFnn,
- /* 32-bit pc-relative, shifted right 2 bits (i.e., 30-bit
- word displacement, e.g. for SPARC) */
+/* These PC-relative relocations are stored as word displacements --
+i.e., byte displacements shifted right two bits. The 30-bit word
+displacement (<<32_PCREL_S2>> -- 32 bits, shifted 2) is used on the
+SPARC. (SPARC tools generally refer to this as <<WDISP30>>.) The
+signed 16-bit displacement is used on the MIPS, and the 23-bit
+displacement is used on the Alpha. */
BFD_RELOC_32_PCREL_S2,
- /* signed 16-bit pc-relative, shifted right 2 bits (e.g. for MIPS) */
BFD_RELOC_16_PCREL_S2,
- /* this is used on the Alpha */
BFD_RELOC_23_PCREL_S2,
- /* High 22 bits of 32-bit value, placed into lower 22 bits of
- target word; simple reloc. */
+/* High 22 bits and low 10 bits of 32-bit value, placed into lower bits of
+the target word. These are used on the SPARC. */
BFD_RELOC_HI22,
- /* Low 10 bits. */
BFD_RELOC_LO10,
- /* For systems that allocate a Global Pointer register, these are
- displacements off that register. These relocation types are
- handled specially, because the value the register will have is
- decided relatively late. */
+/* For systems that allocate a Global Pointer register, these are
+displacements off that register. These relocation types are
+handled specially, because the value the register will have is
+decided relatively late. */
BFD_RELOC_GPREL16,
BFD_RELOC_GPREL32,
- /* Reloc types used for i960/b.out. */
+/* Reloc types used for i960/b.out. */
BFD_RELOC_I960_CALLJ,
- /* now for the sparc/elf codes */
- BFD_RELOC_NONE, /* actually used */
+/* SPARC ELF relocations. There is probably some overlap with other
+relocation types already defined. */
+ BFD_RELOC_NONE,
BFD_RELOC_SPARC_WDISP22,
BFD_RELOC_SPARC22,
BFD_RELOC_SPARC13,
BFD_RELOC_SPARC_RELATIVE,
BFD_RELOC_SPARC_UA32,
- /* these are a.out specific? */
+/* I think these are specific to SPARC a.out (e.g., Sun 4). */
BFD_RELOC_SPARC_BASE13,
BFD_RELOC_SPARC_BASE22,
- /* start-sanitize-v9 */
+/* Some relocations we're using for SPARC V9 -- subject to change. */
+#define BFD_RELOC_SPARC_64 BFD_RELOC_64
BFD_RELOC_SPARC_10,
BFD_RELOC_SPARC_11,
-#define BFD_RELOC_SPARC_64 BFD_RELOC_64
BFD_RELOC_SPARC_OLO10,
BFD_RELOC_SPARC_HH22,
BFD_RELOC_SPARC_HM10,
BFD_RELOC_SPARC_WDISP19,
BFD_RELOC_SPARC_GLOB_JMP,
BFD_RELOC_SPARC_LO7,
- /* end-sanitize-v9 */
-
- /* Alpha ECOFF relocations. Some of these treat the symbol or "addend"
- in some special way. */
- /* For GPDISP_HI16 ("gpdisp") relocations, the symbol is ignored when
- writing; when reading, it will be the absolute section symbol. The
- addend is the displacement in bytes of the "lda" instruction from
- the "ldah" instruction (which is at the address of this reloc). */
+
+/* Alpha ECOFF relocations. Some of these treat the symbol or "addend"
+in some special way.
+For GPDISP_HI16 ("gpdisp") relocations, the symbol is ignored when
+writing; when reading, it will be the absolute section symbol. The
+addend is the displacement in bytes of the "lda" instruction from
+the "ldah" instruction (which is at the address of this reloc). */
BFD_RELOC_ALPHA_GPDISP_HI16,
- /* For GPDISP_LO16 ("ignore") relocations, the symbol is handled as
- with GPDISP_HI16 relocs. The addend is ignored when writing the
- relocations out, and is filled in with the file's GP value on
- reading, for convenience. */
+
+/* For GPDISP_LO16 ("ignore") relocations, the symbol is handled as
+with GPDISP_HI16 relocs. The addend is ignored when writing the
+relocations out, and is filled in with the file's GP value on
+reading, for convenience. */
BFD_RELOC_ALPHA_GPDISP_LO16,
- /* The Alpha LITERAL/LITUSE relocs are produced by a symbol reference;
- the assembler turns it into a LDQ instruction to load the address of
- the symbol, and then fills in a register in the real instruction.
-
- The LITERAL reloc, at the LDQ instruction, refers to the .lita
- section symbol. The addend is ignored when writing, but is filled
- in with the file's GP value on reading, for convenience, as with the
- GPDISP_LO16 reloc.
-
- The LITUSE reloc, on the instruction using the loaded address, gives
- information to the linker that it might be able to use to optimize
- away some literal section references. The symbol is ignored (read
- as the absolute section symbol), and the "addend" indicates the type
- of instruction using the register:
- 1 - "memory" fmt insn
- 2 - byte-manipulation (byte offset reg)
- 3 - jsr (target of branch)
-
- The GNU linker currently doesn't do any of this optimizing. */
+/* The Alpha LITERAL/LITUSE relocs are produced by a symbol reference;
+the assembler turns it into a LDQ instruction to load the address of
+the symbol, and then fills in a register in the real instruction.
+
+The LITERAL reloc, at the LDQ instruction, refers to the .lita
+section symbol. The addend is ignored when writing, but is filled
+in with the file's GP value on reading, for convenience, as with the
+GPDISP_LO16 reloc.
+
+The LITUSE reloc, on the instruction using the loaded address, gives
+information to the linker that it might be able to use to optimize
+away some literal section references. The symbol is ignored (read
+as the absolute section symbol), and the "addend" indicates the type
+of instruction using the register:
+1 - "memory" fmt insn
+2 - byte-manipulation (byte offset reg)
+3 - jsr (target of branch)
+
+The GNU linker currently doesn't do any of this optimizing. */
BFD_RELOC_ALPHA_LITERAL,
BFD_RELOC_ALPHA_LITUSE,
- /* The HINT relocation indicates a value that should be filled into the
- "hint" field of a jmp/jsr/ret instruction, for possible branch-
- prediction logic which may be provided on some processors. */
+/* The HINT relocation indicates a value that should be filled into the
+"hint" field of a jmp/jsr/ret instruction, for possible branch-
+prediction logic which may be provided on some processors. */
BFD_RELOC_ALPHA_HINT,
- /* Bits 27..2 of the relocation address shifted right 2 bits;
- simple reloc otherwise. */
+/* Bits 27..2 of the relocation address shifted right 2 bits;
+simple reloc otherwise. */
BFD_RELOC_MIPS_JMP,
- /* High 16 bits of 32-bit value; simple reloc. */
+/* High 16 bits of 32-bit value; simple reloc. */
BFD_RELOC_HI16,
- /* High 16 bits of 32-bit value but the low 16 bits will be sign
- extended and added to form the final result. If the low 16
- bits form a negative number, we need to add one to the high value
- to compensate for the borrow when the low bits are added. */
+
+/* High 16 bits of 32-bit value but the low 16 bits will be sign
+extended and added to form the final result. If the low 16
+bits form a negative number, we need to add one to the high value
+to compensate for the borrow when the low bits are added. */
BFD_RELOC_HI16_S,
- /* Low 16 bits. */
+
+/* Low 16 bits. */
BFD_RELOC_LO16,
- /* Like BFD_RELOC_HI16_S, but PC relative. */
+
+/* Like BFD_RELOC_HI16_S, but PC relative. */
BFD_RELOC_PCREL_HI16_S,
- /* Like BFD_RELOC_LO16, but PC relative. */
+
+/* Like BFD_RELOC_LO16, but PC relative. */
BFD_RELOC_PCREL_LO16,
- /* relocation relative to the global pointer. */
+/* Relocation relative to the global pointer. */
#define BFD_RELOC_MIPS_GPREL BFD_RELOC_GPREL16
- /* Relocation against a MIPS literal section. */
+/* Relocation against a MIPS literal section. */
BFD_RELOC_MIPS_LITERAL,
- /* MIPS ELF relocations. */
+/* MIPS ELF relocations. */
BFD_RELOC_MIPS_GOT16,
BFD_RELOC_MIPS_CALL16,
#define BFD_RELOC_MIPS_GPREL32 BFD_RELOC_GPREL32
- /* i386/elf relocations */
+/* i386/elf relocations */
BFD_RELOC_386_GOT32,
BFD_RELOC_386_PLT32,
BFD_RELOC_386_COPY,
BFD_RELOC_386_GOTOFF,
BFD_RELOC_386_GOTPC,
- /* PowerPC/POWER (RS/6000) relocs. */
- /* 26 bit relative branch. Low two bits must be zero. High 24
- bits installed in bits 6 through 29 of instruction. */
+/* ns32k relocations */
+ BFD_RELOC_NS32K_IMM_8,
+ BFD_RELOC_NS32K_IMM_16,
+ BFD_RELOC_NS32K_IMM_32,
+ BFD_RELOC_NS32K_IMM_8_PCREL,
+ BFD_RELOC_NS32K_IMM_16_PCREL,
+ BFD_RELOC_NS32K_IMM_32_PCREL,
+ BFD_RELOC_NS32K_DISP_8,
+ BFD_RELOC_NS32K_DISP_16,
+ BFD_RELOC_NS32K_DISP_32,
+ BFD_RELOC_NS32K_DISP_8_PCREL,
+ BFD_RELOC_NS32K_DISP_16_PCREL,
+ BFD_RELOC_NS32K_DISP_32_PCREL,
+
+/* PowerPC/POWER (RS/6000) relocs.
+26 bit relative branch. Low two bits must be zero. High 24
+bits installed in bits 6 through 29 of instruction. */
BFD_RELOC_PPC_B26,
- /* 26 bit absolute branch, like BFD_RELOC_PPC_B26 but absolute. */
+
+/* 26 bit absolute branch, like BFD_RELOC_PPC_B26 but absolute. */
BFD_RELOC_PPC_BA26,
- /* 16 bit TOC relative reference. */
+
+/* 16 bit TOC relative reference. */
BFD_RELOC_PPC_TOC16,
- /* this must be the highest numeric value */
- BFD_RELOC_UNUSED
- } bfd_reloc_code_real_type;
-const struct reloc_howto_struct *
+/* The type of reloc used to build a contructor table - at the moment
+probably a 32 bit wide absolute relocation, but the target can choose.
+It generally does map to one of the other relocation types. */
+ BFD_RELOC_CTOR,
+
+/* ARM 26 bit pc-relative branch. The lowest two bits must be zero and are
+not stored in the instruction. */
+ BFD_RELOC_ARM_PCREL_BRANCH,
+
+/* These relocs are only used within the ARM assembler. They are not
+(at present) written to any object files. */
+ BFD_RELOC_ARM_IMMEDIATE,
+ BFD_RELOC_ARM_OFFSET_IMM,
+ BFD_RELOC_ARM_SHIFT_IMM,
+ BFD_RELOC_ARM_SWI,
+ BFD_RELOC_ARM_MULTI,
+ BFD_RELOC_ARM_CP_OFF_IMM,
+ BFD_RELOC_ARM_ADR_IMM,
+ BFD_RELOC_ARM_LDR_IMM,
+ BFD_RELOC_ARM_LITERAL,
+ BFD_RELOC_ARM_IN_POOL,
+/* start-sanitize-arc */
+
+/* Argonaut RISC Core (ARC) relocs.
+ARC 22 bit pc-relative branch. The lowest two bits must be zero and are
+not stored in the instruction. The high 20 bits are installed in bits 26
+through 7 of the instruction. */
+ BFD_RELOC_ARC_B22_PCREL,
+
+/* ARC 26 bit absolute branch. The lowest two bits must be zero and are not
+stored in the instruction. The high 24 bits are installed in bits 23
+through 0. */
+ BFD_RELOC_ARC_B26,
+/* end-sanitize-arc */
+
+ BFD_RELOC_UNUSED };
+typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
+reloc_howto_type *
bfd_reloc_type_lookup PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
+const char *
+bfd_get_reloc_code_name PARAMS ((bfd_reloc_code_real_type code));
+
typedef struct symbol_cache_entry
{
/* 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 */
+ sections for undefined and absolute symbols. */
struct sec *section;
- /* Back end special data. This is being phased out in favour
- of making this a union. */
- PTR udata;
+ /* Back end special data. */
+ union
+ {
+ PTR p;
+ bfd_vma i;
+ } udata;
} asymbol;
#define bfd_get_symtab_upper_bound(abfd) \
void
bfd_symbol_info PARAMS ((asymbol *symbol, symbol_info *ret));
+boolean
+bfd_copy_private_symbol_data PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym));
+
+#define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \
+ BFD_SEND (ibfd, _bfd_copy_private_symbol_data, \
+ (ibfd, isymbol, obfd, osymbol))
struct _bfd
{
/* The filename the application opened the BFD with. */
CONST char *filename;
/* A pointer to the target jump table. */
- struct bfd_target *xvec;
+ const struct bfd_target *xvec;
/* To avoid dragging too many header files into every file that
includes `<<bfd.h>>', IOSTREAM has been declared as a "char
struct lynx_core_struct *lynx_core_data;
struct osf_core_struct *osf_core_data;
struct cisco_core_struct *cisco_core_data;
+ struct versados_data_struct *versados_data;
PTR any;
} tdata;
bfd_error_no_debug_section,
bfd_error_bad_value,
bfd_error_file_truncated,
+ bfd_error_file_too_big,
bfd_error_invalid_error_code
} bfd_error_type;
void
bfd_perror PARAMS ((CONST char *message));
+typedef void (*bfd_error_handler_type) PARAMS ((const char *, ...));
+
+bfd_error_handler_type
+bfd_set_error_handler PARAMS ((bfd_error_handler_type));
+
+void
+bfd_set_error_program_name PARAMS ((const char *));
+
long
bfd_get_reloc_upper_bound PARAMS ((bfd *abfd, asection *sect));
#define bfd_copy_private_bfd_data(ibfd, obfd) \
BFD_SEND (ibfd, _bfd_copy_private_bfd_data, \
(ibfd, obfd))
+boolean
+bfd_merge_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd));
+
+#define bfd_merge_private_bfd_data(ibfd, obfd) \
+ BFD_SEND (ibfd, _bfd_merge_private_bfd_data, \
+ (ibfd, obfd))
+boolean
+bfd_set_private_flags PARAMS ((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, reloc) \
BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
#define bfd_stat_arch_elt(abfd, stat) \
BFD_SEND (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_get_relocated_section_contents(abfd, link_info, link_order, data, relocateable, symbols) \
- BFD_SEND (abfd, _bfd_get_relocated_section_contents, \
- (abfd, link_info, link_order, data, relocateable, symbols))
-
#define bfd_relax_section(abfd, section, link_info, again) \
BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
#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
+ PARAMS ((bfd *, struct bfd_link_info *,
+ struct bfd_link_order *, bfd_byte *,
+ boolean, asymbol **));
+
symindex
bfd_get_next_mapent PARAMS ((bfd *abfd, symindex previous, carsym **sym));
bfd_target_tekhex_flavour,
bfd_target_srec_flavour,
bfd_target_som_flavour,
- bfd_target_os9k_flavour};
+ bfd_target_os9k_flavour,
+ bfd_target_versados_flavour
+};
/* Forward declaration. */
typedef struct bfd_link_info _bfd_link_info;
bfd_vma (*bfd_h_getx16) PARAMS ((const bfd_byte *));
bfd_signed_vma (*bfd_h_getx_signed_16) PARAMS ((const bfd_byte *));
void (*bfd_h_putx16) PARAMS ((bfd_vma, bfd_byte *));
- struct bfd_target * (*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *));
+ const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *));
boolean (*_bfd_set_format[bfd_type_end]) PARAMS ((bfd *));
boolean (*_bfd_write_contents[bfd_type_end]) PARAMS ((bfd *));
/* Entry points to copy private data. */
#define BFD_JUMP_TABLE_COPY(NAME)\
CAT(NAME,_bfd_copy_private_bfd_data),\
-CAT(NAME,_bfd_copy_private_section_data)
+CAT(NAME,_bfd_merge_private_bfd_data),\
+CAT(NAME,_bfd_copy_private_section_data),\
+CAT(NAME,_bfd_copy_private_symbol_data),\
+CAT(NAME,_bfd_set_private_flags)
/* Called to copy BFD general private data from one object file
to another. */
boolean (*_bfd_copy_private_bfd_data) PARAMS ((bfd *, bfd *));
+ /* Called to merge BFD general private data from one object file
+ to a common output file when linking. */
+ boolean (*_bfd_merge_private_bfd_data) PARAMS ((bfd *, bfd *));
/* Called to copy BFD private section data from one object file
to another. */
boolean (*_bfd_copy_private_section_data) PARAMS ((bfd *, sec_ptr,
bfd *, sec_ptr));
+ /* Called to copy BFD private symbol data from one symbol
+ to another. */
+ boolean (*_bfd_copy_private_symbol_data) PARAMS ((bfd *, asymbol *,
+ bfd *, asymbol *));
+ /* Called to set private backend flags */
+ boolean (*_bfd_set_private_flags) PARAMS ((bfd *, flagword));
/* Core file entry points. */
#define BFD_JUMP_TABLE_CORE(NAME)\
#define BFD_JUMP_TABLE_ARCHIVE(NAME)\
CAT(NAME,_slurp_armap),\
CAT(NAME,_slurp_extended_name_table),\
+CAT(NAME,_construct_extended_name_table),\
CAT(NAME,_truncate_arname),\
CAT(NAME,_write_armap),\
CAT(NAME,_openr_next_archived_file),\
-CAT(NAME,_generic_stat_arch_elt)
+CAT(NAME,_generic_stat_arch_elt),\
+CAT(NAME,_update_armap_timestamp)
boolean (*_bfd_slurp_armap) PARAMS ((bfd *));
boolean (*_bfd_slurp_extended_name_table) PARAMS ((bfd *));
+ boolean (*_bfd_construct_extended_name_table)
+ PARAMS ((bfd *, char **, bfd_size_type *, const char **));
void (*_bfd_truncate_arname) PARAMS ((bfd *, CONST char *, char *));
boolean (*write_armap) PARAMS ((bfd *arch,
unsigned int elength,
struct orl *map,
unsigned int orl_count,
int stridx));
- bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev));
- int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
-
+ bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev));
+ int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
+ boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *));
+
/* Entry points used for symbols. */
#define BFD_JUMP_TABLE_SYMBOLS(NAME)\
CAT(NAME,_get_symtab_upper_bound),\
long (*_bfd_canonicalize_reloc) PARAMS ((bfd *, sec_ptr, arelent **,
struct symbol_cache_entry **));
/* See documentation on reloc types. */
- CONST struct reloc_howto_struct *
+ reloc_howto_type *
(*reloc_type_lookup) PARAMS ((bfd *abfd,
bfd_reloc_code_real_type code));
CAT(NAME,_bfd_relax_section),\
CAT(NAME,_bfd_link_hash_table_create),\
CAT(NAME,_bfd_link_add_symbols),\
-CAT(NAME,_bfd_final_link)
+CAT(NAME,_bfd_final_link),\
+CAT(NAME,_bfd_link_split_section)
int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean));
bfd_byte * (*_bfd_get_relocated_section_contents) PARAMS ((bfd *,
struct bfd_link_info *, struct bfd_link_order *,
section of the BFD. */
boolean (*_bfd_final_link) PARAMS ((bfd *, struct bfd_link_info *));
+ /* Should this section be split up into smaller pieces during linking. */
+ boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *));
+
/* Routines to handle dynamic symbols and relocs. */
#define BFD_JUMP_TABLE_DYNAMIC(NAME)\
CAT(NAME,_get_dynamic_symtab_upper_bound),\
PTR backend_data;
} bfd_target;
-bfd_target *
+const bfd_target *
bfd_find_target PARAMS ((CONST char *target_name, bfd *abfd));
-CONST char **
+const char **
bfd_target_list PARAMS ((void));
boolean