文档介绍:Using ld
The GNU linker
ld version 2
Version
Steve Chamberlain
Ian Lance Taylor
Red Hat Inc
nickc@, doc@
Using LD, the GNU linker
Edited by Jeffrey Osier (jeffrey@)
Copyright
c 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, 2002, 2003 Free Software
Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document under the terms of
the GNU Free Documentation License, Version or any later version published by the
Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with
no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free
Documentation License”.
i
Table of Contents
1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 Invocation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Line Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Options Specific to i386 PE Targets . . . . . . . . . . . . . 21
Environment Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3 Linker Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Basic Linker Script Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Linker Script Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Simple Linker Script Example . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Simple Linker mands. . . . . . . . . . . . . . . . . . . . . . . . . 31
Setting the Entry Point . . . . . . . . . . . . . . . . . . . . . . . . 31
Dealing with Files . . . . . . . . . . . . . . . . . . 31
Dealing with Object File Formats . . . . 32
Other Linker mands . . . . . . . . . . . . . . . . . 33
Assigning Values to Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Simple Assignments. . . . . . . . . . . . . . . . . . . . . . . . .