This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
INPUT_SECTION_FLAGS broken
On Sat, Apr 21, 2012 at 02:17:34PM +0930, Alan Modra wrote:
> Hmm. Looks to me like INPUT_SECTION_FLAGS is totally broken.
Catherine, you can fix it like this I think:
1) Don't copy section_flag_list to section in
walk_wild_consider_section. That's quite wrong, especially when it's
done before tests that exclude some sections. Instead, add another
parameter to lang_add_section to pass in section_flag_list, and
pass that from the wild statement in (multiple versions of!)
output_section_callback.
2) Return a boolean from bfd_lookup_section_flags and pass in the
bfd section and flag_info_list. Always call bfd_lookup_section_flags
in lang_add_section. A false return says to omit the section.
3) Remove struct flag_info from bfdlink.h. With the above changes
nothing in ld should need to know about only_with_flags,
not_with_flags, and flags_initialized. These all become private to
the implementation of bfd_lookup_section_flags.
4) Remove section_flag_info from struct bfd_section, and put it into
struct bfd_elf_section_data. With the above changes there will be no
need to bloat struct bfd_section for backends that don't support
INPUT_SECTION_FLAGS.
5) Implement the changes to bfd_elf_lookup_section_flags to
compare elf_internal_shdr.sh_flags against section_flag_list.
--
Alan Modra
Australia Development Lab, IBM