aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@linaro.org>2020-03-17 15:59:01 +0000
committerChristophe Lyon <christophe.lyon@linaro.org>2020-03-18 10:09:43 +0000
commit53215f214c61b850085196a8d69774eed026ecd9 (patch)
treece76a728bc37dea37feb8b6a5c25aecfda4da522 /bfd
parent5a82b8a12b6a9b8167517ab1df1dcdcc4711ffda (diff)
downloadgdb-53215f214c61b850085196a8d69774eed026ecd9.zip
gdb-53215f214c61b850085196a8d69774eed026ecd9.tar.gz
gdb-53215f214c61b850085196a8d69774eed026ecd9.tar.bz2
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
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog14
-rw-r--r--bfd/elf32-arm.c9
-rw-r--r--bfd/elf32-csky.c9
-rw-r--r--bfd/elf32-hppa.c32
-rw-r--r--bfd/elf32-m68hc11.c9
-rw-r--r--bfd/elf32-m68hc12.c9
-rw-r--r--bfd/elf32-metag.c9
-rw-r--r--bfd/elf32-nios2.c10
-rw-r--r--bfd/elf64-ppc.c44
-rw-r--r--bfd/elfnn-aarch64.c10
10 files changed, 67 insertions, 88 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index f690147..2780b76 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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>
PR 25688
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index e8b2ac4..1ccbf14 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -5068,12 +5068,9 @@ arm_build_one_stub (struct bfd_hash_entry *gen_entry,
section. The user should fix his linker script. */
if (stub_entry->target_section->output_section == NULL
&& info->non_contiguous_regions)
- {
- _bfd_error_handler (_("Could not assign '%pA' to an output section. "
- "Retry without --enable-non-contiguous-regions.\n"),
- stub_entry->target_section);
- abort();
- }
+ info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
+ "Retry without --enable-non-contiguous-regions.\n"),
+ stub_entry->target_section);
globals = elf32_arm_hash_table (info);
if (globals == NULL)
diff --git a/bfd/elf32-csky.c b/bfd/elf32-csky.c
index 8415f7c..06ea266 100644
--- a/bfd/elf32-csky.c
+++ b/bfd/elf32-csky.c
@@ -3625,12 +3625,9 @@ csky_build_one_stub (struct bfd_hash_entry *gen_entry,
section. The user should fix his linker script. */
if (stub_entry->target_section->output_section == NULL
&& info->non_contiguous_regions)
- {
- _bfd_error_handler (_("Could not assign '%pA' to an output section. "
- "Retry without --enable-non-contiguous-regions.\n"),
- stub_entry->target_section);
- abort();
- }
+ info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
+ "Retry without --enable-non-contiguous-regions.\n"),
+ stub_entry->target_section);
globals = csky_elf_hash_table (info);
if (globals == NULL)
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 9760b75..6d5382d 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -735,12 +735,10 @@ hppa_build_one_stub (struct bfd_hash_entry *bh, void *in_arg)
section. The user should fix his linker script. */
if (hsh->target_section->output_section == NULL
&& info->non_contiguous_regions)
- {
- _bfd_error_handler (_("Could not assign '%pA' to an output section. "
- "Retry without --enable-non-contiguous-regions.\n"),
- hsh->target_section);
- abort();
- }
+ info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output "
+ "section. Retry without "
+ "--enable-non-contiguous-regions.\n"),
+ hsh->target_section);
/* Create the long branch. A long branch is formed with "ldil"
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. */
if (hsh->target_section->output_section == NULL
&& info->non_contiguous_regions)
- {
- _bfd_error_handler (_("Could not assign %pA to an output section. "
- "Retry without --enable-non-contiguous-regions.\n"),
- hsh->target_section);
- abort();
- }
+ info->callbacks->einfo (_("%F%P: Could not assign %pA to an output "
+ "section. Retry without "
+ "--enable-non-contiguous-regions.\n"),
+ hsh->target_section);
+
/* Branches are relative. This is where we are going to. */
sym_value = (hsh->target_value
+ 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. */
if (hsh->target_section->output_section == NULL
&& info->non_contiguous_regions)
- {
- _bfd_error_handler (_("Could not assign %pA to an output section. "
- "Retry without --enable-non-contiguous-regions.\n"),
- hsh->target_section);
- abort();
- }
+ info->callbacks->einfo (_("%F%P: Could not assign %pA to an output "
+ "section. Retry without "
+ "--enable-non-contiguous-regions.\n"),
+ hsh->target_section);
+
/* Branches are relative. This is where we are going to. */
sym_value = (hsh->target_value
+ hsh->target_section->output_offset
diff --git a/bfd/elf32-m68hc11.c b/bfd/elf32-m68hc11.c
index 3e12ae5..46aa438 100644
--- a/bfd/elf32-m68hc11.c
+++ b/bfd/elf32-m68hc11.c
@@ -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. */
if (stub_entry->target_section->output_section == NULL
&& info->non_contiguous_regions)
- {
- _bfd_error_handler (_("Could not assign '%pA' to an output section. "
- "Retry without --enable-non-contiguous-regions.\n"),
- stub_entry->target_section);
- abort();
- }
+ info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
+ "Retry without --enable-non-contiguous-regions.\n"),
+ stub_entry->target_section);
htab = m68hc11_elf_hash_table (info);
if (htab == NULL)
diff --git a/bfd/elf32-m68hc12.c b/bfd/elf32-m68hc12.c
index a04efd8..c74f567 100644
--- a/bfd/elf32-m68hc12.c
+++ b/bfd/elf32-m68hc12.c
@@ -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. */
if (stub_entry->target_section->output_section == NULL
&& info->non_contiguous_regions)
- {
- _bfd_error_handler (_("Could not assign '%pA' to an output section. "
- "Retry without --enable-non-contiguous-regions.\n"),
- stub_entry->target_section);
- abort();
- }
+ info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
+ "Retry without --enable-non-contiguous-regions.\n"),
+ stub_entry->target_section);
htab = m68hc11_elf_hash_table (info);
diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c
index 3f30d6d..44923ed 100644
--- a/bfd/elf32-metag.c
+++ b/bfd/elf32-metag.c
@@ -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. */
if (hsh->target_section->output_section == NULL
&& info->non_contiguous_regions)
- {
- _bfd_error_handler (_("Could not assign '%pA' to an output section. "
- "Retry without --enable-non-contiguous-regions.\n"),
- hsh->target_section);
- abort();
- }
+ info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
+ "Retry without --enable-non-contiguous-regions.\n"),
+ hsh->target_section);
stub_sec = hsh->stub_sec;
diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c
index 8c8bc0c..bfb6fd1 100644
--- a/bfd/elf32-nios2.c
+++ b/bfd/elf32-nios2.c
@@ -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. */
if (hsh->target_section->output_section == NULL
&& info->non_contiguous_regions)
- {
- _bfd_error_handler (_("Could not assign '%pA' to an output section. "
- "Retry without --enable-non-contiguous-regions.\n"),
- hsh->target_section);
- abort();
- }
+ info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
+ "Retry without --enable-non-contiguous-regions.\n"),
+ hsh->target_section);
+
/* Make a note of the offset within the stubs for this entry. */
hsh->stub_offset = stub_sec->size;
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 83eaadf..7f7e190 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -11367,25 +11367,19 @@ ppc_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
if (stub_entry->target_section != NULL
&& stub_entry->target_section->output_section == NULL
&& info->non_contiguous_regions)
- {
- _bfd_error_handler (_("Could not assign '%pA' to an output section. "
- "Retry without --enable-non-contiguous-regions.\n"),
- stub_entry->target_section);
- abort();
- }
+ info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
+ "Retry without --enable-non-contiguous-regions.\n"),
+ stub_entry->target_section);
/* Same for the group. */
if (stub_entry->group->stub_sec != NULL
&& stub_entry->group->stub_sec->output_section == NULL
&& info->non_contiguous_regions)
- {
- _bfd_error_handler (_("Could not assign group %pA target %pA to an "
- "output section. Retry without "
- "--enable-non-contiguous-regions.\n"),
- stub_entry->group->stub_sec,
- stub_entry->target_section);
- abort();
- }
+ info->callbacks->einfo (_("%F%P: Could not assign group %pA target %pA to an "
+ "output section. Retry without "
+ "--enable-non-contiguous-regions.\n"),
+ stub_entry->group->stub_sec,
+ stub_entry->target_section);
htab = ppc_hash_table (info);
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
&& stub_entry->target_section->output_section == NULL
&& info->non_contiguous_regions)
- {
- _bfd_error_handler (_("Could not assign %pA to an output section. "
- "Retry without --enable-non-contiguous-regions.\n"),
- stub_entry->target_section);
- abort();
- }
+ info->callbacks->einfo (_("%F%P: Could not assign %pA to an output section. "
+ "Retry without --enable-non-contiguous-regions.\n"),
+ stub_entry->target_section);
/* Same for the group. */
if (stub_entry->group->stub_sec != NULL
&& stub_entry->group->stub_sec->output_section == NULL
&& info->non_contiguous_regions)
- {
- _bfd_error_handler (_("Could not assign group %pA target %pA to an "
- "output section. Retry without "
- "--enable-non-contiguous-regions.\n"),
- stub_entry->group->stub_sec,
- stub_entry->target_section);
- abort();
- }
+ info->callbacks->einfo (_("%F%P: Could not assign group %pA target %pA to an "
+ "output section. Retry without "
+ "--enable-non-contiguous-regions.\n"),
+ stub_entry->group->stub_sec,
+ stub_entry->target_section);
/* Make a note of the offset within the stubs for this entry. */
stub_entry->stub_offset = stub_entry->group->stub_sec->size;
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index b00b6c4..02688cc 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -3302,12 +3302,10 @@ aarch64_build_one_stub (struct bfd_hash_entry *gen_entry,
section. The user should fix his linker script. */
if (stub_entry->target_section->output_section == NULL
&& info->non_contiguous_regions)
- {
- _bfd_error_handler (_("Could not assign '%pA' to an output section. "
- "Retry without --enable-non-contiguous-regions.\n"),
- stub_entry->target_section);
- abort();
- }
+ info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. "
+ "Retry without "
+ "--enable-non-contiguous-regions.\n"),
+ stub_entry->target_section);
stub_sec = stub_entry->stub_sec;