Table of Contents1. Using ld ............................................................................................................................................ 12. Overview .......................................................................................................................................... 33. Invocation ........................................................................................................................................ 53.1. Command Line Options..................................................................................................... 53.1.1. Options Specific to i386 PE Targets ................................................................. 213.2. Environment Variables..................................................................................................... 274. Linker Scripts................................................................................................................................ 294.1. Basic Linker Script Concepts........................................................................................... 294.2. Linker Script Format........................................................................................................ 294.3. Simple Linker Script Example......................................................................................... 304.4. Simple Linker Script Commands..................................................................................... 314.4.1. Setting the Entry Point ...................................................................................... 314.4.2. Commands Dealing with Files.......................................................................... 314.4.3. Commands Dealing with Object File Formats.................................................. 324.4.4. Other Linker Script Commands ........................................................................ 334.5. Assigning Values to Symbols .......................................................................................... 334.5.1. Simple Assignments ......................................................................................... 334.5.2. PROVIDE.......................................................................................................... 344.6. SECTIONS Command..................................................................................................... 354.6.1. Output Section Description............................................................................... 354.6.2. Output Section Name........................................................................................ 364.6.3. Output Section Description............................................................................... 364.6.4. Input Section Description ................................................................................. 374.6.5. Output Section Data.......................................................................................... 394.6.6. Output Section Keywords ................................................................................. 404.6.7. Output Section Discarding................................................................................ 414.6.8. Output Section Attributes ................................................................................. 424.6.9. Overlay Description .......................................................................................... 444.7. MEMORY Command ...................................................................................................... 454.8. PHDRS Command ........................................................................................................... 474.9. VERSION Command....................................................................................................... 494.10. Expressions in Linker Scripts ........................................................................................ 514.10.1. Constants......................................................................................................... 514.10.2. Symbol Names ................................................................................................ 514.10.3. The Location Counter ..................................................................................... 514.10.4. Operators......................................................................................................... 524.10.5. Evaluation ....................................................................................................... 534.10.6. The Section of an Expression ......................................................................... 534.10.7. Builtin Functions............................................................................................. 544.11. Implicit Linker Scripts ................................................................................................... 565. Machine Dependent Features ...................................................................................................... 595.1. ld and the H8/300............................................................................................................ 595.2. ld and the Intel 960 Family ............................................................................................. 595.3. ld’s Support for Interworking Between ARM and Thumb Code ................................... 595.4. ld and HPPA 32-bit ELF Support ................................................................................... 605.5. ld and MMIX .................................................................................................................. 605.6. ld and MSP430 ............................................................................................................... 605.7. ld’s Support for Various TI COFF Versions ................................................................... 615.8. ld and WIN32 (cygwin/mingw)...................................................................................... 615.9. ld and Xtensa Processors ................................................................................................ 65