This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: PR ld/14156: -sort-section=alignment trashes init/fini sections, and anything similar
- From: Alan Modra <amodra at gmail dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Thu, 28 Jun 2012 10:56:20 +0930
- Subject: Re: PATCH: PR ld/14156: -sort-section=alignment trashes init/fini sections, and anything similar
- References: <20120627173011.GA10021@intel.com>
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.
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.
--
Alan Modra
Australia Development Lab, IBM