Ian Lance Taylor
Fri Aug 12 03:43:00 GMT 2005

John Pierce <> writes:

> Could someone help me to understand what ldscripts are exactly,

Linker scripts are documented here:
(I wrote the current version of the linker script docs, so I think
they are OK, but I'm sure they could use some improvement.)

> how they relate to ldconfig (, is completely different, and has nothing whatsoever to do
with linker scripts. is documented, more or less, in the
ldconfig man page.

> I have built an x86_64 single lib system and in my
> ldscripts dir there are 386 scripts. I want to remove those scripts
> leaving the x86_64 scripts.

Go ahead.  At worst you will be unable to link 386 code, but I assume
you are prepared for that eventuality.

> This is the first part of this particular script.
> elf_x86_64.x:
> OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64",
>              "elf64-x86-64")
> OUTPUT_ARCH(i386:x86-64)
> ENTRY(_start)
> SEARCH_DIR("/usr/x86_64-pc-linux-gnu/lib64");
> SEARCH_DIR("/usr/local/lib64"); SEARCH_DIR("/lib64");
> SEARCH_DIR("/usr/lib64"); SEARCH_DIR("/usr/x86_64-pc-linux-gnu/lib");
> SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib");
> SEARCH_DIR("/usr/lib");
> Why does the OUTPUT_FORMAT have three of "elf64-x86-64"?

The targets are the ones used for default endianness, explicit
big-endian, explicit little-endian, respectively.  Of course x86-64 is
always little endian so in this case the same format is used in all

> Can I remove i386 from the OUTPUT_ARCH?


> When I built my 64bit libs I put them in the lib usr/lib directories,
> can I remove these paths from the SEARCH_DIR's?

Which ones do you want to remove?  You can certainly remove SEARCH_DIR
entries which names directories in which there are no files.

> Why are there so many different scripts for each arch?
> elf_i386.x elf_i386.xbn elf_i386.xc elf_i386.xd elf_i386.xdc
> elf_i386.xdw elf_i386.xn elf_i386.xr elf_i386.xs elf_i386.xsc
> elf_i386.xsw elf_i386.xu elf_i386.xw
> elf_x86_64.x elf_x86_64.xc elf_x86_64.xdc elf_x86_64.xn elf_x86_64.xs
> elf_x86_64.xsw elf_x86_64.xw elf_x86_64.xbn elf_x86_64.xd
> elf_x86_64.xdw elf_x86_64.xr elf_x86_64.xsc elf_x86_64.xu

They are used for different combinations of flags.  if you want to see
the different cases, see ld/ in the source code.

> And are these a.out?
> i386linux.x  i386linux.xbn  i386linux.xn  i386linux.xr  i386linux.xu

Yes, those are used for a.out.


More information about the Binutils mailing list