This is the mail archive of the
mailing list for the binutils project.
Re: [PATCH][GOLD] Allow a target to fix up output section flags.
- From: Ian Lance Taylor <iant at google dot com>
- To: Doug Kwan (éæå) <dougkwan at google dot com>
- Cc: binutils <binutils at sources dot redhat dot com>
- Date: Tue, 19 Apr 2011 17:02:42 -0700
- Subject: Re: [PATCH][GOLD] Allow a target to fix up output section flags.
- References: <BANLkTikfytKdXMrQQXniP83tVCDvaHd6JA@mail.gmail.com>
"Doug Kwan (éæå)" <email@example.com> writes:
> This patch adds code to allow a target to fix up some flags in an
> output section header. We need this for ARM's EXIDX section, which is
> required to have SHF_LINK_ORDER set. We currently do not handle that
> flag correctly in layout, it would be desirable to fix that in the
> long run. I have tested this for both ARM and X86_64 and I also added
> a new test case.
> 2011-04-05 Doug Kwan <firstname.lastname@example.org>
> * arm.cc (Target_arm::do_adjust_output_section_flags): New
> method definition.
> * output.cc (Output_section::write_header): Allow a target to adjust
> output section flags.
> * target.h (Target::adjust_output_section_flags): New method definition.
> (Target::do_adjust_output_section_flags): Same.
> * testsuite/Makefile.am (arm_exidx_test): New test rules.
> * testsuite/Makefile.in: Regenerate.
> * testsuite/arm_exidx_test.s: New file.
> * testsuite/arm_exidx_test.sh: Same.
Sorry, I forgot about this one.
I want to try to push back on having lots of little random Target hooks.
We already have too many. They make it harder to understand how to
write a new backend and harder to modify the linker. This is a problem
in BFD as well. As much as possible we need to make target hooks
simple, easy to understand, and few in number.
In this case the ARM backend already uses the make_output_section target
hook, so it should be possible to do everything there. I don't see any
need for a new target hook to do this. If you need to add a function to
Output_section to change the flags_ field, do that.