This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [gold patch] Incremental 17/22: COPY relocations
- From: Cary Coutant <ccoutant at google dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Tue, 7 Jun 2011 20:53:43 -0700
- Subject: Re: [gold patch] Incremental 17/22: COPY relocations
- References: <BANLkTi=eUf0Xs-O1XfpRaLz8gPFoLoUnXQ@mail.gmail.com> <mcrlixddv1n.fsf@coign.corp.google.com>
>> ? ? ? ? ? ? ? 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.
Done. I added these:
* incremental.h (enum Incremental_shlib_symbol_flags): New type.
(INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
>> - ? ? ?*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.
Done.
> This is OK with those changes.
Thanks, committed. Updated ChangeLog below.
>> (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.
Heh, heh. I'll stop numbering them now.
-cary
* 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 (enum Incremental_shlib_symbol_flags): New type.
(INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
(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.