diff options
author | Jon TURNEY <jon.turney@dronecode.org.uk> | 2014-04-08 10:59:43 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2014-04-08 10:59:43 +0100 |
commit | 61e2488cd8497d158303a78563ad40f51f5c3f8e (patch) | |
tree | 096a515807bb59268398b4dd879929e93f78fec3 /include/coff/pe.h | |
parent | ae1d276159c3cfb29caacdf567aea01f433f78b0 (diff) | |
download | gdb-61e2488cd8497d158303a78563ad40f51f5c3f8e.zip gdb-61e2488cd8497d158303a78563ad40f51f5c3f8e.tar.gz gdb-61e2488cd8497d158303a78563ad40f51f5c3f8e.tar.bz2 |
Add support for generating and inserting build IDs into COFF binaries.
* peXXigen.c (pe_print_debugdata): New function: Displays the
contents of the debug directory and decodes codeview entries.
(_bfd_XXi_swap_debugdir_in, _bfd_XXi_swap_debugdir_out)
(_bfd_XXi_slurp_codeview_record, _bfd_XXi_write_codeview_record):
Add functions for reading and writing debugdir and codeview
records.
* libpei.h (_bfd_XXi_swap_debugdir_in, _bfd_XXi_swap_debugdir_out)
(_bfd_XXi_write_codeview_record): Add prototypes and macros.
* libcoff-in.h (pe_tdata): Add build-id data.
* libcoff.h: Regenerate.
* coffcode.h (coff_write_object_contents): Run build_id
after_write_object_contents hook.
* pe.h (external_IMAGE_DEBUG_DIRECTORY, _CV_INFO_PDB70)
(_CV_INFO_PDB20): Add structures and constants for debug directory
and codeview records.
* internal.h (internal_IMAGE_DEBUG_DIRECTORY, CODEVIEW_INFO):
Add structures and constants for internal representation of debug
directory and codeview records.
* emultempl/elf32.em (id_note_section_size, read_hex, write_build_id):
Move code for parsing build-id option and calculating the build-id to...
* ldbuildid.c: New file.
* ldbuildid.h: New file.
* Makefile.am (CFILES, HFILES, OFILES, ld_new_SOURCES): Add new
files.
* Makefile.in: Regenerate.
* ld.texinfo: Update --build-id description to mention COFF
support.
* NEWS: Mention support for COFF build ids.
* emultempl/pe.em (gld${EMULATION_NAME}_handle_option):
(pecoff_checksum_contents, write_build_id, setup_build_id)
(gld_${EMULATION_NAME}_after_open): Handle and implement
build-id option.
* emultempl/pep.em: Likewise.
Diffstat (limited to 'include/coff/pe.h')
-rw-r--r-- | include/coff/pe.h | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/include/coff/pe.h b/include/coff/pe.h index 3166531..0ed9dde 100644 --- a/include/coff/pe.h +++ b/include/coff/pe.h @@ -1,4 +1,4 @@ -/* pe.h - PE COFF header information +/* pe.h - PE COFF header information Copyright (C) 1999-2014 Free Software Foundation, Inc. @@ -163,9 +163,9 @@ #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12 #define IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER 13 #define IMAGE_SUBSYSTEM_XBOX 14 - + /* Magic values that are true for all dos/nt implementations. */ -#define DOSMAGIC 0x5a4d +#define DOSMAGIC 0x5a4d #define NT_SIGNATURE 0x00004550 /* NT allows long filenames, we want to accommodate this. @@ -264,7 +264,7 @@ struct external_PEI_filehdr /* 32-bit PE a.out header: */ -typedef struct +typedef struct { AOUTHDR standard; @@ -300,7 +300,7 @@ typedef struct /* Like PEAOUTHDR, except that the "standard" member has no BaseOfData (aka data_start) member and that some of the members are 8 instead of just 4 bytes long. */ -typedef struct +typedef struct { #ifdef AOUTHDRSZ64 AOUTHDR64 standard; @@ -338,7 +338,7 @@ typedef struct #else #define PEPAOUTSZ 240 #endif - + #undef E_FILNMLEN #define E_FILNMLEN 18 /* # characters in a file name. */ @@ -584,4 +584,41 @@ struct external_pex64_scope_entry (PEX64_OFFSET_TO_SCOPE_COUNT(COUNTOFUNWINDCODES) + \ PEX64_SCOPE_ENTRY_SIZE * (IDX)) +/* Extra structure used in debug directory */ +struct external_IMAGE_DEBUG_DIRECTORY { + char Characteristics[4]; + char TimeDateStamp[4]; + char MajorVersion[2]; + char MinorVersion[2]; + char Type[4]; + char SizeOfData[4]; + char AddressOfRawData[4]; + char PointerToRawData[4]; +}; + +/* Extra structures used in codeview debug record */ +/* This is not part of the PE specification */ + +#define CVINFO_PDB70_CVSIGNATURE 0x53445352 // "RSDS" +#define CVINFO_PDB20_CVSIGNATURE 0x3031424e // "NB10" +#define CVINFO_CV50_CVSIGNATURE 0x3131424e // "NB11" +#define CVINFO_CV41_CVSIGNATURE 0x3930424e // âNB09" + +typedef struct _CV_INFO_PDB70 +{ + char CvSignature[4]; + char Signature[16]; + char Age[4]; + char PdbFileName[]; +} CV_INFO_PDB70; + +typedef struct _CV_INFO_PDB20 +{ + char CvHeader[4]; + char Offset[4]; + char Signature[4]; + char Age[4]; + char PdbFileName[]; +} CV_INFO_PDB20; + #endif /* _PE_H */ |