laertis
laertis

Reputation: 8457

How to compile ld with custom linker scripts?

i am trying to build a custom version of the linux kernel 3.8 and i want my linker to behave a bit different so i changed its ldscripts. Specifically I configure binutils -> make -> change ldscripts -> make install. However when i try to compile libc using my linker the only thing i see is this :

GNU ld (GNU Binutils) 2.23
  Supported emulations:
   elf32_sparc
   sparclinux
   elf64_sparc
   sun4
using internal linker script:
==================================================
/* Script for --shared -z combreloc: shared library, combine & sort relocs */

etc

The thing is that i have changed my ldscripts and prepended a tag at the beginning of each script in order to recognize them but my compiler does not seem to care. However i don't have any other elf scripts in my system so the option of searching the wrong library path is not actually an option.

Is there something i am missing here?

Notice that i am cross compiling for sparc

Upvotes: 2

Views: 3742

Answers (2)

bebbo
bebbo

Reputation: 2939

You can pass a custom linker script to ld:

ld -T <path/to/file> ...

or to gcc:

gcc -Wl,-T,<path/tofile> ...

Upvotes: 1

Michael Pankov
Michael Pankov

Reputation: 3701

Default ld scripts get compiled into compiler driver (gcc) so you should at least rebuild the toolchain.

That's also probably the case that gcc will not look at any linker scripts other than built into it, so you'll have to modify them in toolchain (it's probably in spec files somewhere).

Upvotes: 0

Related Questions