Linker --sort-section name is broken
Sonal Santan
sonal.santan@xilinx.com
Mon Aug 7 21:44:00 GMT 2006
Hello H.J.
Looks like ld lacks the kind of examples you tried in its testsuite. I
can think of the following two ways to fix this:
[1] A quick fix would be to change the logic which triggers BST sorting
in wild() to the following--
if (s->handler_data[0]
&& s->handler_data[0]->spec.sorted == by_name
&& !s->filenames_sorted
&& !handler_data[1])
{...
[2] A better fix would be grow the handler_data[] array in struct
lang_wild_statement_struct to size 5. Make the BST logic exclusively use
handler_data[4] for all its needs.
What do you think?
Sonal
H. J. Lu wrote:
> Hi Sonal,
>
> Your linker patch breaks --sort-section name. In wild (), you hae
>
> if (s->handler_data[0]
> && s->handler_data[0]->spec.sorted == by_name
> && !s->filenames_sorted)
> {
> lang_section_bst_type *tree;
>
> walk_wild (s, output_section_callback_fast, output);
>
> tree = (lang_section_bst_type *) s->handler_data[1];
> if (tree)
> output_section_callback_tree_to_list (s, tree, output);
> s->handler_data[1] = NULL;
> }
>
> With "--sort-section name" on
>
> *(.text .text.*)
>
> handler_data[1] is a wildcard spec. But you use it for BST in
> wild_sort_fast. I don't see how it can work. I really don't like
>
> tree = (lang_section_bst_type **) &wild->handler_data[1];
>
> It is hard to check if it is really valid.
>
>
> H.J.
>
>
More information about the Binutils
mailing list