[Bug ld/31289] --fatal-warnings doesn't work for command-line options

2024-01-26 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=31289

--- Comment #6 from Sourceware Commits  ---
The master branch has been updated by H.J. Lu :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1b06334552f33015a6293571e9381d43dec3a5d3

commit 1b06334552f33015a6293571e9381d43dec3a5d3
Author: H.J. Lu 
Date:   Fri Jan 26 05:56:08 2024 -0800

elf: Rename is_standard_elf to uses_elf_em

Rename is_standard_elf to uses_elf_em for targets which use elf.em.

binutils/

PR ld/31289
* testsuite/lib/binutils-common.exp (is_standard_elf): Renamed
to ...
(uses_elf_em): This.

ld/

PR ld/31289
* testsuite/ld-elf/fatal-warnings-2a.d: Replace is_standard_elf
with uses_elf_em.
* testsuite/ld-elf/fatal-warnings-2b.d: Likewise.
* testsuite/ld-elf/fatal-warnings-3a.d: Likewise.
* testsuite/ld-elf/fatal-warnings-3b.d: Likewise.
* testsuite/ld-elf/fatal-warnings-4a.d: Likewise.
* testsuite/ld-elf/fatal-warnings-4b.d: Likewise.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/31289] --fatal-warnings doesn't work for command-line options

2024-01-25 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=31289

--- Comment #5 from Sourceware Commits  ---
The master branch has been updated by H.J. Lu :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=eb12b17047e25eac70ba32b79144216e86d3baa4

commit eb12b17047e25eac70ba32b79144216e86d3baa4
Author: H.J. Lu 
Date:   Thu Jan 25 10:08:04 2024 -0800

elf: Add is_standard_elf

PR ld/31289 tests failed for fr30-elf, frv-elf, ft32-elf, iq2000-elf,
mn10200-elf, ms1-elf and msp430-elf targets:

FAIL: ld-elf/fatal-warnings-2a
FAIL: ld-elf/fatal-warnings-2b
FAIL: ld-elf/fatal-warnings-3a
FAIL: ld-elf/fatal-warnings-3b
FAIL: ld-elf/fatal-warnings-4a
FAIL: ld-elf/fatal-warnings-4b

even though PR ld/31289 targets xfail for [is_generic] targets.  These
targets not only don't use the generic_link_hash_table linker, but also
don't use the standard ELF emulation.  Add is_standard_elf for ELF
targets which use the standard ELF emulation and replace [is_generic]
with ![is_standard_elf] in PR ld/31289 tests.

binutils/

PR ld/31289
* testsuite/lib/binutils-common.exp (is_standard_elf): New.

ld/

PR ld/31289
* testsuite/lib/binutils-common.exp (is_generic): Return 1 for
fr30-*-*, frv-*-elf, ft32-*-*, iq2000-*-*, mn10200-*-*,
moxie-*-moxiebox*, msp430-*-* and mt-*-*.
* testsuite/ld-elf/fatal-warnings-2a.d: Replace [is_generic]
with ![is_standard_elf].
* testsuite/ld-elf/fatal-warnings-2b.d: Likewise.
* testsuite/ld-elf/fatal-warnings-3a.d: Likewise.
* testsuite/ld-elf/fatal-warnings-3b.d: Likewise.
* testsuite/ld-elf/fatal-warnings-4a.d: Likewise.
* testsuite/ld-elf/fatal-warnings-4b.d: Likewise.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/31289] --fatal-warnings doesn't work for command-line options

2024-01-25 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=31289

--- Comment #4 from Sourceware Commits  ---
The master branch has been updated by H.J. Lu :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=624c610dd46ed441c349f4bd889f3416cf867fd5

commit 624c610dd46ed441c349f4bd889f3416cf867fd5
Author: H.J. Lu 
Date:   Thu Jan 25 07:39:05 2024 -0800

ld: Always call output_unknown_cmdline_warning

