Non-contiguous memory regions support: Avoid calls to abort
Use '%F' format when printing error messages to exit cleanly rather than by calling abort(). 2020-03-18 Christophe Lyon <christophe.lyon@linaro.org> bfd/ * elf32-arm.c (arm_build_one_stub): Emit a fatal error message instead of calling abort. * elf32-csky.c (csky_build_one_stub): Likewise. * elf32-hppa.c (hppa_build_one_stub): Likewise. * elf32-m68hc11.c (m68hc11_elf_build_one_stub): Likewise. * elf32-m68hc12.c (m68hc12_elf_build_one_stub): Likewise. * elf32-metag.c (metag_build_one_stub): Likewise. * elf32-nios2.c (nios2_build_one_stub): Likewise. * elf64-ppc.c (ppc_build_one_stub): Likewise. (ppc_size_one_stub): Likewise. * elfnn-aarch64.c (aarch64_build_one_stub): Likewise. ld/ * emultempl/xtensaelf.em: Emit a fatal error message instead of calling abort. * ldlang.c: Likewise. Change-Id: I60deaeeee59d4e7cab06b8a40a3e51837c43a8ab
This commit is contained in:
parent
5a82b8a12b
commit
53215f214c
@ -1,3 +1,17 @@
|
|||||||
|
2020-03-18 Christophe Lyon <christophe.lyon@linaro.org>
|
||||||
|
|
||||||
|
* elf32-arm.c (arm_build_one_stub): Emit a fatal error message
|
||||||
|
instead of calling abort.
|
||||||
|
* elf32-csky.c (csky_build_one_stub): Likewise.
|
||||||
|
* elf32-hppa.c (hppa_build_one_stub): Likewise.
|
||||||
|
* elf32-m68hc11.c (m68hc11_elf_build_one_stub): Likewise.
|
||||||
|
* elf32-m68hc12.c (m68hc12_elf_build_one_stub): Likewise.
|
||||||
|
* elf32-metag.c (metag_build_one_stub): Likewise.
|
||||||
|
* elf32-nios2.c (nios2_build_one_stub): Likewise.
|
||||||
|
* elf64-ppc.c (ppc_build_one_stub): Likewise.
|
||||||
|
(ppc_size_one_stub): Likewise.
|
||||||
|
* elfnn-aarch64.c (aarch64_build_one_stub): Likewise.
|
||||||
|
|
||||||
2020-03-17 Nick Clifton <nickc@redhat.com>
|
2020-03-17 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
PR 25688
|
PR 25688
|
||||||
|
@ -5068,12 +5068,9 @@ arm_build_one_stub (struct bfd_hash_entry *gen_entry,
|
|||||||
section. The user should fix his linker script. */
|
section. The user should fix his linker script. */
|
||||||
if (stub_entry->target_section->output_section == NULL
|
if (stub_entry->target_section->output_section == NULL
|
||||||
&& info->non_contiguous_regions)
|
&& info->non_contiguous_regions)
|
||||||
{
|
info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
|
||||||
_bfd_error_handler (_("Could not assign '%pA' to an output section. "
|
"Retry without --enable-non-contiguous-regions.\n"),
|
||||||
"Retry without --enable-non-contiguous-regions.\n"),
|
stub_entry->target_section);
|
||||||
stub_entry->target_section);
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
globals = elf32_arm_hash_table (info);
|
globals = elf32_arm_hash_table (info);
|
||||||
if (globals == NULL)
|
if (globals == NULL)
|
||||||
|
@ -3625,12 +3625,9 @@ csky_build_one_stub (struct bfd_hash_entry *gen_entry,
|
|||||||
section. The user should fix his linker script. */
|
section. The user should fix his linker script. */
|
||||||
if (stub_entry->target_section->output_section == NULL
|
if (stub_entry->target_section->output_section == NULL
|
||||||
&& info->non_contiguous_regions)
|
&& info->non_contiguous_regions)
|
||||||
{
|
info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
|
||||||
_bfd_error_handler (_("Could not assign '%pA' to an output section. "
|
"Retry without --enable-non-contiguous-regions.\n"),
|
||||||
"Retry without --enable-non-contiguous-regions.\n"),
|
stub_entry->target_section);
|
||||||
stub_entry->target_section);
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
globals = csky_elf_hash_table (info);
|
globals = csky_elf_hash_table (info);
|
||||||
if (globals == NULL)
|
if (globals == NULL)
|
||||||
|
@ -735,12 +735,10 @@ hppa_build_one_stub (struct bfd_hash_entry *bh, void *in_arg)
|
|||||||
section. The user should fix his linker script. */
|
section. The user should fix his linker script. */
|
||||||
if (hsh->target_section->output_section == NULL
|
if (hsh->target_section->output_section == NULL
|
||||||
&& info->non_contiguous_regions)
|
&& info->non_contiguous_regions)
|
||||||
{
|
info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output "
|
||||||
_bfd_error_handler (_("Could not assign '%pA' to an output section. "
|
"section. Retry without "
|
||||||
"Retry without --enable-non-contiguous-regions.\n"),
|
"--enable-non-contiguous-regions.\n"),
|
||||||
hsh->target_section);
|
hsh->target_section);
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create the long branch. A long branch is formed with "ldil"
|
/* Create the long branch. A long branch is formed with "ldil"
|
||||||
loading the upper bits of the target address into a register,
|
loading the upper bits of the target address into a register,
|
||||||
@ -766,12 +764,11 @@ hppa_build_one_stub (struct bfd_hash_entry *bh, void *in_arg)
|
|||||||
section. The user should fix his linker script. */
|
section. The user should fix his linker script. */
|
||||||
if (hsh->target_section->output_section == NULL
|
if (hsh->target_section->output_section == NULL
|
||||||
&& info->non_contiguous_regions)
|
&& info->non_contiguous_regions)
|
||||||
{
|
info->callbacks->einfo (_("%F%P: Could not assign %pA to an output "
|
||||||
_bfd_error_handler (_("Could not assign %pA to an output section. "
|
"section. Retry without "
|
||||||
"Retry without --enable-non-contiguous-regions.\n"),
|
"--enable-non-contiguous-regions.\n"),
|
||||||
hsh->target_section);
|
hsh->target_section);
|
||||||
abort();
|
|
||||||
}
|
|
||||||
/* Branches are relative. This is where we are going to. */
|
/* Branches are relative. This is where we are going to. */
|
||||||
sym_value = (hsh->target_value
|
sym_value = (hsh->target_value
|
||||||
+ hsh->target_section->output_offset
|
+ hsh->target_section->output_offset
|
||||||
@ -848,12 +845,11 @@ hppa_build_one_stub (struct bfd_hash_entry *bh, void *in_arg)
|
|||||||
section. The user should fix his linker script. */
|
section. The user should fix his linker script. */
|
||||||
if (hsh->target_section->output_section == NULL
|
if (hsh->target_section->output_section == NULL
|
||||||
&& info->non_contiguous_regions)
|
&& info->non_contiguous_regions)
|
||||||
{
|
info->callbacks->einfo (_("%F%P: Could not assign %pA to an output "
|
||||||
_bfd_error_handler (_("Could not assign %pA to an output section. "
|
"section. Retry without "
|
||||||
"Retry without --enable-non-contiguous-regions.\n"),
|
"--enable-non-contiguous-regions.\n"),
|
||||||
hsh->target_section);
|
hsh->target_section);
|
||||||
abort();
|
|
||||||
}
|
|
||||||
/* Branches are relative. This is where we are going to. */
|
/* Branches are relative. This is where we are going to. */
|
||||||
sym_value = (hsh->target_value
|
sym_value = (hsh->target_value
|
||||||
+ hsh->target_section->output_offset
|
+ hsh->target_section->output_offset
|
||||||
|
@ -419,12 +419,9 @@ m68hc11_elf_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
|
|||||||
section. The user should fix his linker script. */
|
section. The user should fix his linker script. */
|
||||||
if (stub_entry->target_section->output_section == NULL
|
if (stub_entry->target_section->output_section == NULL
|
||||||
&& info->non_contiguous_regions)
|
&& info->non_contiguous_regions)
|
||||||
{
|
info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
|
||||||
_bfd_error_handler (_("Could not assign '%pA' to an output section. "
|
"Retry without --enable-non-contiguous-regions.\n"),
|
||||||
"Retry without --enable-non-contiguous-regions.\n"),
|
stub_entry->target_section);
|
||||||
stub_entry->target_section);
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
htab = m68hc11_elf_hash_table (info);
|
htab = m68hc11_elf_hash_table (info);
|
||||||
if (htab == NULL)
|
if (htab == NULL)
|
||||||
|
@ -539,12 +539,9 @@ m68hc12_elf_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
|
|||||||
section. The user should fix his linker script. */
|
section. The user should fix his linker script. */
|
||||||
if (stub_entry->target_section->output_section == NULL
|
if (stub_entry->target_section->output_section == NULL
|
||||||
&& info->non_contiguous_regions)
|
&& info->non_contiguous_regions)
|
||||||
{
|
info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
|
||||||
_bfd_error_handler (_("Could not assign '%pA' to an output section. "
|
"Retry without --enable-non-contiguous-regions.\n"),
|
||||||
"Retry without --enable-non-contiguous-regions.\n"),
|
stub_entry->target_section);
|
||||||
stub_entry->target_section);
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
htab = m68hc11_elf_hash_table (info);
|
htab = m68hc11_elf_hash_table (info);
|
||||||
|
|
||||||
|
@ -3477,12 +3477,9 @@ metag_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
|
|||||||
section. The user should fix his linker script. */
|
section. The user should fix his linker script. */
|
||||||
if (hsh->target_section->output_section == NULL
|
if (hsh->target_section->output_section == NULL
|
||||||
&& info->non_contiguous_regions)
|
&& info->non_contiguous_regions)
|
||||||
{
|
info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
|
||||||
_bfd_error_handler (_("Could not assign '%pA' to an output section. "
|
"Retry without --enable-non-contiguous-regions.\n"),
|
||||||
"Retry without --enable-non-contiguous-regions.\n"),
|
hsh->target_section);
|
||||||
hsh->target_section);
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
stub_sec = hsh->stub_sec;
|
stub_sec = hsh->stub_sec;
|
||||||
|
|
||||||
|
@ -2498,12 +2498,10 @@ nios2_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg ATTRIBUTE_U
|
|||||||
section. The user should fix his linker script. */
|
section. The user should fix his linker script. */
|
||||||
if (hsh->target_section->output_section == NULL
|
if (hsh->target_section->output_section == NULL
|
||||||
&& info->non_contiguous_regions)
|
&& info->non_contiguous_regions)
|
||||||
{
|
info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
|
||||||
_bfd_error_handler (_("Could not assign '%pA' to an output section. "
|
"Retry without --enable-non-contiguous-regions.\n"),
|
||||||
"Retry without --enable-non-contiguous-regions.\n"),
|
hsh->target_section);
|
||||||
hsh->target_section);
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
/* Make a note of the offset within the stubs for this entry. */
|
/* Make a note of the offset within the stubs for this entry. */
|
||||||
hsh->stub_offset = stub_sec->size;
|
hsh->stub_offset = stub_sec->size;
|
||||||
|
|
||||||
|
@ -11367,25 +11367,19 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
|
|||||||
if (stub_entry->target_section != NULL
|
if (stub_entry->target_section != NULL
|
||||||
&& stub_entry->target_section->output_section == NULL
|
&& stub_entry->target_section->output_section == NULL
|
||||||
&& info->non_contiguous_regions)
|
&& info->non_contiguous_regions)
|
||||||
{
|
info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
|
||||||
_bfd_error_handler (_("Could not assign '%pA' to an output section. "
|
"Retry without --enable-non-contiguous-regions.\n"),
|
||||||
"Retry without --enable-non-contiguous-regions.\n"),
|
stub_entry->target_section);
|
||||||
stub_entry->target_section);
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Same for the group. */
|
/* Same for the group. */
|
||||||
if (stub_entry->group->stub_sec != NULL
|
if (stub_entry->group->stub_sec != NULL
|
||||||
&& stub_entry->group->stub_sec->output_section == NULL
|
&& stub_entry->group->stub_sec->output_section == NULL
|
||||||
&& info->non_contiguous_regions)
|
&& info->non_contiguous_regions)
|
||||||
{
|
info->callbacks->einfo (_("%F%P: Could not assign group %pA target %pA to an "
|
||||||
_bfd_error_handler (_("Could not assign group %pA target %pA to an "
|
"output section. Retry without "
|
||||||
"output section. Retry without "
|
"--enable-non-contiguous-regions.\n"),
|
||||||
"--enable-non-contiguous-regions.\n"),
|
stub_entry->group->stub_sec,
|
||||||
stub_entry->group->stub_sec,
|
stub_entry->target_section);
|
||||||
stub_entry->target_section);
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
htab = ppc_hash_table (info);
|
htab = ppc_hash_table (info);
|
||||||
if (htab == NULL)
|
if (htab == NULL)
|
||||||
@ -11917,25 +11911,19 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
|
|||||||
if (stub_entry->target_section != NULL
|
if (stub_entry->target_section != NULL
|
||||||
&& stub_entry->target_section->output_section == NULL
|
&& stub_entry->target_section->output_section == NULL
|
||||||
&& info->non_contiguous_regions)
|
&& info->non_contiguous_regions)
|
||||||
{
|
info->callbacks->einfo (_("%F%P: Could not assign %pA to an output section. "
|
||||||
_bfd_error_handler (_("Could not assign %pA to an output section. "
|
"Retry without --enable-non-contiguous-regions.\n"),
|
||||||
"Retry without --enable-non-contiguous-regions.\n"),
|
stub_entry->target_section);
|
||||||
stub_entry->target_section);
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Same for the group. */
|
/* Same for the group. */
|
||||||
if (stub_entry->group->stub_sec != NULL
|
if (stub_entry->group->stub_sec != NULL
|
||||||
&& stub_entry->group->stub_sec->output_section == NULL
|
&& stub_entry->group->stub_sec->output_section == NULL
|
||||||
&& info->non_contiguous_regions)
|
&& info->non_contiguous_regions)
|
||||||
{
|
info->callbacks->einfo (_("%F%P: Could not assign group %pA target %pA to an "
|
||||||
_bfd_error_handler (_("Could not assign group %pA target %pA to an "
|
"output section. Retry without "
|
||||||
"output section. Retry without "
|
"--enable-non-contiguous-regions.\n"),
|
||||||
"--enable-non-contiguous-regions.\n"),
|
stub_entry->group->stub_sec,
|
||||||
stub_entry->group->stub_sec,
|
stub_entry->target_section);
|
||||||
stub_entry->target_section);
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Make a note of the offset within the stubs for this entry. */
|
/* Make a note of the offset within the stubs for this entry. */
|
||||||
stub_entry->stub_offset = stub_entry->group->stub_sec->size;
|
stub_entry->stub_offset = stub_entry->group->stub_sec->size;
|
||||||
|
@ -3302,12 +3302,10 @@ aarch64_build_one_stub (struct bfd_hash_entry *gen_entry,
|
|||||||
section. The user should fix his linker script. */
|
section. The user should fix his linker script. */
|
||||||
if (stub_entry->target_section->output_section == NULL
|
if (stub_entry->target_section->output_section == NULL
|
||||||
&& info->non_contiguous_regions)
|
&& info->non_contiguous_regions)
|
||||||
{
|
info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
|
||||||
_bfd_error_handler (_("Could not assign '%pA' to an output section. "
|
"Retry without "
|
||||||
"Retry without --enable-non-contiguous-regions.\n"),
|
"--enable-non-contiguous-regions.\n"),
|
||||||
stub_entry->target_section);
|
stub_entry->target_section);
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
stub_sec = stub_entry->stub_sec;
|
stub_sec = stub_entry->stub_sec;
|
||||||
|
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
2020-03-18 Christophe Lyon <christophe.lyon@linaro.org>
|
||||||
|
|
||||||
|
* emultempl/xtensaelf.em: Emit a fatal error message
|
||||||
|
instead of calling abort.
|
||||||
|
* ldlang.c: Likewise.
|
||||||
|
|
||||||
2020-03-14 Alan Modra <amodra@gmail.com>
|
2020-03-14 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
* testsuite/ld-elf/non-contiguous.d: Don't xfail generic ELF
|
* testsuite/ld-elf/non-contiguous.d: Don't xfail generic ELF
|
||||||
|
@ -1225,10 +1225,8 @@ ld_build_required_section_dependence (lang_statement_union_type *s)
|
|||||||
lang_statement_union_type *l = iter_stack_current (&stack);
|
lang_statement_union_type *l = iter_stack_current (&stack);
|
||||||
|
|
||||||
if (l == NULL && link_info.non_contiguous_regions)
|
if (l == NULL && link_info.non_contiguous_regions)
|
||||||
{
|
einfo (_("%F%P: Relaxation not supported with "
|
||||||
einfo (_("Relaxation not supported with --enable-non-contiguous-regions.\n"));
|
"--enable-non-contiguous-regions.\n"));
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (l->header.type == lang_input_section_enum)
|
if (l->header.type == lang_input_section_enum)
|
||||||
{
|
{
|
||||||
|
20
ld/ldlang.c
20
ld/ldlang.c
@ -5220,21 +5220,15 @@ size_input_section
|
|||||||
if (dot + TO_ADDR (i->size) > end)
|
if (dot + TO_ADDR (i->size) > end)
|
||||||
{
|
{
|
||||||
if (i->flags & SEC_LINKER_CREATED)
|
if (i->flags & SEC_LINKER_CREATED)
|
||||||
{
|
einfo (_("%F%P: Output section '%s' not large enough for the "
|
||||||
einfo (_("Output section '%s' not large enough for the "
|
"linker-created stubs section '%s'.\n"),
|
||||||
"linker-created stubs section '%s'.\n"),
|
i->output_section->name, i->name);
|
||||||
i->output_section->name, i->name);
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i->rawsize && i->rawsize != i->size)
|
if (i->rawsize && i->rawsize != i->size)
|
||||||
{
|
einfo (_("%F%P: Relaxation not supported with "
|
||||||
einfo (_("Relaxation not supported with "
|
"--enable-non-contiguous-regions (section '%s' "
|
||||||
"--enable-non-contiguous-regions (section '%s' "
|
"would overflow '%s' after it changed size).\n"),
|
||||||
"would overflow '%s' after it changed size).\n"),
|
i->name, i->output_section->name);
|
||||||
i->name, i->output_section->name);
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
*removed = 1;
|
*removed = 1;
|
||||||
dot = end;
|
dot = end;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user