This is the mail archive of the
mailing list for the binutils project.
Re: [msp430-elf] Unexpected behavior with -nostdlib
- From: Nick Clifton <nickc at redhat dot com>
- To: Orlando Arias <orlandoarias at gmail dot com>, binutils at sourceware dot org
- Date: Wed, 15 Feb 2017 11:29:25 +0000
- Subject: Re: [msp430-elf] Unexpected behavior with -nostdlib
- Authentication-results: sourceware.org; auth=none
- References: <firstname.lastname@example.org>
> When passing -nostdlib to the linker command, the default/simulator
> linker script is used instead of the MCU specific linker script as
> specified in the parameter list with the -mmcu flag.
This is actually intended, albeit poorly documented, behaviour.
First of all, this is a gcc problem, not a binutils problem. At issue
here is the compiler driver program (called gcc) which is responsible
for invoking the compiler proper (cc1), the assembler and the linker.
It is this program which sees the -nostdlib command line option and
decides to discard the linker command line option that selects the MCU
specific linker script.
> I am able to override the behavior using the proper -Wl,-T commands to
> force the utilization of a linker script, but this seems less than
True - but the intention is that if you are using -nostdlib, then you must
know what you are doing *and* that you want total control over which libraries,
start-up files and linker scripts are used to create your application. Hence
-nostdlib disables the automatic linker script selection and you must use
-Wl,-T to select your own.