Call output_unknown_cmdline_warning if there are no input files so that

$ ld -z bad-option

reports

ld: warning: -z bad-option ignored
ld: no input files

instead of

ld: no input files

PR ld/31289
* ldmain.c (main): Call output_unknown_cmdline_warning if there
are no input files.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/31289] --fatal-warnings doesn't work for command-line options

2024-01-25 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=31289

H.J. Lu  changed:

   What|Removed |Added

   Target Milestone|--- |2.43
 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #3 from H.J. Lu  ---
Fixed for 2.43.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/31289] --fatal-warnings doesn't work for command-line options

2024-01-25 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=31289

--- Comment #2 from Sourceware Commits  ---
The master branch has been updated by H.J. Lu :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3eb33b8875a032678c375a76f689f928f57dfb15

commit 3eb33b8875a032678c375a76f689f928f57dfb15
Author: H.J. Lu 
Date:   Wed Jan 24 13:53:11 2024 -0800

ld: Improve --fatal-warnings for unknown command-line options

There are 2 problems with --fatal-warnings for unknown command-line
options:

1. --fatal-warnings doesn't trigger an error for an unknown command-line
option when --fatal-warnings is the last command-line option.
2. When --fatal-warnings triggers an error for an unknown command-line
option, the message says that the unknown command-line option is ignored.

This patch queues unknown command-line option warnings and outputs queued
command-line option warnings after all command-line options have been
processed so that --fatal-warnings can work for unknown command-line
options regardless of the order of --fatal-warnings.

When --fatal-warnings is used, the linker message is changed from

ld: warning: -z bad-option ignored

to

ld: error: unsupported option: -z bad-option

The above also applies to "-z dynamic-undefined-weak" when the known
"-z dynamic-undefined-weak" option is ignored.

PR ld/31289
* ldelf.c (ldelf_after_parse): Use queue_unknown_cmdline_warning
to warn the ignored -z dynamic-undefined-weak option.
* ldmain.c (main): Call output_unknown_cmdline_warnings after
calling ldemul_after_parse.
* ldmisc.c (CMDLINE_WARNING_SIZE): New.
(cmdline_warning_list): Likewise.
(cmdline_warning_head): Likewise.
(cmdline_warning_tail): Likewise.
(queue_unknown_cmdline_warning): Likewise.
(output_unknown_cmdline_warnings): Likewise.
* ldmisc.h (queue_unknown_cmdline_warning): Likewise.
(output_unknown_cmdline_warnings): Likewise.
* emultempl/elf.em (gld${EMULATION_NAME}_handle_option): Use
queue_unknown_cmdline_warning to warn unknown -z option.
* testsuite/ld-elf/fatal-warnings-1a.d: New file.
* testsuite/ld-elf/fatal-warnings-1b.d: Likewise.
* testsuite/ld-elf/fatal-warnings-2a.d: Likewise.
* testsuite/ld-elf/fatal-warnings-2b.d: Likewise.
* testsuite/ld-elf/fatal-warnings-3a.d: Likewise.
* testsuite/ld-elf/fatal-warnings-3b.d: Likewise.
* testsuite/ld-elf/fatal-warnings-4a.d: Likewise.
* testsuite/ld-elf/fatal-warnings-4b.d: Likewise.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/31289] --fatal-warnings doesn't work for command-line options

2024-01-24 Thread sam at gentoo dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=31289

Sam James  changed:

   What|Removed |Added

 CC||sam at gentoo dot org

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/31289] --fatal-warnings doesn't work for command-line options

2024-01-24 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=31289

--- Comment #1 from H.J. Lu  ---
Also it looks strange:

$ ld.bfd --fatal-warnings -z bad-option -e 0 /dev/null
ld.bfd: warning: -z bad-option ignored
$ echo $?
1

Why do we say "warning: -z bad-option ignored" when it is an error.

-- 
You are receiving this mail because:
You are on the CC list for the bug.