Linker diagnostics for the incorrect options .
Nick Clifton
nickc@redhat.com
Tue Sep 22 12:31:01 GMT 2020
Hi Umesh,
> Linker error handling for non options or incorrect options should be
> robust for instance like
> $gcc -c test.c
> $ld -non-static test.o
>
> The linker interpretation for "-n" as a standard option for nmagic ,then
> "o" as output filename by name "n-static" which is the dynamic executable .
This is really a feature of the getopt functions provided by the libiberty
library. Note that the correct behaviour does happen if you use two dashes
instead of one:
% ld --non-static test.o
ld: unrecognized option '--non-static'
ld: use the --help option for usage information
Essentially this is a user education issue. Long options should be proceeded
by double dashes. Single dashes may work, sometimes, but weird effects can
also occur.
Cheers
Nick
More information about the Binutils
mailing list