<s>
In	O
computing	O
,	O
a	O
linker	O
or	O
link	O
editor	O
is	O
a	O
computer	O
system	B-Application
program	I-Application
that	O
takes	O
one	O
or	O
more	O
object	B-Application
files	I-Application
(	O
generated	O
by	O
a	O
compiler	B-Language
or	O
an	O
assembler	B-Application
)	O
and	O
combines	O
them	O
into	O
a	O
single	O
executable	B-Application
file	I-Application
,	O
library	B-Library
file	O
,	O
or	O
another	O
"	O
object	O
"	O
file	O
.	O
</s>
<s>
A	O
simpler	O
version	O
that	O
writes	O
its	O
output	B-General_Concept
directly	O
to	O
memory	B-General_Concept
is	O
called	O
the	O
loader	B-Operating_System
,	O
though	O
loading	B-Operating_System
is	O
typically	O
considered	O
a	O
separate	O
process	O
.	O
</s>
<s>
Computer	O
programs	O
typically	O
are	O
composed	O
of	O
several	O
parts	O
or	O
modules	O
;	O
these	O
parts/modules	O
do	O
not	O
need	O
to	O
be	O
contained	B-General_Concept
within	O
a	O
single	O
object	B-Application
file	I-Application
,	O
and	O
in	O
such	O
cases	O
refer	O
to	O
each	O
other	O
by	O
means	O
of	O
symbols	O
as	O
addresses	O
into	O
other	O
modules	O
,	O
which	O
are	O
mapped	O
into	O
memory	B-General_Concept
addresses	O
when	O
linked	O
for	O
execution	O
.	O
</s>
<s>
Among	O
these	O
reasons	O
are	O
the	O
ease	O
of	O
organizing	O
several	O
smaller	O
pieces	O
over	O
a	O
monolithic	O
whole	O
and	O
the	O
ability	O
to	O
better	O
define	O
the	O
purpose	O
and	O
responsibilities	O
of	O
each	O
individual	O
piece	O
,	O
which	O
is	O
essential	O
for	O
managing	O
complexity	O
and	O
increasing	O
long-term	O
maintainability	O
in	O
software	B-Architecture
architecture	I-Architecture
.	O
</s>
<s>
Typically	O
,	O
an	O
object	B-Application
file	I-Application
can	O
contain	O
three	O
kinds	O
of	O
symbols	O
:	O
</s>
<s>
local	O
symbols	O
,	O
used	O
internally	O
within	O
the	O
object	B-Application
file	I-Application
to	O
facilitate	O
relocation	B-Library
.	O
</s>
<s>
For	O
most	O
compilers	B-Language
,	O
each	O
object	B-Application
file	I-Application
is	O
the	O
result	O
of	O
compiling	B-Language
one	O
input	O
source	O
code	O
file	O
.	O
</s>
<s>
When	O
a	O
program	O
comprises	O
multiple	O
object	B-Application
files	I-Application
,	O
the	O
linker	O
combines	O
these	O
files	O
into	O
a	O
unified	O
executable	B-Application
program	I-Application
,	O
resolving	O
the	O
symbols	O
as	O
it	O
goes	O
along	O
.	O
</s>
<s>
Linkers	O
can	O
take	O
objects	O
from	O
a	O
collection	O
called	O
a	O
library	B-Library
or	O
runtime	B-Library
library	I-Library
.	O
</s>
<s>
Most	O
linkers	O
do	O
not	O
include	O
the	O
whole	O
library	B-Library
in	O
the	O
output	B-General_Concept
;	O
they	O
include	O
only	O
the	O
files	O
that	O
are	O
referenced	O
by	O
other	O
object	B-Application
files	I-Application
or	O
libraries	O
.	O
</s>
<s>
Library	B-Library
linking	I-Library
may	O
thus	O
be	O
an	O
iterative	O
process	O
,	O
with	O
some	O
referenced	O
modules	O
requiring	O
additional	O
modules	O
to	O
be	O
linked	O
,	O
and	O
so	O
on	O
.	O
</s>
<s>
Libraries	O
exist	O
for	O
diverse	O
purposes	O
,	O
and	O
one	O
or	O
more	O
system	B-Library
libraries	I-Library
are	O
usually	O
linked	O
in	O
by	O
default	O
.	O
</s>
<s>
The	O
linker	O
also	O
takes	O
care	O
of	O
arranging	O
the	O
objects	O
in	O
a	O
program	O
's	O
address	B-General_Concept
space	I-General_Concept
.	O
</s>
<s>
This	O
may	O
involve	O
relocating	O
code	O
that	O
assumes	O
a	O
specific	O
base	B-General_Concept
address	I-General_Concept
into	O
another	O
base	O
.	O
</s>
<s>
Since	O
a	O
compiler	B-Language
seldom	O
knows	O
where	O
an	O
object	O
will	O
reside	O
,	O
it	O
often	O
assumes	O
a	O
fixed	O
base	O
location	O
(	O
for	O
example	O
,	O
zero	B-General_Concept
)	O
.	O
</s>
<s>
The	O
executable	B-Application
output	B-General_Concept
by	O
the	O
linker	O
may	O
need	O
another	O
relocation	B-Library
pass	O
when	O
it	O
is	O
finally	O
loaded	O
into	O
memory	B-General_Concept
(	O
just	O
before	O
execution	O
)	O
.	O
</s>
<s>
This	O
pass	O
is	O
usually	O
omitted	O
on	O
hardware	B-Architecture
offering	O
virtual	B-Architecture
memory	I-Architecture
:	O
every	O
program	O
is	O
put	O
into	O
its	O
own	O
address	B-General_Concept
space	I-General_Concept
,	O
so	O
there	O
is	O
no	O
conflict	O
even	O
if	O
all	O
programs	O
load	O
at	O
the	O
same	O
base	B-General_Concept
address	I-General_Concept
.	O
</s>
<s>
This	O
pass	O
may	O
also	O
be	O
omitted	O
if	O
the	O
executable	B-Application
is	O
a	O
position	B-Operating_System
independent	I-Operating_System
executable	I-Operating_System
.	O
</s>
<s>
On	O
some	O
Unix	B-Application
variants	O
,	O
such	O
as	O
SINTRAN	O
III	O
,	O
the	O
process	O
performed	O
by	O
a	O
linker	O
(	O
assembling	O
object	B-Application
files	I-Application
into	O
a	O
program	O
)	O
was	O
called	O
loading	B-Operating_System
(	O
as	O
in	O
loading	B-Operating_System
executable	B-Application
code	I-Application
onto	O
a	O
file	O
)	O
.	O
</s>
<s>
Additionally	O
,	O
in	O
some	O
operating	B-General_Concept
systems	I-General_Concept
,	O
the	O
same	O
program	O
handles	O
both	O
the	O
jobs	O
of	O
linking	O
and	O
loading	B-Operating_System
a	O
program	O
(	O
dynamic	B-Application
linking	I-Application
)	O
.	O
</s>
<s>
Many	O
operating	B-General_Concept
system	I-General_Concept
environments	O
allow	O
dynamic	B-Application
linking	I-Application
,	O
deferring	O
the	O
resolution	O
of	O
some	O
undefined	O
symbols	O
until	O
a	O
program	O
is	O
run	O
.	O
</s>
<s>
That	O
means	O
that	O
the	O
executable	B-Application
code	I-Application
still	O
contains	O
undefined	O
symbols	O
,	O
plus	O
a	O
list	O
of	O
objects	O
or	O
libraries	O
that	O
will	O
provide	O
definitions	O
for	O
these	O
.	O
</s>
<s>
Loading	B-Operating_System
the	O
program	O
will	O
load	O
these	O
objects/libraries	O
as	O
well	O
,	O
and	O
perform	O
a	O
final	O
linking	O
.	O
</s>
<s>
Often-used	O
libraries	O
(	O
for	O
example	O
the	O
standard	O
system	B-Library
libraries	I-Library
)	O
need	O
to	O
be	O
stored	O
in	O
only	O
one	O
location	O
,	O
not	O
duplicated	O
in	O
every	O
single	O
executable	B-Application
file	I-Application
,	O
thus	O
saving	O
limited	O
memory	B-General_Concept
and	O
disk	B-Device
space	O
.	O
</s>
<s>
If	O
a	O
bug	O
in	O
a	O
library	B-Library
function	I-Library
is	O
corrected	O
by	O
replacing	O
the	O
library	B-Library
or	O
performance	O
is	O
improved	O
,	O
all	O
programs	O
using	O
it	O
dynamically	O
will	O
benefit	O
from	O
the	O
correction	O
after	O
restarting	O
them	O
.	O
</s>
<s>
Programs	O
that	O
included	O
this	O
function	O
by	O
static	B-Library
linking	I-Library
would	O
have	O
to	O
be	O
re-linked	O
first	O
.	O
</s>
<s>
Known	O
on	O
the	O
Windows	O
platform	O
as	O
"	O
DLL	O
hell	O
"	O
,	O
an	O
incompatible	O
updated	O
library	B-Library
will	O
break	O
executables	B-Application
that	O
depended	O
on	O
the	O
behavior	O
of	O
the	O
previous	O
version	O
of	O
the	O
library	B-Library
if	O
the	O
newer	O
version	O
is	O
not	O
correctly	O
backward	B-General_Concept
compatible	I-General_Concept
.	O
</s>
<s>
Contained	B-General_Concept
or	O
virtual	B-Application
environments	O
may	O
further	O
allow	O
system	B-Application
administrators	I-Application
to	O
mitigate	O
or	O
trade-off	O
these	O
individual	O
pros	O
and	O
cons	O
.	O
</s>
<s>
Static	B-Library
linking	I-Library
is	O
the	O
result	O
of	O
the	O
linker	O
copying	O
all	O
library	B-Library
routines	I-Library
used	O
in	O
the	O
program	O
into	O
the	O
executable	B-Application
image	O
.	O
</s>
<s>
This	O
may	O
require	O
more	O
disk	B-Device
space	O
and	O
memory	B-General_Concept
than	O
dynamic	B-Application
linking	I-Application
,	O
but	O
is	O
more	O
portable	O
,	O
since	O
it	O
does	O
not	O
require	O
the	O
presence	O
of	O
the	O
library	B-Library
on	O
the	O
system	O
where	O
it	O
runs	O
.	O
</s>
<s>
Static	B-Library
linking	I-Library
also	O
prevents	O
"	O
DLL	O
hell	O
"	O
,	O
since	O
each	O
program	O
includes	O
exactly	O
the	O
versions	O
of	O
library	B-Library
routines	I-Library
that	O
it	O
requires	O
,	O
with	O
no	O
conflict	O
with	O
other	O
programs	O
.	O
</s>
<s>
A	O
program	O
using	O
just	O
a	O
few	O
routines	O
from	O
a	O
library	B-Library
does	O
not	O
require	O
the	O
entire	O
library	B-Library
to	O
be	O
installed	O
.	O
</s>
<s>
As	O
the	O
compiler	B-Language
has	O
no	O
information	O
on	O
the	O
layout	O
of	O
objects	O
in	O
the	O
final	O
output	B-General_Concept
,	O
it	O
cannot	O
take	O
advantage	O
of	O
shorter	O
or	O
more	O
efficient	O
instructions	O
that	O
place	O
a	O
requirement	O
on	O
the	O
address	O
of	O
another	O
object	O
.	O
</s>
<s>
While	O
instruction	O
relaxation	O
typically	O
occurs	O
at	O
link-time	O
,	O
inner-module	O
relaxation	O
can	O
already	O
take	O
place	O
as	O
part	O
of	O
the	O
optimizing	O
process	O
at	O
compile-time	B-Application
.	O
</s>
<s>
In	O
some	O
cases	O
,	O
relaxation	O
can	O
also	O
occur	O
at	O
load-time	B-Operating_System
as	O
part	O
of	O
the	O
relocation	B-Library
process	O
or	O
combined	O
with	O
dynamic	O
dead-code	O
elimination	O
techniques	O
.	O
</s>
<s>
In	O
IBM	B-Application
System/360	I-Application
mainframe	B-Architecture
environments	O
such	O
as	O
OS/360	B-Application
,	O
including	O
z/OS	B-Application
for	O
the	O
z/Architecture	B-Device
mainframes	B-Architecture
,	O
this	O
type	O
of	O
program	O
is	O
known	O
as	O
a	O
linkage	O
editor	O
.	O
</s>
<s>
Operating	B-General_Concept
systems	I-General_Concept
such	O
as	O
OS/360	B-Application
have	O
format	O
for	O
executable	B-Application
load-modules	O
containing	O
supplementary	O
data	O
about	O
the	O
component	O
sections	O
of	O
a	O
program	O
,	O
so	O
that	O
an	O
individual	O
program	O
section	O
can	O
be	O
replaced	O
,	O
and	O
other	O
parts	O
of	O
the	O
program	O
updated	O
so	O
that	O
relocatable	O
addresses	O
and	O
other	O
references	O
can	O
be	O
corrected	O
by	O
the	O
linkage	O
editor	O
,	O
as	O
part	O
of	O
the	O
process	O
.	O
</s>
<s>
One	O
advantage	O
of	O
this	O
is	O
that	O
it	O
allows	O
a	O
program	O
to	O
be	O
maintained	O
without	O
having	O
to	O
keep	O
all	O
of	O
the	O
intermediate	O
object	B-Application
files	I-Application
,	O
or	O
without	O
having	O
to	O
re-compile	O
program	O
sections	O
that	O
have	O
n't	O
changed	O
.	O
</s>
<s>
It	O
also	O
permits	O
program	O
updates	O
to	O
be	O
distributed	O
in	O
the	O
form	O
of	O
small	O
files	O
(	O
originally	O
card	B-Architecture
decks	I-Architecture
)	O
,	O
containing	O
only	O
the	O
object	B-Application
module	I-Application
to	O
be	O
replaced	O
.	O
</s>
<s>
In	O
such	O
systems	O
,	O
object	O
code	O
is	O
in	O
the	O
form	O
and	O
format	O
of	O
80-byte	O
punched-card	B-Architecture
images	O
,	O
so	O
that	O
updates	O
can	O
be	O
introduced	O
into	O
a	O
system	O
using	O
that	O
medium	O
.	O
</s>
<s>
In	O
later	O
releases	O
of	O
OS/360	B-Application
and	O
in	O
subsequent	O
systems	O
,	O
load-modules	O
contain	O
additional	O
data	O
about	O
versions	O
of	O
components	O
modules	O
,	O
to	O
create	O
a	O
traceable	O
record	O
of	O
updates	O
.	O
</s>
<s>
It	O
also	O
allows	O
one	O
to	O
add	O
,	O
change	O
,	O
or	O
remove	O
an	O
overlay	B-General_Concept
structure	O
from	O
an	O
already	O
linked	O
load	O
module	O
.	O
</s>
<s>
It	O
is	O
intended	O
for	O
batch-mode	O
execution	O
,	O
with	O
the	O
editing	O
commands	O
being	O
supplied	O
by	O
the	O
user	O
in	O
sequentially	O
organized	O
files	O
,	O
such	O
as	O
punched	B-Architecture
cards	I-Architecture
,	O
DASD	B-Application
,	O
or	O
magnetic	O
tape	O
.	O
</s>
<s>
Linkage	O
editing	O
(	O
IBM	O
nomenclature	O
)	O
or	O
consolidation	O
or	O
collection	O
(	O
ICL	O
nomenclature	O
)	O
refers	O
to	O
the	O
linkage	O
editor	O
's	O
or	O
consolidator	O
's	O
act	O
of	O
combining	O
the	O
various	O
pieces	O
into	O
a	O
relocatable	O
binary	O
,	O
whereas	O
the	O
loading	B-Operating_System
and	O
relocation	B-Library
into	O
an	O
absolute	O
binary	O
at	O
the	O
target	O
address	O
is	O
normally	O
considered	O
a	O
separate	O
step	O
.	O
</s>
<s>
On	O
Unix	B-Application
and	O
Unix-like	B-Operating_System
systems	I-Operating_System
,	O
the	O
linker	O
is	O
known	O
as	O
"	O
ld	B-Device
"	O
.	O
</s>
<s>
Origins	O
of	O
the	O
name	O
"	O
ld	B-Device
"	O
are	O
"	O
LoaDer	B-Operating_System
"	O
and	O
"	O
Link	O
eDitor	O
"	O
.	O
</s>
<s>
The	O
term	O
"	O
loader	B-Operating_System
"	O
was	O
used	O
to	O
describe	O
the	O
process	O
of	O
loading	B-Operating_System
external	O
symbols	O
from	O
other	O
programs	O
during	O
the	O
process	O
of	O
linking	O
.	O
</s>
<s>
The	O
GNU	O
linker	O
(	O
or	O
GNU	O
ld	B-Device
)	O
is	O
the	B-Application
GNU	I-Application
Project	I-Application
's	O
free	B-Application
software	I-Application
implementation	O
of	O
the	O
Unix	B-Application
command	O
ld	B-Device
.	O
</s>
<s>
GNU	O
ld	B-Device
runs	O
the	O
linker	O
,	O
which	O
creates	O
an	O
executable	B-Application
file	I-Application
(	O
or	O
a	O
library	B-Library
)	O
from	O
object	B-Application
files	I-Application
created	O
during	O
compilation	B-Language
of	O
a	O
software	O
project	O
.	O
</s>
<s>
A	O
linker	O
script	O
may	O
be	O
passed	O
to	O
GNU	O
ld	B-Device
to	O
exercise	O
greater	O
control	O
over	O
the	O
linking	O
process	O
.	O
</s>
<s>
The	O
GNU	O
linker	O
is	O
part	O
of	O
the	O
GNU	B-Application
Binary	I-Application
Utilities	I-Application
(	O
binutils	B-Application
)	O
.	O
</s>
<s>
Two	O
versions	O
of	O
ld	B-Device
are	O
provided	O
in	O
binutils	B-Application
:	O
the	O
traditional	O
GNU	O
ld	B-Device
based	O
on	O
bfd	B-Application
,	O
and	O
a	O
"	O
streamlined	O
"	O
ELF-only	O
version	O
called	O
gold	B-Application
.	O
</s>
<s>
The	O
command-line	O
and	O
linker	O
script	O
syntaxes	O
of	O
GNU	O
ld	B-Device
is	O
the	O
de	O
facto	O
standard	O
in	O
much	O
of	O
the	O
Unix-like	B-Operating_System
world	O
.	O
</s>
<s>
The	O
LLVM	B-Application
project	O
's	O
linker	O
,	O
,	O
is	O
designed	O
to	O
be	O
drop-in	O
compatible	O
,	O
and	O
may	O
be	O
used	O
directly	O
with	O
the	O
GNU	O
compiler	B-Language
.	O
</s>
