PATCH COMMITTED: Add --build-id to gold

Ian Lance Taylor iant@google.com
Tue Mar 25 05:15:00 GMT 2008


I committed this patch to add support for the --build-id option to
gold.  It's easy for gold to do a simple checksum over the entire
output file, so that is what I implemented.  It would be harder to do
what GNU ld does: do a checksum over the file header, the program
headers, the section headers, and the section contents.  The
difference is in the padding bytes and in a few sections which BFD
handles specially (e.g., the symbol table).  Those sections will be
included in the gold checksum but not in the GNU ld checksum.  As far
as I know it doesn't matter.

Ian


2008-03-24  Ian Lance Taylor  <iant@google.com>

	* options.h (class General_options): Define build_id option.
	* layout.h (class Layout): Declare write_build_id, create_note,
	create_build_id.  Add build_id_note_ member.
	* layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
	"libiberty.h", "md5.h", "sha1.h".
	(Layout::Layout): Initialize eh_frame_data_,
	eh_frame_hdr_section_, and build_id_note_.
	(Layout::finalize): Call create_build_id.
	(Layout::create_note): New function, broken out of
	Layout::create_gold_note.
	(Layout::create_gold_note): Call create_note.
	(Layout::create_build_id): New function.
	(Layout::write_build_id): New function.
	(Close_task_runner::run): Call write_build_id.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-patch
Size: 11922 bytes
Desc: Add --build-id
URL: <https://sourceware.org/pipermail/binutils/attachments/20080325/5db1827e/attachment.bin>


More information about the Binutils mailing list