This is the mail archive of the
mailing list for the binutils project.
Re: what's difference between "relocatable link" and "final link"?
- From: Simon Richter <Simon dot Richter at hogyros dot de>
- To: "Huang, Chunhao" <Chunhao dot Huang at sony dot com dot cn>
- Cc: binutils at sourceware dot org
- Date: Mon, 12 Jun 2006 13:11:10 +0200
- Subject: Re: what's difference between "relocatable link" and "final link"?
- Openpgp: url=http://www.hogyros.de/simon.asc
- References: <72E45C253B3AEC45B17C71D5C145B93603C2DA35@CNSCNXMS02.ap.sony.com>
Huang, Chunhao schrieb:
When I study the BFD library, I meet "relocatable link" and
"final link" several times, but I can NOT find out the difference
Basically, after a "relocatable" link, you have an object file that is
similar to the input files, that is, it consists of multiple (in most
cases zero-based) code blocks (sections) along with relocation (i.e.
what to change if you move the code to another address) and symbol (i.e.
how specific addresses are named) information. This format makes sense
for further linking, but you would need a lot of postprocessing to
actually get executable code. After a "final" link, the sections are
concatenated into segments (this is what the loader cares about), and
have absolute addresses in the virtual address space, and all symbols
have been resolved and replaced by either their numerical value, or by a
"dynamic symbol" if you have a (runtime) linker that supports shared
libraries. After a final link, you can drop the symbol and relocation
information at no harm, it is no longer needed (except for debugging).
Gee, somebody should document this. :-)
 if there is no virtual address space, the output of a final link may
still have relocation information, and the executable is relocated by
Description: OpenPGP digital signature