From 61e2488cd8497d158303a78563ad40f51f5c3f8e Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Tue, 8 Apr 2014 10:59:43 +0100 Subject: 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. --- ld/ldbuildid.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 ld/ldbuildid.h (limited to 'ld/ldbuildid.h') diff --git a/ld/ldbuildid.h b/ld/ldbuildid.h new file mode 100644 index 0000000..a91ac1a --- /dev/null +++ b/ld/ldbuildid.h @@ -0,0 +1,39 @@ +/* ldbuildid.h - + Copyright 2013, 2014 Free Software Foundation, Inc. + + This file is part of the GNU Binutils. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ + +#ifndef LDBUILDID_H +#define LDBUILDID_H + +extern bfd_boolean +validate_build_id_style (const char *); + +extern bfd_size_type +compute_build_id_size (const char *); + +typedef void (*sum_fn) (const void *, size_t, void *); + +typedef bfd_boolean (*checksum_fn) (bfd *, + void (*) (const void *, size_t, void *), + void *); + +extern bfd_boolean +generate_build_id (bfd *, const char *, checksum_fn, unsigned char *, int); + +#endif /* LDBUILDID_H */ -- cgit v1.1