This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: ld -o behaviour


   Ben Elliston <bje@redhat.com> writes:

      : ld behaves inconsistently with its `-o' option.  If I run:
      : 	ld foo.o -o foo.x  or
      : 	ld foo.o -ofoo.x
      : I get the same results.  If I run:
      : 	ld foo.o -omagic
      : ld names the output file `a.out' (as if no -o option was given at all).
      : Could it be that ld accepts -omagic is if it were --omagic?
   
      So the linker is being consistent, just a little unintuitive is all.
   
   One could argue this is a bug -- GCC passes the `-o' option given by a user
   on the command line straight to `ld', leading to the inconsistent behaviour
   I described.
   
   Accepting single dashed long arguments is probably wrong.  What was the
   justification?

Some arguments must be accepted with a single dash for backward
compatibility.  For example, gcc will invoke ld with a -shared option
on several platforms.  I don't know whether -omagic is there for
backward compatibility or not.

It would be OK to change the linker to require two dashes for some
long options.  Perhaps this could be done by invoking getopt_long_only
followed by getopt_long, or something.

I think it would be also OK to simply remove the -omagic option.  I
think it was only introduced so that -N would have a long option name.

Ian

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]