Subject: Re: Questions about linker scripts in /usr/share/ldscripts
To: None <port-arm32@netbsd.org, pbecke@javagear.com>
From: Ben Harris <bjh21@cam.ac.uk>
List: port-arm32
Date: 05/19/2000 14:43:29
In article <39253D3B.9B58C43@javagear.com> you write:
>I have been trying to cross compile code for an arm processor on an
>i386netbsd platform.  The linker seems to need a set of scripts such as
>armnbsd.x, armnbsd.xr, armnbsd.xbn, armnbsd.xu and armnbsd.xn.  There
>are similar scripts in the /usr/share/ldscripts directory.  My questions
>are:
>What is the significance of the different extensions .x , .xr, .xbn,
>.xu, .xn?

From ldint.texinfo:

@item (empty)
The script generated is used by default (when none of the following
cases apply).  The output has an extension of @file{.x}.
@item n
The script generated is used when the linker is invoked with the
@code{-n} option.  The output has an extension of @file{.xn}.
@item N
The script generated is used when the linker is invoked with the
@code{-N} option.  The output has an extension of @file{.xbn}.
@item r
The script generated is used when the linker is invoked with the
@code{-r} option.  The output has an extension of @file{.xr}.
@item u
The script generated is used when the linker is invoked with the
@code{-Ur} option.  The output has an extension of @file{.xu}.

>How does the linker know about these files?

ISTR they get compiled into it at build time, and it can also look in the
"-L" directories passed to it on the command-line (plus the default ones) if
it needs one that wasn't compiled in.

>How does gcc pass information on to the linker so that it chooses one of
>the files and not another?

The -n, -N, -r and -Ur options.

>Are parameters passed by some environment variable?

The linker looks at some environment variables, but I don't think the
compiler uses them.

-- 
Ben Harris