ld - linker

时间:2021-12-15 12:04:09

ld - linker

NAME

ld -- linker

SYNOPSIS

ld files...  [options] [-o outputfile]

DESCRIPTION

The ld command combines several object files and libraries, resolves references, and produces an

ouput file.  ld can produce a final linked image (executable, dylib, or bundle), or with the -r

option, produce another object file.  If the -o option is not used, the output file produced is

named "a.out".

Universal

       The linker accepts universal (multiple-architecture) input files, but always creates a "thin"

(single-architecture), standard Mach-O output file.  The architecture for the output file is spec-

     ified using the -arch option.  If this option is not used, ld attempts to determine the output

architecture by examining the object files in command line order.  The first "thin" architecture

determines that of the output file.  If no input object file is a "thin" file, the native 32-bit

architecture for the host is used.

       Usually, ld is not used directly.  Instead the gcc(1) compiler driver invokes ld. The compiler

driver can be passed multiple -arch options and it will create a universal final linked image by

invoking ld multiple times and then running lipo(1) merge the outputs into a universal file.

to be continue ...