From: "H.J. Lu" <hjl.tools@gmail.com>
To: binutils@sourceware.org
Subject: [PATCH v2 0/2] ld: Output error for warnings with --fatal-warnings
Date: Fri, 26 Jan 2024 13:46:07 -0800 [thread overview]
Message-ID: <20240126214609.46554-1-hjl.tools@gmail.com> (raw)
Changes in v2:
1. Update the expected error in testsuite/ld-elf/fatal-warnings-5.d to
allow buffering.
2. Add --no-warn-execstack to testsuite/ld-scripts/defined7.d for targets
which check executable stack before checking multiple definition.
---
1. Since --fatal-warnings changes warnings into errors, we should output
error, instead of warning, for linker warnings.
Add %w to vfinfo to output "warning" if --fatal-warnings isn't used or
"error" otherwise. Replace warning with %w in linker warnings.
2. Update _bfd_error_handler to output the warning prefix, which is default
to "warning". Add %%w to _bfd_doprnt to output "error", instead of
"warning", when --fatal-warnings is used. Update bfd_set_error_handler
to allow linker to set the warning prefix to "error" for --fatal-warnings.
Call bfd_set_error_handler after parsing all linker command-line arguments
so that config.fatal_warnings will be set for --fatal-warnings.
H.J. Lu (2):
ld: Output error for linker warnings with --fatal-warnings
bfd: Output error for linker --fatal-warnings option
bfd/archive.c | 2 +-
bfd/bfd-in2.h | 3 +-
bfd/bfd.c | 34 +++-
bfd/binary.c | 2 +-
bfd/coff-arm.c | 14 +-
bfd/coff-go32.c | 2 +-
bfd/coff-mcore.c | 2 +-
bfd/coff-sh.c | 14 +-
bfd/coff-tic30.c | 2 +-
bfd/coff-tic4x.c | 2 +-
bfd/coff-tic54x.c | 2 +-
bfd/coff-z80.c | 2 +-
bfd/coff-z8k.c | 2 +-
bfd/coffcode.h | 26 +--
bfd/coffgen.c | 7 +-
bfd/cofflink.c | 6 +-
bfd/coffswap.h | 2 +-
bfd/cpu-arm.c | 2 +-
bfd/cpu-m68k.c | 2 +-
bfd/ecoff.c | 2 +-
bfd/elf-properties.c | 10 +-
bfd/elf-s390-common.c | 6 +-
bfd/elf.c | 24 +--
bfd/elf32-arc.c | 8 +-
bfd/elf32-arm.c | 44 ++---
bfd/elf32-bfin.c | 2 +-
bfd/elf32-csky.c | 8 +-
bfd/elf32-msp430.c | 2 +-
bfd/elf32-nds32.c | 18 +-
bfd/elf32-ppc.c | 6 +-
bfd/elf32-rl78.c | 2 +-
bfd/elf32-rx.c | 6 +-
bfd/elf32-score.c | 2 +-
bfd/elf32-score7.c | 2 +-
bfd/elf32-sh.c | 16 +-
bfd/elf32-spu.c | 6 +-
bfd/elf32-tic6x.c | 10 +-
bfd/elf32-v850.c | 14 +-
bfd/elf32-vax.c | 8 +-
bfd/elf64-alpha.c | 4 +-
bfd/elf64-ia64-vms.c | 8 +-
bfd/elf64-ppc.c | 12 +-
bfd/elfcode.h | 6 +-
bfd/elfcore.h | 2 +-
bfd/elflink.c | 36 ++--
bfd/elfnn-aarch64.c | 4 +-
bfd/elfnn-loongarch.c | 2 +-
bfd/elfnn-riscv.c | 10 +-
bfd/elfxx-aarch64.c | 4 +-
bfd/elfxx-mips.c | 34 ++--
bfd/elfxx-x86.c | 4 +-
bfd/format.c | 7 +-
bfd/mmo.c | 2 +-
bfd/xcofflink.c | 2 +-
ld/emultempl/aix.em | 24 +--
ld/emultempl/armelf.em | 4 +-
ld/emultempl/beos.em | 2 +-
ld/emultempl/m68hc1xelf.em | 2 +-
ld/emultempl/msp430.em | 4 +-
ld/emultempl/nto.em | 4 +-
ld/emultempl/pe.em | 18 +-
ld/emultempl/pep.em | 12 +-
ld/emultempl/xtensaelf.em | 6 +-
ld/ldelf.c | 20 +-
ld/ldelfgen.c | 6 +-
ld/ldexp.c | 2 +-
ld/ldlang.c | 44 ++---
ld/ldmain.c | 53 +++---
ld/ldmisc.c | 8 +-
ld/pdb.c | 246 ++++++++++++-------------
ld/pe-dll.c | 2 +-
ld/testsuite/ld-elf/fatal-warnings-5.d | 6 +
ld/testsuite/ld-elf/note-4.l | 2 +
ld/testsuite/ld-elf/shared.exp | 5 +
ld/testsuite/ld-i386/pr28894.d | 2 +-
ld/testsuite/ld-i386/warn1.d | 2 +-
ld/testsuite/ld-scripts/defined.exp | 1 +
ld/testsuite/ld-scripts/defined7.d | 3 +
78 files changed, 493 insertions(+), 446 deletions(-)
create mode 100644 ld/testsuite/ld-elf/fatal-warnings-5.d
create mode 100644 ld/testsuite/ld-elf/note-4.l
create mode 100644 ld/testsuite/ld-scripts/defined7.d
--
2.43.0
next reply other threads:[~2024-01-26 21:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-26 21:46 H.J. Lu [this message]
2024-01-26 21:46 ` [PATCH v2 1/2] ld: Output error for linker " H.J. Lu
2024-01-26 21:46 ` [PATCH v2 2/2] bfd: Output error for linker --fatal-warnings option H.J. Lu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240126214609.46554-1-hjl.tools@gmail.com \
--to=hjl.tools@gmail.com \
--cc=binutils@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).