mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-17 07:53:51 +08:00
PR27100, final link failed: bad value
The failure on this PR is due to using the same bfd section for multiple output sections. Commit 21401fc7bf67 managed to create duplicate linker script output section statements, but not the actual bfd sections. PR 27100 * ldlang.h (lang_output_section_statement_type): Add dup_output. * ldlang.c (lang_output_section_statement_lookup): Set dup_output. (init_os): Test dup_output rather than constraint. * testsuite/ld-scripts/pr27100.d, * testsuite/ld-scripts/pr27100.s, * testsuite/ld-scripts/pr27100.t: New test. * testsuite/ld-scripts/data.exp: Run it. Don't exclude aout here. * testsuite/ld-scripts/data.d: Do so here instead. * testsuite/ld-scripts/fill.d: Likewise. * testsuite/ld-scripts/fill16.d: Likewise.
This commit is contained in:
@ -1526,6 +1526,8 @@ lang_output_section_statement_lookup (const char *name,
|
||||
|
||||
entry->s.output_section_statement.name = name;
|
||||
entry->s.output_section_statement.constraint = constraint;
|
||||
entry->s.output_section_statement.dup_output = (create == 2
|
||||
|| constraint == SPECIAL);
|
||||
return &entry->s.output_section_statement;
|
||||
}
|
||||
|
||||
@ -2387,7 +2389,7 @@ init_os (lang_output_section_statement_type *s, flagword flags)
|
||||
if (strcmp (s->name, DISCARD_SECTION_NAME) == 0)
|
||||
einfo (_("%F%P: illegal use of `%s' section\n"), DISCARD_SECTION_NAME);
|
||||
|
||||
if (s->constraint != SPECIAL)
|
||||
if (!s->dup_output)
|
||||
s->bfd_section = bfd_get_section_by_name (link_info.output_bfd, s->name);
|
||||
if (s->bfd_section == NULL)
|
||||
s->bfd_section = bfd_make_section_anyway_with_flags (link_info.output_bfd,
|
||||
|
Reference in New Issue
Block a user