[PATCH] Gold: Add a target hook to allow overriding output section name.

Ian Lance Taylor iant@google.com
Thu Jun 4 00:45:00 GMT 2009


"Doug Kwan (關振德)" <dougkwan@google.com> writes:

>     This patch adds a hook allowing a target to override the output
> section name used by Layout::choose_output_section().  Without this
> hook, all input sections with names of the form foo.bar will go to
> output section foo.   That does not work for ARM,  which has special
> output sections like .ARM.attributes and .ARM.exidx.  The patch was
> tested by linking a test program for arm-eabi and checking that
> .ARM.attributes was present.  In addition, I also ran the gold
> test-suite on the host.

I can see that we are just going to continue accruing exceptions, so I
took a different approach.  I reworked the code to follow the default
GNU linker script in the mapping from input section names to output
section names.  Rather than try to come up with a rule, I just used an
explicit mapping.

I committed this patch to the repository.  It should make most of your
patch unnecessary.  Go ahead and commit the fixes to the assertions,
though.

Ian


2009-06-03  Ian Lance Taylor  <iant@google.com>

	* layout.cc (Layout::section_name_mapping): New array, replacing
	Layout::linkonce_mapping.
	(Layout::section_name_mapping_count): New variable, replacing
	Layout::linkonce_mapping_count.
	(Layout::linkonce_output_name): Remove.
	(Layout::output_section_name): Rewrite.
	* layout.h (class Layout): Rename Linkonce_mapping to
	Section_name_mapping, linkonce_mapping to section_name_mapping,
	linkonce_mapping_count to section_name_mapping_count.  Don't
	declare linkonce_output_name.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-patch
Size: 8936 bytes
Desc: Change section name mapping
URL: <https://sourceware.org/pipermail/binutils/attachments/20090604/f4382330/attachment.bin>


More information about the Binutils mailing list