diff options
author | Nick Clifton <nickc@redhat.com> | 2020-10-05 13:53:59 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2020-10-05 13:53:59 +0100 |
commit | 983d925db6a09ac90f6bed90be16eb69267b58e0 (patch) | |
tree | f5550df2dfb0326b84a4aed315f657e4f236fad8 /ld | |
parent | cd096ec85fb3aedf5cf9c3c116a7deab2ee0d388 (diff) | |
download | fsf-binutils-gdb-983d925db6a09ac90f6bed90be16eb69267b58e0.zip fsf-binutils-gdb-983d925db6a09ac90f6bed90be16eb69267b58e0.tar.gz fsf-binutils-gdb-983d925db6a09ac90f6bed90be16eb69267b58e0.tar.bz2 |
Update the BFD linker so that it deprecates grouped short options.
* lexsup.c (parse_args): Generate an error or warning message when
multiple short options are used together.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 5 | ||||
-rw-r--r-- | ld/lexsup.c | 14 |
2 files changed, 19 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index a6beac0..0d5953a 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2020-10-05 Nick Clifton <nickc@redhat.com> + + * lexsup.c (parse_args): Generate an error or warning message when + multiple short options are used together. + 2020-10-01 H.J. Lu <hongjiu.lu@intel.com> PR 26681 diff --git a/ld/lexsup.c b/ld/lexsup.c index b8f0667..6894399 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -735,6 +735,20 @@ parse_args (unsigned argc, char **argv) optind = last_optind; optc = getopt_long (argc, argv, "-", really_longopts, &longind); } + /* Attempt to detect grouped short options, eg: "-non-start". + Accepting such options is error prone as it is not clear if the user + intended "-n -o n-start" or "--non-start". */ + else if (longind == 0 /* This is a short option. */ + && optc > 32 /* It is a valid option. */ + /* The character is not the second character of argv[last_optind]. */ + && optc != argv[last_optind][1]) + { + if (optarg) + einfo (_("%F%P: Error: unable to disambiguate: %s (did you mean -%s ?)\n"), + argv[last_optind], argv[last_optind]); + else + einfo (_("%P: Warning: grouped short command line options are deprecated: %s\n"), argv[last_optind]); + } if (ldemul_handle_option (optc)) continue; |