diff options
author | Tristan Gingold <gingold@adacore.com> | 2013-12-02 14:30:32 +0100 |
---|---|---|
committer | Tristan Gingold <tristan.gingold@adacore.com> | 2014-03-13 09:33:07 +0100 |
commit | 167ad85bf06582759e8dfe021aac9da79b81340d (patch) | |
tree | ca992034e6e0a0475963e057eb3044a90d1a5f6a /include | |
parent | 5e3a2c38d793123e32547f165f18b362438ce603 (diff) | |
download | gdb-167ad85bf06582759e8dfe021aac9da79b81340d.zip gdb-167ad85bf06582759e8dfe021aac9da79b81340d.tar.gz gdb-167ad85bf06582759e8dfe021aac9da79b81340d.tar.bz2 |
Add pe/x86_64 bigobj file format.
bfd/
* peicode.h (pe_ILF_object_p): Adjust, as the version number
has been read.
(pe_bfd_object_p): Also read version number to detect ILF.
* pe-x86_64.c (COFF_WITH_PE_BIGOBJ): Define.
(x86_64pe_bigobj_vec): Define
* coffcode.h (bfd_coff_backend_data): Add _bfd_coff_max_nscns field.
(bfd_coff_max_nscns): New macro.
(coff_compute_section_file_positions): Use unsigned int for
target_index. Compare with bfd_coff_max_nscns.
(bfd_coff_std_swap_table, ticoff0_swap_table, ticoff1_swap_table):
Set a value for _bfd_coff_max_nscns.
(header_bigobj_classid): New constant.
(coff_bigobj_swap_filehdr_in, coff_bigobj_swap_filehdr_out)
(coff_bigobj_swap_sym_in, coff_bigobj_swap_sym_out)
(coff_bigobj_swap_aux_in, coff_bigobj_swap_aux_out): New
functions.
(bigobj_swap_table): New table.
* libcoff.h: Regenerate.
* coff-sh.c (bfd_coff_small_swap_table): Likewise.
* coff-alpha.c (alpha_ecoff_backend_data): Add value for
_bfd_coff_max_nscns.
* coff-mips.c (mips_ecoff_backend_data): Likewise.
* coff-rs6000.c (bfd_xcoff_backend_data)
(bfd_pmac_xcoff_backend_data): Likewise.
* coff64-rs6000.c (bfd_xcoff_backend_data)
(bfd_xcoff_aix5_backend_data): Likewise.
* targets.c (x86_64pe_bigobj_vec): Declare.
* configure.in (x86_64pe_bigobj_vec): New vector.
* configure: Regenerate.
* config.bfd: Add bigobj object format for Windows targets.
gas/
* config/tc-i386.c (use_big_obj): Declare.
(OPTION_MBIG_OBJ): Define.
(md_longopts): Add -mbig-obj option.
(md_parse_option): Handle it.
(md_show_usage): Display help for this option.
(i386_target_format): Use bigobj for x86-64 if -mbig-obj.
* doc/c-i386.texi: Document the option.
gas/testsuite/
* gas/pe/big-obj.d, gas/pe/big-obj.s: Add test.
* gas/pe/pe.exp: Add test.
include/coff/
* pe.h (struct external_ANON_OBJECT_HEADER_BIGOBJ): Declare.
(FILHSZ_BIGOBJ): Define.
(struct external_SYMBOL_EX): Declare.
(SYMENT_BIGOBJ, SYMESZ_BIGOBJ): Define.
(union external_AUX_SYMBOL_EX): Declare.
(AUXENT_BIGOBJ, AUXESZ_BIGOBJ): Define.
* internal.h (struct internal_filehdr): Change type
of f_nscns.
Diffstat (limited to 'include')
-rw-r--r-- | include/coff/ChangeLog | 11 | ||||
-rw-r--r-- | include/coff/internal.h | 2 | ||||
-rw-r--r-- | include/coff/pe.h | 79 |
3 files changed, 91 insertions, 1 deletions
diff --git a/include/coff/ChangeLog b/include/coff/ChangeLog index 0d90f5a..2ee6361 100644 --- a/include/coff/ChangeLog +++ b/include/coff/ChangeLog @@ -1,3 +1,14 @@ +2014-03-13 Tristan Gingold <gingold@adacore.com> + + * pe.h (struct external_ANON_OBJECT_HEADER_BIGOBJ): Declare. + (FILHSZ_BIGOBJ): Define. + (struct external_SYMBOL_EX): Declare. + (SYMENT_BIGOBJ, SYMESZ_BIGOBJ): Define. + (union external_AUX_SYMBOL_EX): Declare. + (AUXENT_BIGOBJ, AUXESZ_BIGOBJ): Define. + * internal.h (struct internal_filehdr): Change type + of f_nscns. + 2014-03-05 Alan Modra <amodra@gmail.com> Update copyright years. diff --git a/include/coff/internal.h b/include/coff/internal.h index 4f99f2f..b34e5c6 100644 --- a/include/coff/internal.h +++ b/include/coff/internal.h @@ -73,7 +73,7 @@ struct internal_filehdr /* Standard coff internal info. */ unsigned short f_magic; /* magic number */ - unsigned short f_nscns; /* number of sections */ + unsigned int f_nscns; /* number of sections */ long f_timdat; /* time & date stamp */ bfd_vma f_symptr; /* file pointer to symtab */ long f_nsyms; /* number of symtab entries */ diff --git a/include/coff/pe.h b/include/coff/pe.h index 0093398b..3166531 100644 --- a/include/coff/pe.h +++ b/include/coff/pe.h @@ -358,6 +358,85 @@ typedef struct #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3 +/* Bigobj header. */ +struct external_ANON_OBJECT_HEADER_BIGOBJ +{ + /* ANON_OBJECT_HEADER_V2 header. */ + char Sig1[2]; + char Sig2[2]; + char Version[2]; + char Machine[2]; + char TimeDateStamp[4]; + char ClassID[16]; + char SizeOfData[4]; + char Flags[4]; + char MetaDataSize[4]; + char MetaDataOffset[4]; + + /* BIGOBJ specific. */ + char NumberOfSections[4]; + char PointerToSymbolTable[4]; + char NumberOfSymbols[4]; +}; + +#define FILHSZ_BIGOBJ (14 * 4) + +struct external_SYMBOL_EX +{ + union + { + char e_name[E_SYMNMLEN]; + + struct + { + char e_zeroes[4]; + char e_offset[4]; + } e; + } e; + + char e_value[4]; + char e_scnum[4]; + char e_type[2]; + char e_sclass[1]; + char e_numaux[1]; +} ATTRIBUTE_PACKED ; + +#define SYMENT_BIGOBJ struct external_SYMBOL_EX +#define SYMESZ_BIGOBJ 20 + +#define FILNMLEN_BIGOBJ 20 + +union external_AUX_SYMBOL_EX +{ + struct + { + char WeakDefaultSymIndex[4]; + char WeakSearchType[4]; + char rgbReserved[12]; + } Sym; + + struct + { + char Name[FILNMLEN_BIGOBJ]; + } File; + + struct + { + char Length[4]; /* section length */ + char NumberOfRelocations[2]; /* # relocation entries */ + char NumberOfLinenumbers[2]; /* # line numbers */ + char Checksum[4]; /* section COMDAT checksum */ + char Number[2]; /* COMDAT associated section index */ + char Selection[1]; /* COMDAT selection number */ + char bReserved[1]; + char HighNumber[2]; /* High bits of COMDAT associated sec. */ + char rgbReserved[2]; + } Section; +} ATTRIBUTE_PACKED; + +#define AUXENT_BIGOBJ union external_AUX_SYMBOL_EX +#define AUXESZ_BIGOBJ 20 + /* .pdata/.xdata defines and structures for x64 PE+ for exception handling. */ /* .pdata in exception directory. */ |