public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@google.com>
To: Cary Coutant <ccoutant@google.com>
Cc: Binutils <binutils@sourceware.org>
Subject: Re: [gold patch] Incremental 17/22: COPY relocations
Date: Wed, 08 Jun 2011 00:31:00 -0000	[thread overview]
Message-ID: <mcrlixddv1n.fsf@coign.corp.google.com> (raw)
In-Reply-To: <BANLkTi=eUf0Xs-O1XfpRaLz8gPFoLoUnXQ@mail.gmail.com> (Cary	Coutant's message of "Tue, 26 Apr 2011 16:56:44 -0700")

Cary Coutant <ccoutant@google.com> writes:

> 2011-04-26 Cary Coutant  <ccoutant@google.com>
>
> 	* copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
> 	instead of emit_copy_reloc.
> 	(Copy_relocs::emit_copy_reloc): Refactor.
> 	(Copy_relocs::make_copy_reloc): New function.
> 	(Copy_relocs::add_copy_reloc): Remove.
> 	* copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
> 	section.
> 	(Copy_relocs::make_copy_reloc): New function.
> 	(Copy_relocs::add_copy_reloc): Remove.
> 	* gold.cc (queue_middle_tasks): Emit old COPY relocations from
> 	unchanged input files.
> 	* incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
> 	* incremental.cc (Sized_incremental_binary::do_reserve_layout):
> 	Reserve BSS space for COPY relocations.
> 	(Sized_incremental_binary::do_emit_copy_relocs): New function.
> 	(Output_section_incremental_inputs::write_info_blocks): Record
> 	whether a symbol is copied from a shared object.
> 	(Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
> 	* incremental.h
> 	(Incremental_input_entry_reader::get_output_symbol_index): Add
> 	is_copy parameter.
> 	(Incremental_binary::emit_copy_relocs): New function.
> 	(Incremental_binary::do_emit_copy_relocs): New function.
> 	(Sized_incremental_binary::Sized_incremental_binary): Initialize
> 	new data member.
> 	(Sized_incremental_binary::add_copy_reloc): New function.
> 	(Sized_incremental_binary::do_emit_copy_relocs): New function.
> 	(Sized_incremental_binary::Copy_reloc): New struct.
> 	(Sized_incremental_binary::Copy_relocs): New typedef.
> 	(Sized_incremental_binary::copy_relocs_): New data member.
> 	* symtab.cc (Symbol_table::add_from_incrobj): Change return type.
> 	* symtab.h (Symbol_table::add_from_incrobj): Change return type.
> 	* target.h (Sized_target::emit_copy_reloc): New function.
> 	* x86_64.cc (Target_x86_64::emit_copy_reloc): New function.


>  		if (sym->source() == Symbol::FROM_OBJECT
>  		    && sym->object() == obj
>  		    && sym->is_defined())
> -		  def_flag = 1U << 31;
> +		  def_flag = 2U << 30;
> +		else if (sym->is_copied_from_dynobj()
> +			 && this->symtab_->get_copy_source(sym) == dynobj)
> +		  def_flag = 3U << 30;

Let's give some names to 1U, 2U, 3U, and 30.

> -      *is_def = (output_symndx & (1U << 31)) != 0;
> -      return output_symndx & ((1U << 31) - 1);
> +      *is_def = (output_symndx >> 31) == 1;
> +      *is_copy = (output_symndx >> 30) == 3;
> +      return output_symndx & ((1U << 30) - 1);

This is kind of tricky considering how the bits are set; better to use a
switch on output_symndx >> 30, I think.

This is OK with those changes.

Thanks.


> (I split a couple of patches and added a couple, so the total patch
> count is now up to 22.)

Don't think I didn't notice that you're up to 25 now.

Ian

  reply	other threads:[~2011-06-08  0:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-26 23:57 Cary Coutant
2011-06-08  0:31 ` Ian Lance Taylor [this message]
2011-06-08  3:54   ` Cary Coutant

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mcrlixddv1n.fsf@coign.corp.google.com \
    --to=iant@google.com \
    --cc=binutils@sourceware.org \
    --cc=ccoutant@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).