简体   繁体   中英

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

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).

You can pass a custom linker script to ld :

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

or to gcc :

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM