Name

ld

Synopsis

ld [options] objfiles

Description

Combine several objfiles, in the specified order, into a single executable object module (a.out by default). ld is the link editor and is often invoked automatically by compiler commands.

Options

-c file

Consult file for commands.

-d, -dc, -dp

Force the assignment of space to common symbols.

-defsym symbol=expression

Create the global symbol with the value expression.

-e symbol

Set symbol as the address of the output file’s entry point.

-i

Produce a linkable output file; attempt to set its magic number to OMAGIC.

-l arch

Include the archive file arch in the list of files to link.

-m linker

Emulate linker.

-n

Make text read-only; attempt to set NMAGIC.

-noinhibit-exec

Produce output file even if errors are encountered.

-o output

Place output in output, instead of a.out.

-oformat format

Specify output format.

-r

Produce a linkable output file; attempt to set its magic number to OMAGIC.

-s

Do not include any symbol information in output.

-shared

Create a shared library.

-sort-common

Do not sort global common symbols by size.

-t

Announce each input file’s name as it is processed.

-u symbol

Force symbol to be undefined.

-v, --version

Show version number.

--verbose

Print information about ld; print the names of input files while attempting to open them.

-warn-common

Warn when encountering common symbols combined with other constructs.

-warn-once

Provide only one warning per undefined symbol.

-x

With -s or -S, delete all local symbols that ...

Get Linux in a Nutshell, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.