[RFC][PATCH] Check ELF relocs after opening all all input files

H.J. Lu hjl.tools@gmail.com
Wed Apr 27 22:24:00 GMT 2016


On Tue, Apr 26, 2016 at 7:29 PM, Alan Modra <amodra@gmail.com> wrote:
> On Tue, Apr 26, 2016 at 07:25:01AM -0700, H.J. Lu wrote:
>> Another problem is when check_relocs is run, linker defined symbols
>> haven't been processed yet.
>
> __start_<section> and __stop_<section>?  Yes, they are a pain.
>
> Perhaps this piece of infrastructure will help.
>
> include/
>         * bfdlink.h (struct bfd_link_hash_entry): Add "section" field to
>         undef.  Formatting.
> bfd/
>         * elflink.c (_bfd_elf_is_start_stop): New function.
>         (_bfd_elf_gc_mark_rsec): Use it.
>         * elf-bfd.h (_bfd_elf_is_start_stop): Declare.
>

It helps.  However, I ran into another problem.  bfd_elf_record_link_assignment
is called after check_relocs.  bfd_elf_record_link_assignment sets non_elf,
def_regular and  forced_local.   For PROVIDE, it also updates root.type. They
are needed in reloc_checks.


-- 
H.J.



More information about the Binutils mailing list