TrumanWong

ld

Concatenate object files into executable programs

Supplementary instructions

ld command is the GNU connector, which connects target files into executable programs.

grammar

ld(options)(parameters)
ld [options] objfile ...

Options

-o: Specify the output file name;
-e: Specifies the entry symbol of the program.

Parameters

Target file: Specify the target file to be connected.

Example

This tells ld to generate a file named output by linking the file /lib/crt0.o with hello.o and the library libc.a, which will come from the standard search directory.

ld -o <output> /lib/crt0.o hello.o -lc
ld -o output /lib/crt0.o hello.o -lc