From 8ed814a99c1393f82d754fba230c6187eecc2e2e Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 25 Mar 2008 05:11:41 +0000 Subject: * 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 , , , "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. --- gold/layout.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'gold/layout.h') diff --git a/gold/layout.h b/gold/layout.h index 714c374..fe888c7 100644 --- a/gold/layout.h +++ b/gold/layout.h @@ -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_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. -- cgit v1.1