Error: unable to disambiguate: -nostartfiles

Nick Clifton nickc@redhat.com
Wed Jun 2 10:06:12 GMT 2021


Hi Alexander,

> Now the compilation run into following error
> 
> LD: nuttx
> arm-none-eabi-ld: Error: unable to disambiguate: -nostartfiles (did
> you mean --nostartfiles ?)

> As I understand -nostartfiles should be a valid flag. Why is it not
> recognized?

The -nostartfiles option is a gcc command line option, not a linker
command line option.  It is used when gcc is creating an executable
binary and it tells gcc not to include the standard system files
(eg crt1.o, crtbegin.o, crtend.o etc) when gcc invokes the linker.

All of which means that in your build system somewhere you have:

   arm-none-eabi-ld -nostartfiles ...

whereas you probably meant to have:

   arm-none-eabi-gcc -nostartfiles ...

Note: the reason why this problem has appeared when you upgraded is
that we recently added some extra error checking to the linker to
attempt to detect mis-spelt command line options.  In particular the
linker interprets options that start with a single dash as if they
were multiple, single letter options.  So "-nostartfiles" would be
treated as "-n" "-o startfiles" which is probably not what the user
wanted.  Hence the error message.

Plus, just to be clear, the linker does not support a --nostartfiles
option.  The code that generates the error message does not actually
check to see if the double dash version of the option exists...

Cheers
   Nick





More information about the Binutils mailing list