Linker diagnostics for the incorrect options .

Fangrui Song i@maskray.me
Fri Oct 2 00:19:33 GMT 2020


On Wed, Sep 23, 2020 at 2:31 AM Nick Clifton <nickc@redhat.com> wrote:
>
> Hi Fangrui,
>
> > This is a conflict between the grouped short options syntax and single
> > dash prefixed long options.
> >
> > % touch an ommand ':)'
> > % ld.bfd -you -can -ofcourse -use -this -Long -command -Line ':)'
> > :)
>
> he!
>
> > For newer long options, we should encourage EXACTLY_TWO_DASHES
>
> Definitely.
>
> > (ld/lexsup.c). I have not seen grouped short options in a very large
> > code base and FreeBSD.
> > Maybe we can deprecate grouped short options syntax for ld.
>
> I like this idea.  How about the attached patch ?  With it applied I
> get output like this:
>
>   % ld -vn -non-static -e 0 -v -e2 hello.o
>   GNU ld (GNU Binutils) 2.35.50.20200923
>   ld: Warning: grouped short command line options are deprecated: -vn
>   ld: Error: unable to disambiguate: -non-static (did you mean --non-static ?)
>
>   % echo $?
>   1
>
> Cheers
>   Nick

Thanks! Perhaps    ` && optind != last_optind /* It is not a repeat of
the previous option.  */` can be deleted... Nobody repeats a short
option for ld,
unless they want to have fun with:

% Debug/ld/ld-new -vvvvvv
GNU ld (GNU Binutils) 2.35.50.20201002
GNU ld (GNU Binutils) 2.35.50.20201002
GNU ld (GNU Binutils) 2.35.50.20201002
GNU ld (GNU Binutils) 2.35.50.20201002
GNU ld (GNU Binutils) 2.35.50.20201002
GNU ld (GNU Binutils) 2.35.50.20201002


More information about the Binutils mailing list