LD

From OSDev.wiki
Revision as of 00:03, 15 January 2023 by osdev>Leapofazzam (→‎What about the LLVM Linker (ldd))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
This page is a stub.
You can help the wiki by accurately adding more contents to it.

GNU Linker

[[Image:{{{image}}}|300px|]]
Website:http://www.gnu.org/software/binutils/

The GNU Linker (executable named 'ld') is part of the binutils package. It is the standard linker under Linux and other Unix-like operating systems. It supports most input and output formats in existence (through the use of libbfd), and it is reportedly the most flexible of the listed linkers.

Features

  • Supports most known input formats (ELF, DJGPP/COFF, Win32/COFF, a.out, etc)
  • Supports most known output formats (ELF, Win32/PE, COFF, a.out etc).
  • Supports creation of shared libraries.
  • Provides full control over the generated output file, through the flexible Linker Script language.
  • Can create flat binary files.
  • Can specify code/data addresses, with separate load and execution addresses (vital for a higher half kernel).
  • Supports DWARF, ECOFF and STABS debugging information.
  • Free software under the GPL version 3.

Usage

ld does not create shared libraries by itself. You have to give the proper flags to the compiler so that it can generate position-independent code (note that this is talking about ELF shared libraries only).

ld is able to link while keeping relocations in your final object (called the 'incremental link'), and it also can leave unresolved symbols if instructed to do so.

You might also want to check out ar, a static-link library companion for ld.

What about the LLVM Linker (lld)

LLD is meant to be a drop-in replacement for LD (from the GNU binutils). You should decide which linker you want to support at the start of your project because switching linkers later could take a lot of effort and head scratches. In general, however, it should be perfectly fine to use. While it is faster, it generally has fewer options.

See Also

Articles

External Links