PATCH: PR ld/14156: -sort-section=alignment trashes init/fini sections, and anything similar
Alan Modra
amodra@gmail.com
Thu Jun 28 01:26:00 GMT 2012
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
More information about the Binutils
mailing list