From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26419 invoked by alias); 21 May 2011 16:52:47 -0000 Received: (qmail 26396 invoked by uid 22791); 21 May 2011 16:52:45 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 21 May 2011 16:52:29 +0000 Received: from hpaq14.eem.corp.google.com (hpaq14.eem.corp.google.com [172.25.149.14]) by smtp-out.google.com with ESMTP id p4LGqShl008191 for ; Sat, 21 May 2011 09:52:28 -0700 Received: from pzk30 (pzk30.prod.google.com [10.243.19.158]) by hpaq14.eem.corp.google.com with ESMTP id p4LGqD3a013576 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Sat, 21 May 2011 09:52:26 -0700 Received: by pzk30 with SMTP id 30so2470118pzk.32 for ; Sat, 21 May 2011 09:52:26 -0700 (PDT) Received: by 10.68.11.228 with SMTP id t4mr1182077pbb.294.1305996746028; Sat, 21 May 2011 09:52:26 -0700 (PDT) Received: from coign.google.com (687f747b767d.click-network.com [131.191.34.48]) by mx.google.com with ESMTPS id g5sm3204922pbj.62.2011.05.21.09.52.24 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 21 May 2011 09:52:25 -0700 (PDT) From: Ian Lance Taylor To: Cary Coutant Cc: Binutils Subject: Re: [gold patch] Incremental 11/18: update GOT/PLT References: Date: Sat, 21 May 2011 16:52:00 -0000 In-Reply-To: (Cary Coutant's message of "Fri, 1 Apr 2011 14:35:38 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2011-05/txt/msg00296.txt.bz2 Cary Coutant writes: > * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries. > * incremental-dump.cc (dump_incremental_inputs): Mask high-order > bit when checking got_type. > * incremental.cc (Sized_incremental_binary::setup_readers): > Store symbol table and string table locations; initialize bit vector > of file status flags. > (Sized_incremental_binary::do_reserve_layout): Set bit flag for > unchanged files. > (Sized_incremental_binary::do_process_got_plt): New function. > (Sized_incremental_binary::get_symtab_view): Use stored locations. > (Output_section_incremental_inputs::set_final_data_size): Record > file index for each input file. > (Output_section_incremental_inputs::write_got_plt): Store file index > instead of input entry offset for each GOT entry. > * incremental.h > (Incremental_input_entry::Incremental_input_entry): Initialize new > data member. > (Incremental_input_entry::set_offset): Store file index. > (Incremental_input_entry::get_file_index): New function. > (Incremental_input_entry::file_index_): New data member. > (Incremental_binary::process_got_plt): New function. > (Incremental_binary::do_process_got_plt): New function. > (Sized_incremental_binary::Sized_incremental_binary): Initialize new > data members. > (Sized_incremental_binary::~Sized_incremental_binary): New destructor. > (Sized_incremental_binary::set_file_is_unchanged): New function. > (Sized_incremental_binary::file_is_unchanged): New function. > (Sized_incremental_binary::do_process_got_plt): New function. > (Sized_incremental_binary::file_status_): New data member. > (Sized_incremental_binary::main_symtab_loc_): New data member. > (Sized_incremental_binary::main_strtab_loc_): New data member. > * output.cc (Output_data_got::Got_entry::write): Add case > RESERVED_CODE. > (Output_data_got::add_global): Call add_got_entry. > (Output_data_got::add_global_plt): Likewise. > (Output_data_got::add_global_with_rel): Likewise. > (Output_data_got::add_global_with_rela): Likewise. > (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair. > (Output_data_got::add_global_pair_with_rela): Likewise. > (Output_data_got::add_local): Call add_got_entry. > (Output_data_got::add_local_plt): Likewise. > (Output_data_got::add_local_with_rel): Likewise. > (Output_data_got::add_local_with_rela): Likewise. > (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair. > (Output_data_got::add_local_pair_with_rela): Likewise. > (Output_data_got::reserve_slot): New function. > (Output_data_got::reserve_slot_for_global): New function. > (Output_section::add_output_section_data): Edit FIXME. > * output.h > (Output_section_data_build::Output_section_data_build): New > constructor with size parameter. > (Output_data_space::Output_data_space): Likewise. > (Output_data_got::Output_data_got): Initialize new data member; new > constructor with size parameter. > (Output_data_got::add_constant): Call add_got_entry. > (Output_data_got::reserve_slot): New function. > (Output_data_got::reserve_slot_for_global): New function. > (class Output_data_got::Got_entry): Add RESERVED_CODE. > (Output_data_got::add_got_entry): New function. > (Output_data_got::add_got_entry_pair): New function. > (Output_data_got::free_list_): New data member. > * target.h (Sized_target::init_got_plt_for_update): New function. > (Sized_target::register_global_plt_entry): New function. > * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64): > Initialize new data member; call init; add constructor with PLT count. > (Output_data_plt_x86_64::init): New function. > (Output_data_plt_x86_64::add_relocation): New function. > (Output_data_plt_x86_64::reserve_slot): New function. > (Output_data_plt_x86_64::free_list_): New data member. > (Target_x86_64::init_got_plt_for_update): New function. > (Target_x86_64::register_global_plt_entry): New function. > (Output_data_plt_x86_64::add_entry): Allocate from free list for > incremental updates. > (Output_data_plt_x86_64::add_relocation): New function. > + // Set the flag for input file N to indicate that the file is unchanged. > + void > + set_file_is_unchanged(unsigned int n) > + { > + gold_assert(this->file_status_ != NULL); > + this->file_status_[n / 8] |= 1U << (n % 8); > + } You don't have to do this, but consider using std::vector for file_status_. That will give the tight memory layout without requiring that we get the bit operations right. > + // Create a new GOT entry and return its offset. > + unsigned int > + add_got_entry(Got_entry got_entry) > + { > + if (!this->is_data_size_valid()) > + { > + this->entries_.push_back(got_entry); > + this->set_got_size(); > + return this->last_got_offset(); > + } > + else > + { > + // For an incremental update, find an available slot. > + off_t got_offset = this->free_list_.allocate(size / 8, size / 8, 0); > + if (got_offset == -1) > + gold_fatal(_("out of patch space (GOT);" > + " relink with --incremental-full")); > + unsigned int got_index = got_offset / (size / 8); > + gold_assert(got_index < this->entries_.size()); > + this->entries_[got_index] = got_entry; > + return static_cast(got_offset); > + } > + } > + > + // Create a pair of new GOT entries and return the offset of the first. > + unsigned int > + add_got_entry_pair(Got_entry got_entry_1, Got_entry got_entry_2) > + { > + if (!this->is_data_size_valid()) > + { > + unsigned int got_offset; > + this->entries_.push_back(got_entry_1); > + got_offset = this->last_got_offset(); > + this->entries_.push_back(got_entry_2); > + this->set_got_size(); > + return got_offset; > + } > + else > + { > + // For an incremental update, find an available pair of slots. > + off_t got_offset = this->free_list_.allocate(2 * size / 8, size / 8, 0); > + if (got_offset == -1) > + gold_fatal(_("out of patch space (GOT);" > + " relink with --incremental-full")); > + unsigned int got_index = got_offset / (size / 8); > + gold_assert(got_index < this->entries_.size()); > + this->entries_[got_index] = got_entry_1; > + this->entries_[got_index + 1] = got_entry_2; > + return static_cast(got_offset); > + } > + } I think these functions are complex enough that they should move from output.h to output.cc. This is OK with those changes. Sorry for the long delay. Thanks. Ian