replacing the default linker script

Ian Lance Taylor
Wed Mar 6 19:31:00 GMT 2013

On Wed, Mar 6, 2013 at 10:52 AM, Trevor Woerner <> wrote:
> While I can find lots of people asking:
> 1. how to get ld to print the script it is using?
> 2. how do I provide my own script?
> 3. does -T replace or supplant the default script?
> I can't seem to find any information on how feasible it would be to
> provide my script to ld while it is being built so that it'll use my
> script as the default so I don't have to provide it with the -T option
> on every invocation.
> Let's say I am putting together my own cross-development tools to
> target a specific device, it would be nice if I could provide my
> linker script in some way so that it could become the default script
> that is used by my cross-ld tool.

It's a bit painful because you have to provide multiple scripts that
are used depending on the command line options.  The existing scripts
are in ld/scripttempl.  They are conditioned by files in
ld/emulparams.  There is no documentation.

> When my cross-development tools are installed, I did notice that
> there's a TARGET/sysroot/lib/ldscripts directory that gets created. In
> my case it contains:


> I was hoping that if I replaced one of them with my script that the
> new script would get used by default. But that doesn't seem to be the
> case.

No, it doesn't work that way.  The default script is compiled into the
linker so that it doesn't have to waste time opening a file.  The
presence of the default scripts in the file system is, essentially,


More information about the Binutils mailing list