This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


With your change,  I can add mapping for ARM special sections using
something like:

Index: layout.cc
===================================================================
RCS file: /cvs/src/src/gold/layout.cc,v
retrieving revision 1.124
diff -u -r1.124 layout.cc
--- layout.cc	4 Jun 2009 00:43:11 -0000	1.124
+++ layout.cc	4 Jun 2009 18:33:23 -0000
@@ -2887,6 +2887,10 @@
   MAPPING_INIT(".gnu.linkonce.lr.", ".lrodata"),
   MAPPING_INIT(".gnu.linkonce.l.", ".ldata"),
   MAPPING_INIT(".gnu.linkonce.lb.", ".lbss"),
+  MAPPING_INIT(".ARM.extab.", ".ARM.extab"),
+  MAPPING_INIT(".gnu.linkonce.armextab.", ".ARM.extab"),
+  MAPPING_INIT(".ARM.exidx.", ".ARM.exidx"),
+  MAPPING_INIT(".gnu.linkonce.armexidx.", ".ARM.exidx"),
 };
 #undef MAPPING_INIT


This is very simple.  May only concern is that the mapping is visible
to all targets, not just ARM.   This probably is okay since I do not
expect other targets to use these section names.

Is it okay to add these mapping?

-Doug

2009/6/3 Ian Lance Taylor <iant@google.com>:
> "Doug Kwan (Ãö®¶¼w)" <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.
>
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]