X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=bfd%2Fbfd-in.h;h=e9ada8d27fbd9f9562332c02035de1a39ebd6ce5;hb=af30dc128be191dc6179763203035ff62c634284;hp=bcb9fdc5f93b025d40d8e50c0f79d288a6a3a614;hpb=759388538d1339f6a634b2777e24f46427dd9c96;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index bcb9fdc5f9..e9ada8d27f 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -1,6 +1,6 @@ /* Main header file for the bfd library -- portable access to object files. - Copyright (C) 1990-2014 Free Software Foundation, Inc. + Copyright (C) 1990-2019 Free Software Foundation, Inc. Contributed by Cygnus Support. @@ -34,6 +34,9 @@ extern "C" { #include "ansidecl.h" #include "symcat.h" +#include "bfd_stdint.h" +#include "diagnostics.h" +#include #include #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) @@ -90,6 +93,24 @@ typedef BFD_HOST_64_BIT bfd_int64_t; typedef BFD_HOST_U_64_BIT bfd_uint64_t; #endif +#ifdef HAVE_INTTYPES_H +# include +#else +# if BFD_HOST_64BIT_LONG +# define BFD_PRI64 "l" +# elif defined (__MSVCRT__) +# define BFD_PRI64 "I64" +# else +# define BFD_PRI64 "ll" +# endif +# undef PRId64 +# define PRId64 BFD_PRI64 "d" +# undef PRIu64 +# define PRIu64 BFD_PRI64 "u" +# undef PRIx64 +# define PRIx64 BFD_PRI64 "x" +#endif + #if BFD_ARCH_SIZE >= 64 #define BFD64 #endif @@ -103,7 +124,7 @@ typedef BFD_HOST_U_64_BIT bfd_uint64_t; #endif /* Declaring a type wide enough to hold a host long and a host pointer. */ -#define BFD_HOSTPTR_T @BFD_HOSTPTR_T@ +#define BFD_HOSTPTR_T @BFD_HOSTPTR_T@ typedef BFD_HOSTPTR_T bfd_hostptr_t; /* Forward declaration. */ @@ -214,39 +235,20 @@ bfd_format; /* 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; - target specific parts are in libcoff.h, libaout.h, etc. */ - -#define bfd_get_section(x) ((x)->section) -#define bfd_get_output_section(x) ((x)->section->output_section) -#define bfd_set_section(x,y) ((x)->section) = (y) -#define bfd_asymbol_base(x) ((x)->section->vma) -#define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value) -#define bfd_asymbol_name(x) ((x)->name) -/*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/ -#define bfd_asymbol_bfd(x) ((x)->the_bfd) -#define bfd_asymbol_flavour(x) \ - (((x)->flags & BSF_SYNTHETIC) != 0 \ - ? bfd_target_unknown_flavour \ - : bfd_asymbol_bfd (x)->xvec->flavour) - /* A canonical archive symbol. */ /* This is a type pun with struct ranlib on purpose! */ typedef struct carsym { - char *name; + 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. */ +struct orl /* Output ranlib. */ { char **name; /* Symbol name. */ union @@ -256,7 +258,7 @@ struct orl /* Output ranlib. */ } u; /* bfd* or file position. */ int namidx; /* Index into string table. */ }; - + /* Linenumber stuff. */ typedef struct lineno_cache_entry { @@ -264,38 +266,43 @@ typedef struct lineno_cache_entry union { struct bfd_symbol *sym; /* Function name. */ - bfd_vma offset; /* Offset into section. */ + bfd_vma offset; /* Offset into section. */ } u; } alent; /* Object and core file sections. */ - -#define align_power(addr, align) \ - (((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align))) - typedef struct bfd_section *sec_ptr; -#define bfd_get_section_name(bfd, ptr) ((void) bfd, (ptr)->name) -#define bfd_get_section_vma(bfd, ptr) ((void) bfd, (ptr)->vma) -#define bfd_get_section_lma(bfd, ptr) ((void) bfd, (ptr)->lma) -#define bfd_get_section_alignment(bfd, ptr) ((void) bfd, \ - (ptr)->alignment_power) -#define bfd_section_name(bfd, ptr) ((ptr)->name) -#define bfd_section_size(bfd, ptr) ((ptr)->size) -#define bfd_get_section_size(ptr) ((ptr)->size) -#define bfd_section_vma(bfd, ptr) ((ptr)->vma) -#define bfd_section_lma(bfd, ptr) ((ptr)->lma) -#define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power) -#define bfd_get_section_flags(bfd, ptr) ((void) bfd, (ptr)->flags) -#define bfd_get_section_userdata(bfd, ptr) ((void) bfd, (ptr)->userdata) - -#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0) +#define align_power(addr, align) \ + (((addr) + ((bfd_vma) 1 << (align)) - 1) & (-((bfd_vma) 1 << (align)))) + +/* Align an address upward to a boundary, expressed as a number of bytes. + E.g. align to an 8-byte boundary with argument of 8. Take care never + to wrap around if the address is within boundary-1 of the end of the + address space. */ +#define BFD_ALIGN(this, boundary) \ + ((((bfd_vma) (this) + (boundary) - 1) >= (bfd_vma) (this)) \ + ? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \ + : ~ (bfd_vma) 0) + +#define bfd_section_name(sec) ((sec)->name) +#define bfd_section_size(sec) ((sec)->size) +#define bfd_section_vma(sec) ((sec)->vma) +#define bfd_section_lma(sec) ((sec)->lma) +#define bfd_section_alignment(sec) ((sec)->alignment_power) +#define bfd_section_flags(sec) ((sec)->flags) +#define bfd_section_userdata(sec) ((sec)->userdata) + +#define bfd_is_com_section(sec) (((sec)->flags & SEC_IS_COMMON) != 0) + +#define bfd_get_section_limit_octets(bfd, sec) \ + ((bfd)->direction != write_direction && (sec)->rawsize != 0 \ + ? (sec)->rawsize : (sec)->size) /* Find the address one past the end of SEC. */ #define bfd_get_section_limit(bfd, sec) \ - (((bfd)->direction != write_direction && (sec)->rawsize != 0 \ - ? (sec)->rawsize : (sec)->size) / bfd_octets_per_byte (bfd)) + (bfd_get_section_limit_octets(bfd, sec) / bfd_octets_per_byte (bfd)) /* Return TRUE if input section SEC has been discarded. */ #define discarded_section(sec) \ @@ -317,11 +324,11 @@ 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. */ + 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. */ @@ -359,7 +366,7 @@ struct bfd_hash_table 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 *, + /* 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. */ @@ -434,6 +441,16 @@ extern void bfd_hash_traverse this size. */ extern unsigned long bfd_hash_set_default_size (unsigned long); +/* Types of compressed DWARF debug sections. We currently support + zlib. */ +enum compressed_debug_section_type +{ + COMPRESS_DEBUG_NONE = 0, + COMPRESS_DEBUG = 1 << 0, + COMPRESS_DEBUG_GNU_ZLIB = COMPRESS_DEBUG | 1 << 1, + COMPRESS_DEBUG_GABI_ZLIB = COMPRESS_DEBUG | 1 << 2 +}; + /* This structure is used to keep track of stabs in sections information while linking. */ @@ -464,55 +481,20 @@ extern int bfd_stat (bfd *, struct stat *); /* Deprecated old routines. */ #if __GNUC__ #define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \ - (warn_deprecated ("bfd_read", __FILE__, __LINE__, __FUNCTION__), \ + (_bfd_warn_deprecated ("bfd_read", __FILE__, __LINE__, __FUNCTION__), \ bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) #define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \ - (warn_deprecated ("bfd_write", __FILE__, __LINE__, __FUNCTION__), \ + (_bfd_warn_deprecated ("bfd_write", __FILE__, __LINE__, __FUNCTION__), \ bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) #else #define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \ - (warn_deprecated ("bfd_read", (const char *) 0, 0, (const char *) 0), \ + (_bfd_warn_deprecated ("bfd_read", (const char *) 0, 0, (const char *) 0), \ bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) #define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \ - (warn_deprecated ("bfd_write", (const char *) 0, 0, (const char *) 0),\ + (_bfd_warn_deprecated ("bfd_write", (const char *) 0, 0, (const char *) 0),\ bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) #endif -extern void warn_deprecated (const char *, const char *, int, const char *); - -/* 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_cacheable(abfd) ((abfd)->cacheable) -#define bfd_get_format(abfd) ((abfd)->format) -#define bfd_get_target(abfd) ((abfd)->xvec->name) -#define bfd_get_flavour(abfd) ((abfd)->xvec->flavour) -#define bfd_family_coff(abfd) \ - (bfd_get_flavour (abfd) == bfd_target_coff_flavour || \ - bfd_get_flavour (abfd) == bfd_target_xcoff_flavour) -#define bfd_big_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG) -#define bfd_little_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE) -#define bfd_header_big_endian(abfd) \ - ((abfd)->xvec->header_byteorder == BFD_ENDIAN_BIG) -#define bfd_header_little_endian(abfd) \ - ((abfd)->xvec->header_byteorder == BFD_ENDIAN_LITTLE) -#define bfd_get_file_flags(abfd) ((abfd)->flags) -#define bfd_applicable_file_flags(abfd) ((abfd)->xvec->object_flags) -#define bfd_applicable_section_flags(abfd) ((abfd)->xvec->section_flags) -#define bfd_my_archive(abfd) ((abfd)->my_archive) -#define bfd_has_map(abfd) ((abfd)->has_armap) -#define bfd_is_thin_archive(abfd) ((abfd)->is_thin_archive) - -#define bfd_valid_reloc_types(abfd) ((abfd)->xvec->valid_reloc_types) -#define bfd_usrdata(abfd) ((abfd)->usrdata) - -#define bfd_get_start_address(abfd) ((abfd)->start_address) -#define bfd_get_symcount(abfd) ((abfd)->symcount) -#define bfd_get_outsymbols(abfd) ((abfd)->outsymbols) -#define bfd_count_sections(abfd) ((abfd)->section_count) - -#define bfd_get_dynamic_symcount(abfd) ((abfd)->dynsymcount) - -#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char) +extern void _bfd_warn_deprecated (const char *, const char *, int, const char *); extern bfd_boolean bfd_cache_close (bfd *abfd); @@ -542,6 +524,8 @@ void bfd_putb64 (bfd_uint64_t, void *); void bfd_putl64 (bfd_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 *); @@ -569,8 +553,6 @@ extern bfd_boolean _bfd_handle_already_linked /* Externally visible ECOFF routines. */ -extern bfd_vma bfd_ecoff_get_gp_value - (bfd * abfd); extern bfd_boolean bfd_ecoff_set_gp_value (bfd *abfd, bfd_vma gp_value); extern bfd_boolean bfd_ecoff_set_regmasks @@ -739,8 +721,6 @@ extern bfd_boolean bfd_sunos_size_dynamic_sections extern bfd_boolean bfd_i386linux_size_dynamic_sections (bfd *, struct bfd_link_info *); -extern bfd_boolean bfd_m68klinux_size_dynamic_sections - (bfd *, struct bfd_link_info *); extern bfd_boolean bfd_sparclinux_size_dynamic_sections (bfd *, struct bfd_link_info *); @@ -806,18 +786,9 @@ struct internal_syment; union internal_auxent; #endif -extern bfd_boolean bfd_coff_get_syment - (bfd *, struct bfd_symbol *, struct internal_syment *); - -extern bfd_boolean bfd_coff_get_auxent - (bfd *, struct bfd_symbol *, int, union internal_auxent *); - extern bfd_boolean bfd_coff_set_symbol_class (bfd *, struct bfd_symbol *, unsigned int); -extern bfd_boolean bfd_m68k_coff_create_embedded_relocs - (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); - /* ARM VFP11 erratum workaround support. */ typedef enum { @@ -842,6 +813,23 @@ extern bfd_boolean bfd_elf32_arm_vfp11_erratum_scan extern void bfd_elf32_arm_vfp11_fix_veneer_locations (bfd *, struct bfd_link_info *); +/* ARM STM STM32L4XX erratum workaround support. */ +typedef enum +{ + BFD_ARM_STM32L4XX_FIX_NONE, + BFD_ARM_STM32L4XX_FIX_DEFAULT, + BFD_ARM_STM32L4XX_FIX_ALL +} bfd_arm_stm32l4xx_fix; + +extern void bfd_elf32_arm_set_stm32l4xx_fix + (bfd *, struct bfd_link_info *); + +extern bfd_boolean bfd_elf32_arm_stm32l4xx_erratum_scan + (bfd *, struct bfd_link_info *); + +extern void bfd_elf32_arm_stm32l4xx_fix_veneer_locations + (bfd *, struct bfd_link_info *); + /* ARM Interworking support. Called from linker. */ extern bfd_boolean bfd_arm_allocate_interworking_sections (struct bfd_link_info *); @@ -869,9 +857,27 @@ extern bfd_boolean bfd_elf32_arm_allocate_interworking_sections extern bfd_boolean bfd_elf32_arm_process_before_allocation (bfd *, struct bfd_link_info *); -void bfd_elf32_arm_set_target_relocs - (bfd *, struct bfd_link_info *, int, char *, int, int, bfd_arm_vfp11_fix, - int, int, int, int, int); +struct elf32_arm_params { + char *thumb_entry_symbol; + int byteswap_code; + int target1_is_rel; + char * target2_type; + int fix_v4bx; + int use_blx; + bfd_arm_vfp11_fix vfp11_denorm_fix; + bfd_arm_stm32l4xx_fix stm32l4xx_fix; + int no_enum_size_warning; + int no_wchar_size_warning; + int pic_veneer; + int fix_cortex_a8; + int fix_arm1176; + int merge_exidx_entries; + int cmse_implib; + bfd *in_implib_bfd; +}; + +void bfd_elf32_arm_set_target_params + (bfd *, struct bfd_link_info *, struct elf32_arm_params *); extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking (bfd *, struct bfd_link_info *); @@ -879,10 +885,13 @@ extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd (bfd *, struct bfd_link_info *); +extern void bfd_elf32_arm_keep_private_stub_output_sections + (struct bfd_link_info *); + /* ELF ARM mapping symbol support. */ #define BFD_ARM_SPECIAL_SYM_TYPE_MAP (1 << 0) #define BFD_ARM_SPECIAL_SYM_TYPE_TAG (1 << 1) -#define BFD_ARM_SPECIAL_SYM_TYPE_OTHER (1 << 2) +#define BFD_ARM_SPECIAL_SYM_TYPE_OTHER (1 << 2) #define BFD_ARM_SPECIAL_SYM_TYPE_ANY (~0) extern bfd_boolean bfd_is_arm_special_symbol_name @@ -910,7 +919,8 @@ extern void elf32_arm_next_input_section (struct bfd_link_info *, struct bfd_section *); extern bfd_boolean elf32_arm_size_stubs (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma, - struct bfd_section * (*) (const char *, struct bfd_section *, unsigned int), + struct bfd_section * (*) (const char *, struct bfd_section *, + struct bfd_section *, unsigned int), void (*) (void)); extern bfd_boolean elf32_arm_build_stubs (struct bfd_link_info *); @@ -923,24 +933,60 @@ extern bfd_boolean elf32_arm_fix_exidx_coverage extern bfd_boolean elf32_tic6x_fix_exidx_coverage (struct bfd_section **, unsigned int, struct bfd_link_info *, bfd_boolean); -/* PowerPC @tls opcode transform/validate. */ -extern unsigned int _bfd_elf_ppc_at_tls_transform - (unsigned int, unsigned int); -/* PowerPC @tprel opcode transform/validate. */ -extern unsigned int _bfd_elf_ppc_at_tprel_transform - (unsigned int, unsigned int); - extern void bfd_elf64_aarch64_init_maps (bfd *); extern void bfd_elf32_aarch64_init_maps (bfd *); +/* Types of PLTs based on the level of security. This would be a + bit-mask to denote which of the combinations of security features + are enabled: + - No security feature PLTs + - PLTs with BTI instruction + - PLTs with PAC instruction +*/ +typedef enum +{ + PLT_NORMAL = 0x0, /* Normal plts. */ + PLT_BTI = 0x1, /* plts with bti. */ + PLT_PAC = 0x2, /* plts with pointer authentication. */ + PLT_BTI_PAC = PLT_BTI | PLT_PAC +} aarch64_plt_type; + +/* To indicate if BTI is enabled with/without warning. */ +typedef enum +{ + BTI_NONE = 0, /* BTI is not enabled. */ + BTI_WARN = 1, /* BTI is enabled with -z force-bti. */ +} aarch64_enable_bti_type; + +/* A structure to encompass all information coming from BTI or PAC + related command line options. This involves the "PLT_TYPE" to determine + which version of PLTs to pick and "BTI_TYPE" to determine if + BTI should be turned on with any warnings. */ +typedef struct +{ + aarch64_plt_type plt_type; + aarch64_enable_bti_type bti_type; +} aarch64_bti_pac_info; + +/* An enum to define what kind of erratum fixes we should apply. This gives the + user a bit more control over the sequences we generate. */ +typedef enum +{ + ERRAT_NONE = (1 << 0), /* No erratum workarounds allowed. */ + ERRAT_ADR = (1 << 1), /* Erratum workarounds using ADR allowed. */ + ERRAT_ADRP = (1 << 2), /* Erratum workarounds using ADRP are allowed. */ +} erratum_84319_opts; + extern void bfd_elf64_aarch64_set_options - (bfd *, struct bfd_link_info *, int, int, int); + (bfd *, struct bfd_link_info *, int, int, int, int, erratum_84319_opts, int, + aarch64_bti_pac_info); extern void bfd_elf32_aarch64_set_options - (bfd *, struct bfd_link_info *, int, int, int); + (bfd *, struct bfd_link_info *, int, int, int, int, erratum_84319_opts, int, + aarch64_bti_pac_info); /* ELF AArch64 mapping symbol support. */ #define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP (1 << 0) @@ -992,22 +1038,25 @@ extern void bfd_elf32_ia64_after_parse extern void bfd_elf64_ia64_after_parse (int); -/* This structure is used for a comdat section, as in PE. A comdat - section is associated with a particular symbol. When the linker - sees a comdat section, it keeps only one of the sections with a - given name and associated with a given symbol. */ +/* V850 Note manipulation routines. */ +extern bfd_boolean v850_elf_create_sections + (struct bfd_link_info *); -struct coff_comdat_info -{ - /* The name of the symbol associated with a comdat section. */ - const char *name; +extern bfd_boolean v850_elf_set_note + (bfd *, unsigned int, unsigned int); - /* The local symbol table index of the symbol associated with a - comdat section. This is only meaningful to the object file format - specific code; it is not an index into the list returned by - bfd_canonicalize_symtab. */ - long symbol; -}; +/* MIPS ABI flags data access. For the disassembler. */ +struct elf_internal_abiflags_v0; +extern struct elf_internal_abiflags_v0 *bfd_mips_elf_get_abiflags (bfd *); -extern struct coff_comdat_info * bfd_coff_get_comdat_section - (bfd *, struct bfd_section *); +/* C-SKY functions. */ +extern bfd_boolean elf32_csky_build_stubs + (struct bfd_link_info *); +extern bfd_boolean elf32_csky_size_stubs + (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma, + struct bfd_section *(*) (const char*, struct bfd_section*), + void (*) (void)); +extern void elf32_csky_next_input_section + (struct bfd_link_info *, struct bfd_section *); +extern int elf32_csky_setup_section_lists + (bfd *, struct bfd_link_info *);