This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See crosstool-NG for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: replacing the default link-edit script


Trevor, All,

On Monday 04 March 2013 Trevor Woerner wrote:
> Let's say I'm building a toolchain that I expect to only be used to
> generate binaries for a given, specific, embedded board which isn't
> running Linux. Each time I use my cross-compiler to build my code I
> need to specify a "-T script.ld" option since the default script which
> is built into my cross-ld isn't going to be correct (it's going to
> assume a Linux environment).

Do you run another kind of 'kernel' on that board? If not, then this is
bare-metal, and you would probably have more luck using a bare-metal
toolchain.

> From what I can tell, unfortunately, this default Linux-based linker
> script is generated at build time, included in the source code, and
> built into the cross-ld application itself (I think it's called
> armelf.x, or something like that in the case when building a
> cross-compiler targeting an ARM processor).

Yes, the default linker-script is builtin, so you can not modify it.

> Does anyone know if there is a way to change this armelf.x script that
> is built into the cross-ld during the compile? Is there an elegant way
> to say "use this instead"? Failing that, is there a way to  set things
> up so that every time the cross-ld is called, it includes my "-T
> script.ld" option by default?
> 
> I guess one thing I could do is replace the cross-ld that would be
> found in the PATH with a wrapper script that calls the cross-ld with
> the "-T" option already setup. That's not a bad solution, but I was
> hoping for a better one, preferably the one where my script can become
> the built-in one.

I have never played with linker script, so take my advice with a grain of
salt...

I think in your case, a ld wrapper might be the best solution. Especially
if your linker script has paths in it: you could transparently re-generate
the linker script to point to the new paths each time it is needed.

Changing the default linker script needs to tweak the binutils sources
before building the toolchain, so might be a bit less convenient, unless
you are already fuent in binutils internals.

I'd personnaly opt for the ld wrapper...

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

--
For unsubscribe information see http://sourceware.org/lists.html#faq


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