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: PR ld/14156: -sort-section=alignment trashes init/fini sections, and anything similar


On Wed, Jun 27, 2012 at 6:26 PM, Alan Modra <amodra@gmail.com> wrote:
> On Wed, Jun 27, 2012 at 10:30:11AM -0700, H.J. Lu wrote:
>> ? ? ? ? ? case lang_wild_statement_enum:
>> ? ? ? ? ? ? sec = s->wild_statement.section_list;
>> - ? ? ? ? ? for (sec = s->wild_statement.section_list; sec != NULL;
>> - ? ? ? ? ? ? ? ?sec = sec->next)
>> + ? ? ? ? ? /* Don't sort .init/.fini sections. ?*/
>> + ? ? ? ? ? if (sec == NULL
>> + ? ? ? ? ? ? ? || strcmp (sec->spec.name, ".init") == 0
>> + ? ? ? ? ? ? ? || strcmp (sec->spec.name, ".fini") == 0)
>> + ? ? ? ? ? ? break;
>> + ? ? ? ? ? for (; sec != NULL; sec = sec->next)
>> ? ? ? ? ? ? ? {
>> ? ? ? ? ? ? ? ? switch (sec->spec.sorted)
>> ? ? ? ? ? ? ? ? ? {
>
> If we are going to hard code .init and .fini names (and we do that
> elsewhere) I think it would be better to disable the sorting when
> looking at the output_section_statement rather than the
> wild_statement.

I thought about to do it at

            case lang_output_section_statement_enum:
              update_wild_statements
                (s->output_section_statement.children.head);
              break;

Then I had to handle all those different enums.  It is
easier just to it at

          case lang_wild_statement_enum:
              sec = s->wild_statement.section_list;

It makes very little difference in term of performance.

> Hmm, even better, inplement a SORT_NONE script keyword to extend our
> current list of sorting keywords, SORT_BY_NAME, SORT_BY_ALIGNMENT and
> SORT_BY_INIT_PRIORITY. ?SORT_NONE does the obvious, overriding
> --sort-section=name and --sort-section=alignment.
>

It won't work correctly with existing customer linker scripts.
I think we should just hardcode ,init/.fini section names.


-- 
H.J.


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