public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Fangrui Song <i@maskray.me>
To: Nick Clifton <nickc@redhat.com>
Cc: Umesh Kalappa <umesh.kalappa0@gmail.com>,
	Binutils <binutils@sourceware.org>
Subject: Re: Linker diagnostics for the incorrect options .
Date: Tue, 22 Sep 2020 11:40:45 -0700	[thread overview]
Message-ID: <MWHPR12MB14566EEDAE69ABB732D8EAA8CB3B0@MWHPR12MB1456.namprd12.prod.outlook.com> (raw)
In-Reply-To: <fa5560b1-7122-1be5-8819-3b12c4c0daba@redhat.com>

On Tue, Sep 22, 2020 at 5:31 AM Nick Clifton via Binutils
<binutils@sourceware.org> wrote:
>
> 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
>

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 ':)'
:)

For newer long options, we should encourage EXACTLY_TWO_DASHES
(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.

  reply	other threads:[~2020-09-22 18:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-19  5:29 Umesh Kalappa
2020-09-22 12:31 ` Nick Clifton
2020-09-22 18:40   ` Fangrui Song [this message]
     [not found]   ` <MWHPR12MB14567F315D72755B1CC41210CB3B0@MWHPR12MB1456.namprd12.prod.outlook.com>
2020-09-23  9:31     ` Nick Clifton
2020-10-02  0:19       ` Fangrui Song
     [not found]       ` <MWHPR12MB145628F1D93CC392F9F8F1DECB310@MWHPR12MB1456.namprd12.prod.outlook.com>
2020-10-05 12:55         ` Nick Clifton
2020-12-11 10:25       ` Matthias Klose

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MWHPR12MB14566EEDAE69ABB732D8EAA8CB3B0@MWHPR12MB1456.namprd12.prod.outlook.com \
    --to=i@maskray.me \
    --cc=binutils@sourceware.org \
    --cc=nickc@redhat.com \
    --cc=umesh.kalappa0@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).