* 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.
This commit is contained in:
Ian Lance Taylor
2008-03-25 05:11:41 +00:00
parent baf4901374
commit 8ed814a99c
4 changed files with 230 additions and 20 deletions

View File

@ -294,6 +294,10 @@ class Layout
script_options() const
{ return this->script_options_; }
// Compute and write out the build ID if needed.
void
write_build_id(Output_file*) const;
// Rewrite output file in binary format.
void
write_binary(Output_file* in) const;
@ -370,6 +374,11 @@ class Layout
};
typedef std::vector<Group_signature> Group_signatures;
// Create a .note section, filling in the header.
Output_section*
create_note(const char* name, int note_type, size_t descsz,
bool allocate, size_t* trailing_padding);
// Create a .note section for gold.
void
create_gold_note();
@ -378,6 +387,10 @@ class Layout
void
create_executable_stack_info(const Target*);
// Create a build ID note if needed.
void
create_build_id();
// Find the first read-only PT_LOAD segment, creating one if
// necessary.
Output_segment*
@ -586,6 +599,8 @@ class Layout
Eh_frame* eh_frame_data_;
// The exception frame header output section if there is one.
Output_section* eh_frame_hdr_section_;
// The space for the build ID checksum if there is one.
Output_section_data* build_id_note_;
// A list of group sections and their signatures.
Group_signatures group_signatures_;
// The size of the output file.