mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-24 02:24:46 +08:00
section-select: Completely rebuild matches
The check_relocs callback (and others) might have created new section behind our back and some of them (e.g. on powerpc the "linker stubs" .got) need to come in front of all others, despite being created late (a symptom would be "TOC opt*" failing on powerpc). This resets all section matches before updating for newly created sections (i.e. completely rebuilds the matches).
This commit is contained in:
parent
43ae96e94a
commit
50be5d1128
22
ld/ldlang.c
22
ld/ldlang.c
@ -8066,6 +8066,23 @@ lang_propagate_lma_regions (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
reset_one_wild (lang_statement_union_type *statement)
|
||||||
|
{
|
||||||
|
if (statement->header.type == lang_wild_statement_enum)
|
||||||
|
{
|
||||||
|
lang_wild_statement_type *stmt = &statement->wild_statement;
|
||||||
|
stmt->resolved = false;
|
||||||
|
lang_list_init (&stmt->matching_sections);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
reset_resolved_wilds (void)
|
||||||
|
{
|
||||||
|
lang_for_each_statement (reset_one_wild);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
lang_process (void)
|
lang_process (void)
|
||||||
{
|
{
|
||||||
@ -8279,6 +8296,11 @@ lang_process (void)
|
|||||||
|
|
||||||
ldemul_after_check_relocs ();
|
ldemul_after_check_relocs ();
|
||||||
|
|
||||||
|
/* There might have been new sections created (e.g. as result of
|
||||||
|
checking relocs to need a .got, or suchlike), so to properly order
|
||||||
|
them into our lists of matching sections reset them here. */
|
||||||
|
reset_resolved_wilds ();
|
||||||
|
|
||||||
/* Update wild statements in case the user gave --sort-section.
|
/* Update wild statements in case the user gave --sort-section.
|
||||||
Note how the option might have come after the linker script and
|
Note how the option might have come after the linker script and
|
||||||
so couldn't have been set when the wild statements were created. */
|
so couldn't have been set when the wild statements were created. */
|
||||||
|
Loading…
Reference in New Issue
Block a user