[PATCH] ld: Improve --fatal-warnings for unknown command-line options

H.J. Lu hjl.tools@gmail.com
Thu Jan 25 15:45:11 GMT 2024


On Thu, Jan 25, 2024 at 5:41 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Thu, Jan 25, 2024 at 3:32 AM Nick Clifton <nickc@redhat.com> wrote:
> >
> > Hi H.J.
> >
> >    Thanks for taking this problem on.  When I qrote my RFC I had
> >    not expected anyone to care that much...
> >
> > >>> 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.
> >
> > Patch approved - with the change suggested by Fangrui:
>
> Here is the patch I am checking.  I renamed pr31289-*.d to
> fatal-warnings-*.d.
>

Need this patch:

https://sourceware.org/pipermail/binutils/2024-January/132126.html

to make ld to report

$ ld -z bad-option

reports

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

instead of

ld: no input files


-- 
H.J.


More information about the Binutils mailing list