[patch] Ignore non relobj files in gc

Cary Coutant ccoutant@gmail.com
Sat May 2 15:49:00 GMT 2015


> What about the attached compromise patch? It changes the type of just
> the local variable.
>
>>> Using Relobj also helps me in my patch for gcing parts of SHF_MERGE sections.
>>
>> If that's the case, let's move those changes to a separate patch.
>> Nevertheless, I think it would be cleaner to change Section_id to use
>> a Relobj* directly. That has some cascading effects, but doesn't
>> affect quite as much target-independent code, and we really never need
>> a Section_id that refers to a non-relocatable object. The attached
>> patch does that.
>
> It is nicer. I started the patch trying it, hit the icf code and
> backed out a bit.

I've committed the attached patch to change Object* to Relobj* in
Section_id and to propagate that change as necessary.

-cary


Change Section_id type to use Relobj* instead of Object*.

2015-04-29  Cary Coutant  <cary@google.com>
            Rafael Ávila de Espíndola <rafael.espindola@gmail.com>

gold/
        * gc.h (Garbage_collection::is_section_garbage): Change Object*
        to Relobj*.
        (Garbage_collection::add_reference): Likewise.
        (Garbage_collection::gc_process_relocs): Likewise. Don't push
        object/shndx pair onto *secvec for dynamic objects. Don't follow
        relocations pointing to dynamic objects for GC.
        * icf.cc (Icf::find_identical_sections): Change Object* to Relobj*.
        (Icf::unfold_section): Likewise.
        (Icf::is_section_folded): Likewise.
        (Icf::get_folded_section): Likewise.
        * icf.h: (Icf::get_folded_section): Likewise.
        (Icf::unfold_section): Likewise.
        (Icf::is_section_folded): Likewise.
        (Icf::section_has_function_pointers): Likewise.
        (Icf::set_section_has_function_pointers): Likewise.
        * object.h (Section_id): Likewise.
        (Const_section_id): Likewise.
        * output.cc (Output_section::update_section_layout): Likewise.
        * output.h: (Output_section_lookup_maps::find_relaxed_input_section):
        Likewise.
        * plugin.cc (update_section_order): Likewise.
        (unique_segment_for_sections): Likewise.
        * powerpc.cc (Powerpc_relobj::add_reference): Likewise.
        (Target_powerpc::do_gc_add_reference): Likewise.
        (Target_powerpc::gc_process_relocs): Likewise.
        (Target_powerpc::do_gc_add_reference): Likewise.
        * symtab.cc (Symbol_table::is_section_folded): Likewise.
        (Symbol_table::gc_mark_symbol): Likewise.
        * symtab.h: (Symbol_table::is_section_folded): Likewise.
        * target.h: (Sized_target::gc_add_reference): Likewise.
        (Sized_target::do_gc_add_reference): Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gold-section-id.patch
Type: application/octet-stream
Size: 15351 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20150502/279ddbaf/attachment.obj>


More information about the Binutils mailing list