https://sourceware.org/bugzilla/show_bug.cgi?id=31289

--- Comment #2 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <h...@sourceware.org>:

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

commit 3eb33b8875a032678c375a76f689f928f57dfb15
Author: H.J. Lu <hjl.to...@gmail.com>
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.

Reply via email to