From c63d4862812c79d81b6423a847c9a288e49574a5 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 21 Dec 2022 16:06:55 +1030 Subject: enable-non-contiguous-regions warnings The warning about discarded sections in elf_link_input_bfd doesn't belong there since the code is dealing with symbols. Multiple symbols in a discarded section will result in multiple identical warnings about the section. Move the warning to a new function in ldlang.c. The patch also tidies the warning quoting of section and file names, consistently using `%pA' and `%pB'. I'm no stickler for one style of section and file name quoting, but they ought to be consistent within a warning, eg. see the first one fixed in ldlang.c, and when a warning is emitted for multiple targets they all ought to use exactly the same format string to reduce translation work. elf64-ppc.c loses the build_one_stub errors since we won't get there before hitting the fatal errors in size_one_stub. bfd/ * elflink.c (elf_link_input_bfd): Don't warn here about discarded sections. * elf32-arm.c (arm_build_one_stub): Use consistent style in --enable-non-contiguous-regions error. * 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. * elfnn-aarch64.c (aarch64_build_one_stub): Likewise. * xcofflink.c (xcoff_build_one_stub): Likewise. * elf64-ppc.c (ppc_size_one_stub): Likewise. (ppc_build_one_stub): Delete dead code. ld/ * ldlang.c (lang_add_section): Use consistent style in --enable-non-contiguous-regions warnings. (size_input_section): Likewise. (warn_non_contiguous_discards): New function. (lang_process): Call it. * testsuite/ld-arm/non-contiguous-arm.d: Update. * testsuite/ld-arm/non-contiguous-arm4.d: Update. * testsuite/ld-arm/non-contiguous-arm7.d: Add --enable-non-contiguous-regions-warnings. * testsuite/ld-arm/non-contiguous-arm7.err: New. * testsuite/ld-powerpc/non-contiguous-powerpc.d: Update. * testsuite/ld-powerpc/non-contiguous-powerpc64.d: Update. --- bfd/elf32-hppa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'bfd/elf32-hppa.c') diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 153a3ce11e1..82e7e0de80b 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -729,7 +729,7 @@ 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) - info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output " + info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output " "section. Retry without " "--enable-non-contiguous-regions.\n"), hsh->target_section); @@ -758,7 +758,7 @@ 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) - info->callbacks->einfo (_("%F%P: Could not assign %pA to an output " + info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output " "section. Retry without " "--enable-non-contiguous-regions.\n"), hsh->target_section); @@ -839,7 +839,7 @@ 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) - info->callbacks->einfo (_("%F%P: Could not assign %pA to an output " + info->callbacks->einfo (_("%F%P: Could not assign `%pA' to an output " "section. Retry without " "--enable-non-contiguous-regions.\n"), hsh->target_section); -- cgit v1.2.1