This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: The bad EXACTLY_TWO_DASHES change
- To: hjl at valinux dot com
- Subject: Re: The bad EXACTLY_TWO_DASHES change
- From: Nick Clifton <nickc at redhat dot com>
- Date: Sun, 31 Dec 2000 11:59:43 -0800
- CC: binutils at sourceware dot cygnus dot com
Hi H.J.
: I don't think your EXACTLY_TWO_DASHES change works:
:
: # ./ld-new -oformat srec
: ./ld-new: cannot open srec: No such file or directory
: # ./ld-new --oformat srec
: ./ld-new: unrecognized option `--oformat'
: ./ld-new: use the --help option for usage information
:
: Have you tried "make check" in ld on Linux/ia32?
*sigh* No.
You are right of course, I was not checking for the correct return
value from getopt_long(). I have applied the patch below to fix this,
and this time I ran make check first. It turns out that there are
still two failures:
FAIL: cdtest
FAIL: cdtest with -Ur
I do not recognise these, but I do not think that they are connected
to the EXACTLY_TWO_DASHSES patch.
Cheers
Nick
2000-12-31 Nick Clifton <nickc@redhat.com>
* lexsup.c (parse_args): Set opterr to 0 and detect unparsed long
options by checking for a return value of '?' not -1.
Index: lexsup.c
===================================================================
RCS file: /cvs/src//src/ld/lexsup.c,v
retrieving revision 1.25
diff -p -r1.25 lexsup.c
*** lexsup.c 2000/12/28 19:54:33 1.25
--- lexsup.c 2000/12/31 19:54:22
*************** parse_args (argc, argv)
*** 543,556 ****
/* getopt_long_only is like getopt_long, but '-' as well as '--'
can indicate a long option. */
optc = getopt_long_only (argc, argv, shortopts, longopts, &longind);
! if (optc == -1)
! optc = getopt_long (argc, argv, shortopts, really_longopts, &longind);
!
if (optc == -1)
break;
switch (optc)
{
default:
fprintf (stderr,
_("%s: use the --help option for usage information\n"),
--- 543,564 ----
/* getopt_long_only is like getopt_long, but '-' as well as '--'
can indicate a long option. */
+ opterr = 0;
optc = getopt_long_only (argc, argv, shortopts, longopts, &longind);
! if (optc == '?')
! {
! --optind;
! optc = getopt_long (argc, argv, shortopts, really_longopts, &longind);
! }
!
if (optc == -1)
break;
+
switch (optc)
{
+ case '?':
+ fprintf (stderr, _("%s: unrecognized option '%s'\n"),
+ program_name, argv[optind - 1]);
default:
fprintf (stderr,
_("%s: use the --help option for usage information\n"),
2000-12-31 Nick Clifton <nickc@redhat.com>
* ld-srec/srec.exp: Use --oformat instead of -oformat.
Index: testsuite/ld-srec/srec.exp
===================================================================
RCS file: /cvs/src//src/ld/testsuite/ld-srec/srec.exp,v
retrieving revision 1.5
diff -p -r1.5 srec.exp
*** srec.exp 2000/12/09 20:24:34 1.5
--- srec.exp 2000/12/31 19:54:22
*************** proc run_srec_test { test objs } {
*** 237,243 ****
set flags "$flags --defsym __gccmain=0"
# ARM targets cannot convert format in the linker
! # using the -oformat command line switch
setup_xfail "*arm*-*-*"
setup_xfail "xscale-*-*"
setup_xfail "thumb-*-*"
--- 237,243 ----
set flags "$flags --defsym __gccmain=0"
# ARM targets cannot convert format in the linker
! # using the --oformat command line switch
setup_xfail "*arm*-*-*"
setup_xfail "xscale-*-*"
setup_xfail "thumb-*-*"
*************** proc run_srec_test { test objs } {
*** 259,265 ****
}
if { ![ld_simple_link $ld tmpdir/sr1 "$flags $objs"] \
! || ![ld_simple_link $ld tmpdir/sr2.sr "$flags -oformat srec $objs"] } {
setup_xfail "hppa*-*-*elf*"
fail $test
return
--- 259,265 ----
}
if { ![ld_simple_link $ld tmpdir/sr1 "$flags $objs"] \
! || ![ld_simple_link $ld tmpdir/sr2.sr "$flags --oformat srec $objs"] } {
setup_xfail "hppa*-*-*elf*"
fail $test
return