This is the mail archive of the
mailing list for the binutils project.
Re: [RFC][PATCH] Check ELF relocs after opening all all input files
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Alan Modra <amodra at gmail dot com>
- Cc: Nick Clifton <nickc at redhat dot com>, Binutils <binutils at sourceware dot org>
- Date: Wed, 27 Apr 2016 15:24:48 -0700
- Subject: Re: [RFC][PATCH] Check ELF relocs after opening all all input files
- Authentication-results: sourceware.org; auth=none
- References: <20160419134956 dot GA12310 at intel dot com> <57165642 dot 1070808 at redhat dot com> <CAMe9rOrydGcortz2AsujVSQYZCRbSPsi7CFQRnA6ZZiicbUvTA at mail dot gmail dot com> <20160419232457 dot GB20119 at bubble dot grove dot modra dot org> <CAMe9rOqAmmgni51d349yEcW7OcHKq3cPQ3btsJUGR5i_P4uErA at mail dot gmail dot com> <CAMe9rOrCzys1EUwvkYNHjzN8NVxab66WvhUFANXxtb6vxppgXA at mail dot gmail dot com> <20160427022922 dot GA20333 at bubble dot grove dot modra dot org>
On Tue, Apr 26, 2016 at 7:29 PM, Alan Modra <email@example.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.
> * bfdlink.h (struct bfd_link_hash_entry): Add "section" field to
> undef. Formatting.
> * 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.