| 1 | This is ld.info, produced by makeinfo version 4.3 from ./ld.texinfo. | 
|---|
| 2 |  | 
|---|
| 3 | START-INFO-DIR-ENTRY | 
|---|
| 4 | * Ld: (ld).                       The GNU linker. | 
|---|
| 5 | END-INFO-DIR-ENTRY | 
|---|
| 6 |  | 
|---|
| 7 | This file documents the GNU linker LD version 2.14. | 
|---|
| 8 |  | 
|---|
| 9 | Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, | 
|---|
| 10 | 2002, 2003 Free Software Foundation, Inc. | 
|---|
| 11 |  | 
|---|
| 12 |  | 
|---|
| 13 | File: ld.info,  Node: WIN32,  Next: Xtensa,  Prev: TI COFF,  Up: Machine Dependent | 
|---|
| 14 |  | 
|---|
| 15 | `ld' and WIN32 (cygwin/mingw) | 
|---|
| 16 | ============================= | 
|---|
| 17 |  | 
|---|
| 18 | This section describes some of the win32 specific `ld' issues.  See | 
|---|
| 19 | *Note Command Line Options: Options for detailed decription of the | 
|---|
| 20 | command line options mentioned here. | 
|---|
| 21 |  | 
|---|
| 22 | _import libraries_ | 
|---|
| 23 | The standard Windows linker creates and uses so-called import | 
|---|
| 24 | libraries, which contains information for linking to dll's.  They | 
|---|
| 25 | are regular static archives and are handled as any other static | 
|---|
| 26 | archive.  The cygwin and mingw ports of `ld' have specific support | 
|---|
| 27 | for creating such libraries provided with the `--out-implib' | 
|---|
| 28 | command line option. | 
|---|
| 29 |  | 
|---|
| 30 | _exporting DLL symbols_ | 
|---|
| 31 | The cygwin/mingw `ld' has several ways to export symbols for dll's. | 
|---|
| 32 |  | 
|---|
| 33 | _using auto-export functionality_ | 
|---|
| 34 | By default `ld' exports symbols with the auto-export | 
|---|
| 35 | functionality, which is controlled by the following command | 
|---|
| 36 | line options: | 
|---|
| 37 |  | 
|---|
| 38 | * -export-all-symbols   [This is the default] | 
|---|
| 39 |  | 
|---|
| 40 | * -exclude-symbols | 
|---|
| 41 |  | 
|---|
| 42 | * -exclude-libs | 
|---|
| 43 |  | 
|---|
| 44 | If, however, `--export-all-symbols' is not given explicitly | 
|---|
| 45 | on the command line, then the default auto-export behavior | 
|---|
| 46 | will be _disabled_ if either of the following are true: | 
|---|
| 47 |  | 
|---|
| 48 | * A DEF file is used. | 
|---|
| 49 |  | 
|---|
| 50 | * Any symbol in any object file was marked with the | 
|---|
| 51 | __declspec(dllexport) attribute. | 
|---|
| 52 |  | 
|---|
| 53 | _using a DEF file_ | 
|---|
| 54 | Another way of exporting symbols is using a DEF file.  A DEF | 
|---|
| 55 | file is an ASCII file containing definitions of symbols which | 
|---|
| 56 | should be exported when a dll is created.  Usually it is | 
|---|
| 57 | named `<dll name>.def' and is added as any other object file | 
|---|
| 58 | to the linker's command line.  The file's name must end in | 
|---|
| 59 | `.def' or `.DEF'. | 
|---|
| 60 |  | 
|---|
| 61 | gcc -o <output> <objectfiles> <dll name>.def | 
|---|
| 62 |  | 
|---|
| 63 | Using a DEF file turns off the normal auto-export behavior, | 
|---|
| 64 | unless the `--export-all-symbols' option is also used. | 
|---|
| 65 |  | 
|---|
| 66 | Here is an example of a DEF file for a shared library called | 
|---|
| 67 | `xyz.dll': | 
|---|
| 68 |  | 
|---|
| 69 | LIBRARY "xyz.dll" BASE=0x10000000 | 
|---|
| 70 |  | 
|---|
| 71 | EXPORTS | 
|---|
| 72 | foo | 
|---|
| 73 | bar | 
|---|
| 74 | _bar = bar | 
|---|
| 75 |  | 
|---|
| 76 | This example defines a base address and three symbols.  The | 
|---|
| 77 | third symbol is an alias for the second.  For the complete | 
|---|
| 78 | format specification see ld/deffilep.y in the binutils | 
|---|
| 79 | sources. | 
|---|
| 80 |  | 
|---|
| 81 | While linking a shared dll, `ld' is able to create a DEF file | 
|---|
| 82 | with the `--output-def <file>' command line option. | 
|---|
| 83 |  | 
|---|
| 84 | _Using decorations_ | 
|---|
| 85 | Another way of marking symbols for export is to modify the | 
|---|
| 86 | source code itself, so that when building the DLL each symbol | 
|---|
| 87 | to be exported is declared as: | 
|---|
| 88 |  | 
|---|
| 89 | __declspec(dllexport) int a_variable | 
|---|
| 90 | __declspec(dllexport) void a_function(int with_args) | 
|---|
| 91 |  | 
|---|
| 92 | All such symbols will be exported from the DLL.  If, however, | 
|---|
| 93 | any of the object files in the DLL contain symbols decorated | 
|---|
| 94 | in this way, then the normal auto-export behavior is | 
|---|
| 95 | disabled, unless the `--export-all-symbols' option is also | 
|---|
| 96 | used. | 
|---|
| 97 |  | 
|---|
| 98 | Note that object files that wish to access these symbols must | 
|---|
| 99 | _not_ decorate them with dllexport.  Instead, they should use | 
|---|
| 100 | dllimport, instead: | 
|---|
| 101 |  | 
|---|
| 102 | __declspec(dllimport) int a_variable | 
|---|
| 103 | __declspec(dllimport) void a_function(int with_args) | 
|---|
| 104 |  | 
|---|
| 105 | This complicates the structure of library header files, | 
|---|
| 106 | because when included by the library itself the header must | 
|---|
| 107 | declare the variables and functions as dllexport, but when | 
|---|
| 108 | included by client code the header must declare them as | 
|---|
| 109 | dllimport.  There are a number of idioms that are typically | 
|---|
| 110 | used to do this; often client code can omit the __declspec() | 
|---|
| 111 | declaration completely.  See `--enable-auto-import' and | 
|---|
| 112 | `automatic data imports' for more imformation. | 
|---|
| 113 |  | 
|---|
| 114 | _automatic data imports_ | 
|---|
| 115 | The standard Windows dll format supports data imports from dlls | 
|---|
| 116 | only by adding special decorations (dllimport/dllexport), which | 
|---|
| 117 | let the compiler produce specific assembler instructions to deal | 
|---|
| 118 | with this issue.  This increases the effort necessary to port | 
|---|
| 119 | existing Un*x code to these platforms, especially for large c++ | 
|---|
| 120 | libraries and applications.  The auto-import feature, which was | 
|---|
| 121 | initially provided by Paul Sokolovsky, allows one to omit the | 
|---|
| 122 | decorations to archieve a behavior that conforms to that on | 
|---|
| 123 | POSIX/Un*x platforms. This feature is enabled with the | 
|---|
| 124 | `--enable-auto-import' command-line option, although it is enabled | 
|---|
| 125 | by default on cygwin/mingw.  The `--enable-auto-import' option | 
|---|
| 126 | itself now serves mainly to suppress any warnings that are | 
|---|
| 127 | ordinarily emitted when linked objects trigger the feature's use. | 
|---|
| 128 |  | 
|---|
| 129 | auto-import of variables does not always work flawlessly without | 
|---|
| 130 | additional assistance.  Sometimes, you will see this message | 
|---|
| 131 |  | 
|---|
| 132 | "variable '<var>' can't be auto-imported. Please read the | 
|---|
| 133 | documentation for ld's `--enable-auto-import' for details." | 
|---|
| 134 |  | 
|---|
| 135 | The `--enable-auto-import' documentation explains why this error | 
|---|
| 136 | occurs, and several methods that can be used to overcome this | 
|---|
| 137 | difficulty.  One of these methods is the _runtime pseudo-relocs_ | 
|---|
| 138 | feature, described below. | 
|---|
| 139 |  | 
|---|
| 140 | For complex variables imported from DLLs (such as structs or | 
|---|
| 141 | classes), object files typically contain a base address for the | 
|---|
| 142 | variable and an offset (_addend_) within the variable-to specify a | 
|---|
| 143 | particular field or public member, for instance.  Unfortunately, | 
|---|
| 144 | the runtime loader used in win32 environments is incapable of | 
|---|
| 145 | fixing these references at runtime without the additional | 
|---|
| 146 | information supplied by dllimport/dllexport decorations.  The | 
|---|
| 147 | standard auto-import feature described above is unable to resolve | 
|---|
| 148 | these references. | 
|---|
| 149 |  | 
|---|
| 150 | The `--enable-runtime-pseudo-relocs' switch allows these | 
|---|
| 151 | references to be resolved without error, while leaving the task of | 
|---|
| 152 | adjusting the references themselves (with their non-zero addends) | 
|---|
| 153 | to specialized code provided by the runtime environment.  Recent | 
|---|
| 154 | versions of the cygwin and mingw environments and compilers | 
|---|
| 155 | provide this runtime support; older versions do not.  However, the | 
|---|
| 156 | support is only necessary on the developer's platform; the | 
|---|
| 157 | compiled result will run without error on an older system. | 
|---|
| 158 |  | 
|---|
| 159 | `--enable-runtime-pseudo-relocs' is not the default; it must be | 
|---|
| 160 | explicitly enabled as needed. | 
|---|
| 161 |  | 
|---|
| 162 | _direct linking to a dll_ | 
|---|
| 163 | The cygwin/mingw ports of `ld' support the direct linking, | 
|---|
| 164 | including data symbols, to a dll without the usage of any import | 
|---|
| 165 | libraries.  This is much faster and uses much less memory than | 
|---|
| 166 | does the traditional import library method, expecially when | 
|---|
| 167 | linking large libraries or applications.  When `ld' creates an | 
|---|
| 168 | import lib, each function or variable exported from the dll is | 
|---|
| 169 | stored in its own bfd, even though a single bfd could contain many | 
|---|
| 170 | exports.  The overhead involved in storing, loading, and | 
|---|
| 171 | processing so many bfd's is quite large, and explains the | 
|---|
| 172 | tremendous time, memory, and storage needed to link against | 
|---|
| 173 | particularly large or complex libraries when using import libs. | 
|---|
| 174 |  | 
|---|
| 175 | Linking directly to a dll uses no extra command-line switches | 
|---|
| 176 | other than `-L' and `-l', because `ld' already searches for a | 
|---|
| 177 | number of names to match each library.  All that is needed from | 
|---|
| 178 | the developer's perspective is an understanding of this search, in | 
|---|
| 179 | order to force ld to select the dll instead of an import library. | 
|---|
| 180 |  | 
|---|
| 181 | For instance, when ld is called with the argument `-lxxx' it will | 
|---|
| 182 | attempt to find, in the first directory of its search path, | 
|---|
| 183 |  | 
|---|
| 184 | libxxx.dll.a | 
|---|
| 185 | xxx.dll.a | 
|---|
| 186 | libxxx.a | 
|---|
| 187 | cygxxx.dll (*) | 
|---|
| 188 | libxxx.dll | 
|---|
| 189 | xxx.dll | 
|---|
| 190 |  | 
|---|
| 191 | before moving on to the next directory in the search path. | 
|---|
| 192 |  | 
|---|
| 193 | (*) Actually, this is not `cygxxx.dll' but in fact is | 
|---|
| 194 | `<prefix>xxx.dll', where `<prefix>' is set by the `ld' option | 
|---|
| 195 | `--dll-search-prefix=<prefix>'. In the case of cygwin, the | 
|---|
| 196 | standard gcc spec file includes `--dll-search-prefix=cyg', so in | 
|---|
| 197 | effect we actually search for `cygxxx.dll'. | 
|---|
| 198 |  | 
|---|
| 199 | Other win32-based unix environments, such as mingw or pw32, may | 
|---|
| 200 | use other `<prefix>'es, although at present only cygwin makes use | 
|---|
| 201 | of this feature.  It was originally intended to help avoid name | 
|---|
| 202 | conflicts among dll's built for the various win32/un*x | 
|---|
| 203 | environments, so that (for example) two versions of a zlib dll | 
|---|
| 204 | could coexist on the same machine. | 
|---|
| 205 |  | 
|---|
| 206 | The generic cygwin/mingw path layout uses a `bin' directory for | 
|---|
| 207 | applications and dll's and a `lib' directory for the import | 
|---|
| 208 | libraries (using cygwin nomenclature): | 
|---|
| 209 |  | 
|---|
| 210 | bin/ | 
|---|
| 211 | cygxxx.dll | 
|---|
| 212 | lib/ | 
|---|
| 213 | libxxx.dll.a   (in case of dll's) | 
|---|
| 214 | libxxx.a       (in case of static archive) | 
|---|
| 215 |  | 
|---|
| 216 | Linking directly to a dll without using the import library can be | 
|---|
| 217 | done two ways: | 
|---|
| 218 |  | 
|---|
| 219 | 1. Use the dll directly by adding the `bin' path to the link line | 
|---|
| 220 | gcc -Wl,-verbose  -o a.exe -L../bin/ -lxxx | 
|---|
| 221 |  | 
|---|
| 222 | However, as the dll's often have version numbers appended to their | 
|---|
| 223 | names (`cygncurses-5.dll') this will often fail, unless one | 
|---|
| 224 | specifies `-L../bin -lncurses-5' to include the version.  Import | 
|---|
| 225 | libs are generally not versioned, and do not have this difficulty. | 
|---|
| 226 |  | 
|---|
| 227 | 2. Create a symbolic link from the dll to a file in the `lib' | 
|---|
| 228 | directory according to the above mentioned search pattern.  This | 
|---|
| 229 | should be used to avoid unwanted changes in the tools needed for | 
|---|
| 230 | making the app/dll. | 
|---|
| 231 |  | 
|---|
| 232 | ln -s bin/cygxxx.dll lib/[cyg|lib|]xxx.dll[.a] | 
|---|
| 233 |  | 
|---|
| 234 | Then you can link without any make environment changes. | 
|---|
| 235 |  | 
|---|
| 236 | gcc -Wl,-verbose  -o a.exe -L../lib/ -lxxx | 
|---|
| 237 |  | 
|---|
| 238 | This technique also avoids the version number problems, because | 
|---|
| 239 | the following is perfectly legal | 
|---|
| 240 |  | 
|---|
| 241 | bin/ | 
|---|
| 242 | cygxxx-5.dll | 
|---|
| 243 | lib/ | 
|---|
| 244 | libxxx.dll.a -> ../bin/cygxxx-5.dll | 
|---|
| 245 |  | 
|---|
| 246 | Linking directly to a dll without using an import lib will work | 
|---|
| 247 | even when auto-import features are exercised, and even when | 
|---|
| 248 | `--enable-runtime-pseudo-relocs' is used. | 
|---|
| 249 |  | 
|---|
| 250 | Given the improvements in speed and memory usage, one might | 
|---|
| 251 | justifiably wonder why import libraries are used at all.  There | 
|---|
| 252 | are two reasons: | 
|---|
| 253 |  | 
|---|
| 254 | 1. Until recently, the link-directly-to-dll functionality did _not_ | 
|---|
| 255 | work with auto-imported data. | 
|---|
| 256 |  | 
|---|
| 257 | 2. Sometimes it is necessary to include pure static objects within | 
|---|
| 258 | the import library (which otherwise contains only bfd's for | 
|---|
| 259 | indirection symbols that point to the exports of a dll).  Again, | 
|---|
| 260 | the import lib for the cygwin kernel makes use of this ability, | 
|---|
| 261 | and it is not possible to do this without an import lib. | 
|---|
| 262 |  | 
|---|
| 263 | So, import libs are not going away.  But the ability to replace | 
|---|
| 264 | true import libs with a simple symbolic link to (or a copy of) a | 
|---|
| 265 | dll, in most cases, is a useful addition to the suite of tools | 
|---|
| 266 | binutils makes available to the win32 developer.  Given the | 
|---|
| 267 | massive improvements in memory requirements during linking, storage | 
|---|
| 268 | requirements, and linking speed, we expect that many developers | 
|---|
| 269 | will soon begin to use this feature whenever possible. | 
|---|
| 270 |  | 
|---|
| 271 | _symbol aliasing_ | 
|---|
| 272 |  | 
|---|
| 273 | _adding additional names_ | 
|---|
| 274 | Sometimes, it is useful to export symbols with additional | 
|---|
| 275 | names.  A symbol `foo' will be exported as `foo', but it can | 
|---|
| 276 | also be exported as `_foo' by using special directives in the | 
|---|
| 277 | DEF file when creating the dll.  This will affect also the | 
|---|
| 278 | optional created import library.  Consider the following DEF | 
|---|
| 279 | file: | 
|---|
| 280 |  | 
|---|
| 281 | LIBRARY "xyz.dll" BASE=0x61000000 | 
|---|
| 282 |  | 
|---|
| 283 | EXPORTS | 
|---|
| 284 | foo | 
|---|
| 285 | _foo = foo | 
|---|
| 286 |  | 
|---|
| 287 | The line `_foo = foo' maps the symbol `foo' to `_foo'. | 
|---|
| 288 |  | 
|---|
| 289 | Another method for creating a symbol alias is to create it in | 
|---|
| 290 | the source code using the "weak" attribute: | 
|---|
| 291 |  | 
|---|
| 292 | void foo () { /* Do something.  */; } | 
|---|
| 293 | void _foo () __attribute__ ((weak, alias ("foo"))); | 
|---|
| 294 |  | 
|---|
| 295 | See the gcc manual for more information about attributes and | 
|---|
| 296 | weak symbols. | 
|---|
| 297 |  | 
|---|
| 298 | _renaming symbols_ | 
|---|
| 299 | Sometimes it is useful to rename exports.  For instance, the | 
|---|
| 300 | cygwin kernel does this regularly.  A symbol `_foo' can be | 
|---|
| 301 | exported as `foo' but not as `_foo' by using special | 
|---|
| 302 | directives in the DEF file. (This will also affect the import | 
|---|
| 303 | library, if it is created).  In the following example: | 
|---|
| 304 |  | 
|---|
| 305 | LIBRARY "xyz.dll" BASE=0x61000000 | 
|---|
| 306 |  | 
|---|
| 307 | EXPORTS | 
|---|
| 308 | _foo = foo | 
|---|
| 309 |  | 
|---|
| 310 | The line `_foo = foo' maps the exported symbol `foo' to | 
|---|
| 311 | `_foo'. | 
|---|
| 312 |  | 
|---|
| 313 | Note: using a DEF file disables the default auto-export behavior, | 
|---|
| 314 | unless the `--export-all-symbols' command line option is used. | 
|---|
| 315 | If, however, you are trying to rename symbols, then you should list | 
|---|
| 316 | _all_ desired exports in the DEF file, including the symbols that | 
|---|
| 317 | are not being renamed, and do _not_ use the `--export-all-symbols' | 
|---|
| 318 | option.  If you list only the renamed symbols in the DEF file, and | 
|---|
| 319 | use `--export-all-symbols' to handle the other symbols, then the | 
|---|
| 320 | both the new names _and_ the original names for the the renamed | 
|---|
| 321 | symbols will be exported.  In effect, you'd be aliasing those | 
|---|
| 322 | symbols, not renaming them, which is probably not what you wanted. | 
|---|
| 323 |  | 
|---|
| 324 |  | 
|---|
| 325 | File: ld.info,  Node: Xtensa,  Prev: WIN32,  Up: Machine Dependent | 
|---|
| 326 |  | 
|---|
| 327 | `ld' and Xtensa Processors | 
|---|
| 328 | ========================== | 
|---|
| 329 |  | 
|---|
| 330 | The default `ld' behavior for Xtensa processors is to interpret | 
|---|
| 331 | `SECTIONS' commands so that lists of explicitly named sections in a | 
|---|
| 332 | specification with a wildcard file will be interleaved when necessary to | 
|---|
| 333 | keep literal pools within the range of PC-relative load offsets.  For | 
|---|
| 334 | example, with the command: | 
|---|
| 335 |  | 
|---|
| 336 | SECTIONS | 
|---|
| 337 | { | 
|---|
| 338 | .text : { | 
|---|
| 339 | *(.literal .text) | 
|---|
| 340 | } | 
|---|
| 341 | } | 
|---|
| 342 |  | 
|---|
| 343 | `ld' may interleave some of the `.literal' and `.text' sections from | 
|---|
| 344 | different object files to ensure that the literal pools are within the | 
|---|
| 345 | range of PC-relative load offsets.  A valid interleaving might place | 
|---|
| 346 | the `.literal' sections from an initial group of files followed by the | 
|---|
| 347 | `.text' sections of that group of files.  Then, the `.literal' sections | 
|---|
| 348 | from the rest of the files and the `.text' sections from the rest of | 
|---|
| 349 | the files would follow.  The non-interleaved order can still be | 
|---|
| 350 | specified as: | 
|---|
| 351 |  | 
|---|
| 352 | SECTIONS | 
|---|
| 353 | { | 
|---|
| 354 | .text : { | 
|---|
| 355 | *(.literal) *(.text) | 
|---|
| 356 | } | 
|---|
| 357 | } | 
|---|
| 358 |  | 
|---|
| 359 | The Xtensa version of `ld' enables the `--relax' option by default | 
|---|
| 360 | to attempt to reduce space in the output image by combining literals | 
|---|
| 361 | with identical values.  It also provides the `--no-relax' option to | 
|---|
| 362 | disable this optimization.  When enabled, the relaxation algorithm | 
|---|
| 363 | ensures that a literal will only be merged with another literal when | 
|---|
| 364 | the new merged literal location is within the offset range of all of | 
|---|
| 365 | its uses. | 
|---|
| 366 |  | 
|---|
| 367 | The relaxation mechanism will also attempt to optimize | 
|---|
| 368 | assembler-generated "longcall" sequences of `L32R'/`CALLXN' when the | 
|---|
| 369 | target is known to fit into a `CALLN' instruction encoding.  The | 
|---|
| 370 | current optimization converts the sequence into `NOP'/`CALLN' and | 
|---|
| 371 | removes the literal referenced by the `L32R' instruction. | 
|---|
| 372 |  | 
|---|
| 373 |  | 
|---|
| 374 | File: ld.info,  Node: BFD,  Next: Reporting Bugs,  Prev: Machine Dependent,  Up: Top | 
|---|
| 375 |  | 
|---|
| 376 | BFD | 
|---|
| 377 | *** | 
|---|
| 378 |  | 
|---|
| 379 | The linker accesses object and archive files using the BFD libraries. | 
|---|
| 380 | These libraries allow the linker to use the same routines to operate on | 
|---|
| 381 | object files whatever the object file format.  A different object file | 
|---|
| 382 | format can be supported simply by creating a new BFD back end and adding | 
|---|
| 383 | it to the library.  To conserve runtime memory, however, the linker and | 
|---|
| 384 | associated tools are usually configured to support only a subset of the | 
|---|
| 385 | object file formats available.  You can use `objdump -i' (*note | 
|---|
| 386 | objdump: (binutils.info)objdump.) to list all the formats available for | 
|---|
| 387 | your configuration. | 
|---|
| 388 |  | 
|---|
| 389 | As with most implementations, BFD is a compromise between several | 
|---|
| 390 | conflicting requirements. The major factor influencing BFD design was | 
|---|
| 391 | efficiency: any time used converting between formats is time which | 
|---|
| 392 | would not have been spent had BFD not been involved. This is partly | 
|---|
| 393 | offset by abstraction payback; since BFD simplifies applications and | 
|---|
| 394 | back ends, more time and care may be spent optimizing algorithms for a | 
|---|
| 395 | greater speed. | 
|---|
| 396 |  | 
|---|
| 397 | One minor artifact of the BFD solution which you should bear in mind | 
|---|
| 398 | is the potential for information loss.  There are two places where | 
|---|
| 399 | useful information can be lost using the BFD mechanism: during | 
|---|
| 400 | conversion and during output. *Note BFD information loss::. | 
|---|
| 401 |  | 
|---|
| 402 | * Menu: | 
|---|
| 403 |  | 
|---|
| 404 | * BFD outline::                 How it works: an outline of BFD | 
|---|
| 405 |  | 
|---|
| 406 |  | 
|---|
| 407 | File: ld.info,  Node: BFD outline,  Up: BFD | 
|---|
| 408 |  | 
|---|
| 409 | How It Works: An Outline of BFD | 
|---|
| 410 | =============================== | 
|---|
| 411 |  | 
|---|
| 412 | When an object file is opened, BFD subroutines automatically | 
|---|
| 413 | determine the format of the input object file.  They then build a | 
|---|
| 414 | descriptor in memory with pointers to routines that will be used to | 
|---|
| 415 | access elements of the object file's data structures. | 
|---|
| 416 |  | 
|---|
| 417 | As different information from the object files is required, BFD | 
|---|
| 418 | reads from different sections of the file and processes them.  For | 
|---|
| 419 | example, a very common operation for the linker is processing symbol | 
|---|
| 420 | tables.  Each BFD back end provides a routine for converting between | 
|---|
| 421 | the object file's representation of symbols and an internal canonical | 
|---|
| 422 | format. When the linker asks for the symbol table of an object file, it | 
|---|
| 423 | calls through a memory pointer to the routine from the relevant BFD | 
|---|
| 424 | back end which reads and converts the table into a canonical form.  The | 
|---|
| 425 | linker then operates upon the canonical form. When the link is finished | 
|---|
| 426 | and the linker writes the output file's symbol table, another BFD back | 
|---|
| 427 | end routine is called to take the newly created symbol table and | 
|---|
| 428 | convert it into the chosen output format. | 
|---|
| 429 |  | 
|---|
| 430 | * Menu: | 
|---|
| 431 |  | 
|---|
| 432 | * BFD information loss::        Information Loss | 
|---|
| 433 | * Canonical format::            The BFD canonical object-file format | 
|---|
| 434 |  | 
|---|
| 435 |  | 
|---|
| 436 | File: ld.info,  Node: BFD information loss,  Next: Canonical format,  Up: BFD outline | 
|---|
| 437 |  | 
|---|
| 438 | Information Loss | 
|---|
| 439 | ---------------- | 
|---|
| 440 |  | 
|---|
| 441 | _Information can be lost during output._ The output formats | 
|---|
| 442 | supported by BFD do not provide identical facilities, and information | 
|---|
| 443 | which can be described in one form has nowhere to go in another format. | 
|---|
| 444 | One example of this is alignment information in `b.out'. There is | 
|---|
| 445 | nowhere in an `a.out' format file to store alignment information on the | 
|---|
| 446 | contained data, so when a file is linked from `b.out' and an `a.out' | 
|---|
| 447 | image is produced, alignment information will not propagate to the | 
|---|
| 448 | output file. (The linker will still use the alignment information | 
|---|
| 449 | internally, so the link is performed correctly). | 
|---|
| 450 |  | 
|---|
| 451 | Another example is COFF section names. COFF files may contain an | 
|---|
| 452 | unlimited number of sections, each one with a textual section name. If | 
|---|
| 453 | the target of the link is a format which does not have many sections | 
|---|
| 454 | (e.g., `a.out') or has sections without names (e.g., the Oasys format), | 
|---|
| 455 | the link cannot be done simply. You can circumvent this problem by | 
|---|
| 456 | describing the desired input-to-output section mapping with the linker | 
|---|
| 457 | command language. | 
|---|
| 458 |  | 
|---|
| 459 | _Information can be lost during canonicalization._ The BFD internal | 
|---|
| 460 | canonical form of the external formats is not exhaustive; there are | 
|---|
| 461 | structures in input formats for which there is no direct representation | 
|---|
| 462 | internally.  This means that the BFD back ends cannot maintain all | 
|---|
| 463 | possible data richness through the transformation between external to | 
|---|
| 464 | internal and back to external formats. | 
|---|
| 465 |  | 
|---|
| 466 | This limitation is only a problem when an application reads one | 
|---|
| 467 | format and writes another.  Each BFD back end is responsible for | 
|---|
| 468 | maintaining as much data as possible, and the internal BFD canonical | 
|---|
| 469 | form has structures which are opaque to the BFD core, and exported only | 
|---|
| 470 | to the back ends. When a file is read in one format, the canonical form | 
|---|
| 471 | is generated for BFD and the application. At the same time, the back | 
|---|
| 472 | end saves away any information which may otherwise be lost. If the data | 
|---|
| 473 | is then written back in the same format, the back end routine will be | 
|---|
| 474 | able to use the canonical form provided by the BFD core as well as the | 
|---|
| 475 | information it prepared earlier.  Since there is a great deal of | 
|---|
| 476 | commonality between back ends, there is no information lost when | 
|---|
| 477 | linking or copying big endian COFF to little endian COFF, or `a.out' to | 
|---|
| 478 | `b.out'.  When a mixture of formats is linked, the information is only | 
|---|
| 479 | lost from the files whose format differs from the destination. | 
|---|
| 480 |  | 
|---|
| 481 |  | 
|---|
| 482 | File: ld.info,  Node: Canonical format,  Prev: BFD information loss,  Up: BFD outline | 
|---|
| 483 |  | 
|---|
| 484 | The BFD canonical object-file format | 
|---|
| 485 | ------------------------------------ | 
|---|
| 486 |  | 
|---|
| 487 | The greatest potential for loss of information occurs when there is | 
|---|
| 488 | the least overlap between the information provided by the source | 
|---|
| 489 | format, that stored by the canonical format, and that needed by the | 
|---|
| 490 | destination format. A brief description of the canonical form may help | 
|---|
| 491 | you understand which kinds of data you can count on preserving across | 
|---|
| 492 | conversions. | 
|---|
| 493 |  | 
|---|
| 494 | _files_ | 
|---|
| 495 | Information stored on a per-file basis includes target machine | 
|---|
| 496 | architecture, particular implementation format type, a demand | 
|---|
| 497 | pageable bit, and a write protected bit.  Information like Unix | 
|---|
| 498 | magic numbers is not stored here--only the magic numbers' meaning, | 
|---|
| 499 | so a `ZMAGIC' file would have both the demand pageable bit and the | 
|---|
| 500 | write protected text bit set.  The byte order of the target is | 
|---|
| 501 | stored on a per-file basis, so that big- and little-endian object | 
|---|
| 502 | files may be used with one another. | 
|---|
| 503 |  | 
|---|
| 504 | _sections_ | 
|---|
| 505 | Each section in the input file contains the name of the section, | 
|---|
| 506 | the section's original address in the object file, size and | 
|---|
| 507 | alignment information, various flags, and pointers into other BFD | 
|---|
| 508 | data structures. | 
|---|
| 509 |  | 
|---|
| 510 | _symbols_ | 
|---|
| 511 | Each symbol contains a pointer to the information for the object | 
|---|
| 512 | file which originally defined it, its name, its value, and various | 
|---|
| 513 | flag bits.  When a BFD back end reads in a symbol table, it | 
|---|
| 514 | relocates all symbols to make them relative to the base of the | 
|---|
| 515 | section where they were defined.  Doing this ensures that each | 
|---|
| 516 | symbol points to its containing section.  Each symbol also has a | 
|---|
| 517 | varying amount of hidden private data for the BFD back end.  Since | 
|---|
| 518 | the symbol points to the original file, the private data format | 
|---|
| 519 | for that symbol is accessible.  `ld' can operate on a collection | 
|---|
| 520 | of symbols of wildly different formats without problems. | 
|---|
| 521 |  | 
|---|
| 522 | Normal global and simple local symbols are maintained on output, | 
|---|
| 523 | so an output file (no matter its format) will retain symbols | 
|---|
| 524 | pointing to functions and to global, static, and common variables. | 
|---|
| 525 | Some symbol information is not worth retaining; in `a.out', type | 
|---|
| 526 | information is stored in the symbol table as long symbol names. | 
|---|
| 527 | This information would be useless to most COFF debuggers; the | 
|---|
| 528 | linker has command line switches to allow users to throw it away. | 
|---|
| 529 |  | 
|---|
| 530 | There is one word of type information within the symbol, so if the | 
|---|
| 531 | format supports symbol type information within symbols (for | 
|---|
| 532 | example, COFF, IEEE, Oasys) and the type is simple enough to fit | 
|---|
| 533 | within one word (nearly everything but aggregates), the | 
|---|
| 534 | information will be preserved. | 
|---|
| 535 |  | 
|---|
| 536 | _relocation level_ | 
|---|
| 537 | Each canonical BFD relocation record contains a pointer to the | 
|---|
| 538 | symbol to relocate to, the offset of the data to relocate, the | 
|---|
| 539 | section the data is in, and a pointer to a relocation type | 
|---|
| 540 | descriptor. Relocation is performed by passing messages through | 
|---|
| 541 | the relocation type descriptor and the symbol pointer. Therefore, | 
|---|
| 542 | relocations can be performed on output data using a relocation | 
|---|
| 543 | method that is only available in one of the input formats. For | 
|---|
| 544 | instance, Oasys provides a byte relocation format.  A relocation | 
|---|
| 545 | record requesting this relocation type would point indirectly to a | 
|---|
| 546 | routine to perform this, so the relocation may be performed on a | 
|---|
| 547 | byte being written to a 68k COFF file, even though 68k COFF has no | 
|---|
| 548 | such relocation type. | 
|---|
| 549 |  | 
|---|
| 550 | _line numbers_ | 
|---|
| 551 | Object formats can contain, for debugging purposes, some form of | 
|---|
| 552 | mapping between symbols, source line numbers, and addresses in the | 
|---|
| 553 | output file.  These addresses have to be relocated along with the | 
|---|
| 554 | symbol information.  Each symbol with an associated list of line | 
|---|
| 555 | number records points to the first record of the list.  The head | 
|---|
| 556 | of a line number list consists of a pointer to the symbol, which | 
|---|
| 557 | allows finding out the address of the function whose line number | 
|---|
| 558 | is being described. The rest of the list is made up of pairs: | 
|---|
| 559 | offsets into the section and line numbers. Any format which can | 
|---|
| 560 | simply derive this information can pass it successfully between | 
|---|
| 561 | formats (COFF, IEEE and Oasys). | 
|---|
| 562 |  | 
|---|
| 563 |  | 
|---|
| 564 | File: ld.info,  Node: Reporting Bugs,  Next: MRI,  Prev: BFD,  Up: Top | 
|---|
| 565 |  | 
|---|
| 566 | Reporting Bugs | 
|---|
| 567 | ************** | 
|---|
| 568 |  | 
|---|
| 569 | Your bug reports play an essential role in making `ld' reliable. | 
|---|
| 570 |  | 
|---|
| 571 | Reporting a bug may help you by bringing a solution to your problem, | 
|---|
| 572 | or it may not.  But in any case the principal function of a bug report | 
|---|
| 573 | is to help the entire community by making the next version of `ld' work | 
|---|
| 574 | better.  Bug reports are your contribution to the maintenance of `ld'. | 
|---|
| 575 |  | 
|---|
| 576 | In order for a bug report to serve its purpose, you must include the | 
|---|
| 577 | information that enables us to fix the bug. | 
|---|
| 578 |  | 
|---|
| 579 | * Menu: | 
|---|
| 580 |  | 
|---|
| 581 | * Bug Criteria::                Have you found a bug? | 
|---|
| 582 | * Bug Reporting::               How to report bugs | 
|---|
| 583 |  | 
|---|
| 584 |  | 
|---|
| 585 | File: ld.info,  Node: Bug Criteria,  Next: Bug Reporting,  Up: Reporting Bugs | 
|---|
| 586 |  | 
|---|
| 587 | Have You Found a Bug? | 
|---|
| 588 | ===================== | 
|---|
| 589 |  | 
|---|
| 590 | If you are not sure whether you have found a bug, here are some | 
|---|
| 591 | guidelines: | 
|---|
| 592 |  | 
|---|
| 593 | * If the linker gets a fatal signal, for any input whatever, that is | 
|---|
| 594 | a `ld' bug.  Reliable linkers never crash. | 
|---|
| 595 |  | 
|---|
| 596 | * If `ld' produces an error message for valid input, that is a bug. | 
|---|
| 597 |  | 
|---|
| 598 | * If `ld' does not produce an error message for invalid input, that | 
|---|
| 599 | may be a bug.  In the general case, the linker can not verify that | 
|---|
| 600 | object files are correct. | 
|---|
| 601 |  | 
|---|
| 602 | * If you are an experienced user of linkers, your suggestions for | 
|---|
| 603 | improvement of `ld' are welcome in any case. | 
|---|
| 604 |  | 
|---|
| 605 |  | 
|---|
| 606 | File: ld.info,  Node: Bug Reporting,  Prev: Bug Criteria,  Up: Reporting Bugs | 
|---|
| 607 |  | 
|---|
| 608 | How to Report Bugs | 
|---|
| 609 | ================== | 
|---|
| 610 |  | 
|---|
| 611 | A number of companies and individuals offer support for GNU | 
|---|
| 612 | products.  If you obtained `ld' from a support organization, we | 
|---|
| 613 | recommend you contact that organization first. | 
|---|
| 614 |  | 
|---|
| 615 | You can find contact information for many support companies and | 
|---|
| 616 | individuals in the file `etc/SERVICE' in the GNU Emacs distribution. | 
|---|
| 617 |  | 
|---|
| 618 | Otherwise, send bug reports for `ld' to `bug-binutils@gnu.org'. | 
|---|
| 619 |  | 
|---|
| 620 | The fundamental principle of reporting bugs usefully is this: | 
|---|
| 621 | *report all the facts*.  If you are not sure whether to state a fact or | 
|---|
| 622 | leave it out, state it! | 
|---|
| 623 |  | 
|---|
| 624 | Often people omit facts because they think they know what causes the | 
|---|
| 625 | problem and assume that some details do not matter.  Thus, you might | 
|---|
| 626 | assume that the name of a symbol you use in an example does not matter. | 
|---|
| 627 | Well, probably it does not, but one cannot be sure.  Perhaps the bug | 
|---|
| 628 | is a stray memory reference which happens to fetch from the location | 
|---|
| 629 | where that name is stored in memory; perhaps, if the name were | 
|---|
| 630 | different, the contents of that location would fool the linker into | 
|---|
| 631 | doing the right thing despite the bug.  Play it safe and give a | 
|---|
| 632 | specific, complete example.  That is the easiest thing for you to do, | 
|---|
| 633 | and the most helpful. | 
|---|
| 634 |  | 
|---|
| 635 | Keep in mind that the purpose of a bug report is to enable us to fix | 
|---|
| 636 | the bug if it is new to us.  Therefore, always write your bug reports | 
|---|
| 637 | on the assumption that the bug has not been reported previously. | 
|---|
| 638 |  | 
|---|
| 639 | Sometimes people give a few sketchy facts and ask, "Does this ring a | 
|---|
| 640 | bell?"  This cannot help us fix a bug, so it is basically useless.  We | 
|---|
| 641 | respond by asking for enough details to enable us to investigate.  You | 
|---|
| 642 | might as well expedite matters by sending them to begin with. | 
|---|
| 643 |  | 
|---|
| 644 | To enable us to fix the bug, you should include all these things: | 
|---|
| 645 |  | 
|---|
| 646 | * The version of `ld'.  `ld' announces it if you start it with the | 
|---|
| 647 | `--version' argument. | 
|---|
| 648 |  | 
|---|
| 649 | Without this, we will not know whether there is any point in | 
|---|
| 650 | looking for the bug in the current version of `ld'. | 
|---|
| 651 |  | 
|---|
| 652 | * Any patches you may have applied to the `ld' source, including any | 
|---|
| 653 | patches made to the `BFD' library. | 
|---|
| 654 |  | 
|---|
| 655 | * The type of machine you are using, and the operating system name | 
|---|
| 656 | and version number. | 
|---|
| 657 |  | 
|---|
| 658 | * What compiler (and its version) was used to compile `ld'--e.g. | 
|---|
| 659 | "`gcc-2.7'". | 
|---|
| 660 |  | 
|---|
| 661 | * The command arguments you gave the linker to link your example and | 
|---|
| 662 | observe the bug.  To guarantee you will not omit something | 
|---|
| 663 | important, list them all.  A copy of the Makefile (or the output | 
|---|
| 664 | from make) is sufficient. | 
|---|
| 665 |  | 
|---|
| 666 | If we were to try to guess the arguments, we would probably guess | 
|---|
| 667 | wrong and then we might not encounter the bug. | 
|---|
| 668 |  | 
|---|
| 669 | * A complete input file, or set of input files, that will reproduce | 
|---|
| 670 | the bug.  It is generally most helpful to send the actual object | 
|---|
| 671 | files provided that they are reasonably small.  Say no more than | 
|---|
| 672 | 10K.  For bigger files you can either make them available by FTP | 
|---|
| 673 | or HTTP or else state that you are willing to send the object | 
|---|
| 674 | file(s) to whomever requests them.  (Note - your email will be | 
|---|
| 675 | going to a mailing list, so we do not want to clog it up with | 
|---|
| 676 | large attachments).  But small attachments are best. | 
|---|
| 677 |  | 
|---|
| 678 | If the source files were assembled using `gas' or compiled using | 
|---|
| 679 | `gcc', then it may be OK to send the source files rather than the | 
|---|
| 680 | object files.  In this case, be sure to say exactly what version of | 
|---|
| 681 | `gas' or `gcc' was used to produce the object files.  Also say how | 
|---|
| 682 | `gas' or `gcc' were configured. | 
|---|
| 683 |  | 
|---|
| 684 | * A description of what behavior you observe that you believe is | 
|---|
| 685 | incorrect.  For example, "It gets a fatal signal." | 
|---|
| 686 |  | 
|---|
| 687 | Of course, if the bug is that `ld' gets a fatal signal, then we | 
|---|
| 688 | will certainly notice it.  But if the bug is incorrect output, we | 
|---|
| 689 | might not notice unless it is glaringly wrong.  You might as well | 
|---|
| 690 | not give us a chance to make a mistake. | 
|---|
| 691 |  | 
|---|
| 692 | Even if the problem you experience is a fatal signal, you should | 
|---|
| 693 | still say so explicitly.  Suppose something strange is going on, | 
|---|
| 694 | such as, your copy of `ld' is out of synch, or you have | 
|---|
| 695 | encountered a bug in the C library on your system.  (This has | 
|---|
| 696 | happened!)  Your copy might crash and ours would not.  If you told | 
|---|
| 697 | us to expect a crash, then when ours fails to crash, we would know | 
|---|
| 698 | that the bug was not happening for us.  If you had not told us to | 
|---|
| 699 | expect a crash, then we would not be able to draw any conclusion | 
|---|
| 700 | from our observations. | 
|---|
| 701 |  | 
|---|
| 702 | * If you wish to suggest changes to the `ld' source, send us context | 
|---|
| 703 | diffs, as generated by `diff' with the `-u', `-c', or `-p' option. | 
|---|
| 704 | Always send diffs from the old file to the new file.  If you even | 
|---|
| 705 | discuss something in the `ld' source, refer to it by context, not | 
|---|
| 706 | by line number. | 
|---|
| 707 |  | 
|---|
| 708 | The line numbers in our development sources will not match those | 
|---|
| 709 | in your sources.  Your line numbers would convey no useful | 
|---|
| 710 | information to us. | 
|---|
| 711 |  | 
|---|
| 712 | Here are some things that are not necessary: | 
|---|
| 713 |  | 
|---|
| 714 | * A description of the envelope of the bug. | 
|---|
| 715 |  | 
|---|
| 716 | Often people who encounter a bug spend a lot of time investigating | 
|---|
| 717 | which changes to the input file will make the bug go away and which | 
|---|
| 718 | changes will not affect it. | 
|---|
| 719 |  | 
|---|
| 720 | This is often time consuming and not very useful, because the way | 
|---|
| 721 | we will find the bug is by running a single example under the | 
|---|
| 722 | debugger with breakpoints, not by pure deduction from a series of | 
|---|
| 723 | examples.  We recommend that you save your time for something else. | 
|---|
| 724 |  | 
|---|
| 725 | Of course, if you can find a simpler example to report _instead_ | 
|---|
| 726 | of the original one, that is a convenience for us.  Errors in the | 
|---|
| 727 | output will be easier to spot, running under the debugger will take | 
|---|
| 728 | less time, and so on. | 
|---|
| 729 |  | 
|---|
| 730 | However, simplification is not vital; if you do not want to do | 
|---|
| 731 | this, report the bug anyway and send us the entire test case you | 
|---|
| 732 | used. | 
|---|
| 733 |  | 
|---|
| 734 | * A patch for the bug. | 
|---|
| 735 |  | 
|---|
| 736 | A patch for the bug does help us if it is a good one.  But do not | 
|---|
| 737 | omit the necessary information, such as the test case, on the | 
|---|
| 738 | assumption that a patch is all we need.  We might see problems | 
|---|
| 739 | with your patch and decide to fix the problem another way, or we | 
|---|
| 740 | might not understand it at all. | 
|---|
| 741 |  | 
|---|
| 742 | Sometimes with a program as complicated as `ld' it is very hard to | 
|---|
| 743 | construct an example that will make the program follow a certain | 
|---|
| 744 | path through the code.  If you do not send us the example, we will | 
|---|
| 745 | not be able to construct one, so we will not be able to verify | 
|---|
| 746 | that the bug is fixed. | 
|---|
| 747 |  | 
|---|
| 748 | And if we cannot understand what bug you are trying to fix, or why | 
|---|
| 749 | your patch should be an improvement, we will not install it.  A | 
|---|
| 750 | test case will help us to understand. | 
|---|
| 751 |  | 
|---|
| 752 | * A guess about what the bug is or what it depends on. | 
|---|
| 753 |  | 
|---|
| 754 | Such guesses are usually wrong.  Even we cannot guess right about | 
|---|
| 755 | such things without first using the debugger to find the facts. | 
|---|
| 756 |  | 
|---|
| 757 |  | 
|---|
| 758 | File: ld.info,  Node: MRI,  Next: GNU Free Documentation License,  Prev: Reporting Bugs,  Up: Top | 
|---|
| 759 |  | 
|---|
| 760 | MRI Compatible Script Files | 
|---|
| 761 | *************************** | 
|---|
| 762 |  | 
|---|
| 763 | To aid users making the transition to GNU `ld' from the MRI linker, | 
|---|
| 764 | `ld' can use MRI compatible linker scripts as an alternative to the | 
|---|
| 765 | more general-purpose linker scripting language described in *Note | 
|---|
| 766 | Scripts::.  MRI compatible linker scripts have a much simpler command | 
|---|
| 767 | set than the scripting language otherwise used with `ld'.  GNU `ld' | 
|---|
| 768 | supports the most commonly used MRI linker commands; these commands are | 
|---|
| 769 | described here. | 
|---|
| 770 |  | 
|---|
| 771 | In general, MRI scripts aren't of much use with the `a.out' object | 
|---|
| 772 | file format, since it only has three sections and MRI scripts lack some | 
|---|
| 773 | features to make use of them. | 
|---|
| 774 |  | 
|---|
| 775 | You can specify a file containing an MRI-compatible script using the | 
|---|
| 776 | `-c' command-line option. | 
|---|
| 777 |  | 
|---|
| 778 | Each command in an MRI-compatible script occupies its own line; each | 
|---|
| 779 | command line starts with the keyword that identifies the command (though | 
|---|
| 780 | blank lines are also allowed for punctuation).  If a line of an | 
|---|
| 781 | MRI-compatible script begins with an unrecognized keyword, `ld' issues | 
|---|
| 782 | a warning message, but continues processing the script. | 
|---|
| 783 |  | 
|---|
| 784 | Lines beginning with `*' are comments. | 
|---|
| 785 |  | 
|---|
| 786 | You can write these commands using all upper-case letters, or all | 
|---|
| 787 | lower case; for example, `chip' is the same as `CHIP'.  The following | 
|---|
| 788 | list shows only the upper-case form of each command. | 
|---|
| 789 |  | 
|---|
| 790 | `ABSOLUTE SECNAME' | 
|---|
| 791 | `ABSOLUTE SECNAME, SECNAME, ... SECNAME' | 
|---|
| 792 | Normally, `ld' includes in the output file all sections from all | 
|---|
| 793 | the input files.  However, in an MRI-compatible script, you can | 
|---|
| 794 | use the `ABSOLUTE' command to restrict the sections that will be | 
|---|
| 795 | present in your output program.  If the `ABSOLUTE' command is used | 
|---|
| 796 | at all in a script, then only the sections named explicitly in | 
|---|
| 797 | `ABSOLUTE' commands will appear in the linker output.  You can | 
|---|
| 798 | still use other input sections (whatever you select on the command | 
|---|
| 799 | line, or using `LOAD') to resolve addresses in the output file. | 
|---|
| 800 |  | 
|---|
| 801 | `ALIAS OUT-SECNAME, IN-SECNAME' | 
|---|
| 802 | Use this command to place the data from input section IN-SECNAME | 
|---|
| 803 | in a section called OUT-SECNAME in the linker output file. | 
|---|
| 804 |  | 
|---|
| 805 | IN-SECNAME may be an integer. | 
|---|
| 806 |  | 
|---|
| 807 | `ALIGN SECNAME = EXPRESSION' | 
|---|
| 808 | Align the section called SECNAME to EXPRESSION.  The EXPRESSION | 
|---|
| 809 | should be a power of two. | 
|---|
| 810 |  | 
|---|
| 811 | `BASE EXPRESSION' | 
|---|
| 812 | Use the value of EXPRESSION as the lowest address (other than | 
|---|
| 813 | absolute addresses) in the output file. | 
|---|
| 814 |  | 
|---|
| 815 | `CHIP EXPRESSION' | 
|---|
| 816 | `CHIP EXPRESSION, EXPRESSION' | 
|---|
| 817 | This command does nothing; it is accepted only for compatibility. | 
|---|
| 818 |  | 
|---|
| 819 | `END' | 
|---|
| 820 | This command does nothing whatever; it's only accepted for | 
|---|
| 821 | compatibility. | 
|---|
| 822 |  | 
|---|
| 823 | `FORMAT OUTPUT-FORMAT' | 
|---|
| 824 | Similar to the `OUTPUT_FORMAT' command in the more general linker | 
|---|
| 825 | language, but restricted to one of these output formats: | 
|---|
| 826 |  | 
|---|
| 827 | 1. S-records, if OUTPUT-FORMAT is `S' | 
|---|
| 828 |  | 
|---|
| 829 | 2. IEEE, if OUTPUT-FORMAT is `IEEE' | 
|---|
| 830 |  | 
|---|
| 831 | 3. COFF (the `coff-m68k' variant in BFD), if OUTPUT-FORMAT is | 
|---|
| 832 | `COFF' | 
|---|
| 833 |  | 
|---|
| 834 | `LIST ANYTHING...' | 
|---|
| 835 | Print (to the standard output file) a link map, as produced by the | 
|---|
| 836 | `ld' command-line option `-M'. | 
|---|
| 837 |  | 
|---|
| 838 | The keyword `LIST' may be followed by anything on the same line, | 
|---|
| 839 | with no change in its effect. | 
|---|
| 840 |  | 
|---|
| 841 | `LOAD FILENAME' | 
|---|
| 842 | `LOAD FILENAME, FILENAME, ... FILENAME' | 
|---|
| 843 | Include one or more object file FILENAME in the link; this has the | 
|---|
| 844 | same effect as specifying FILENAME directly on the `ld' command | 
|---|
| 845 | line. | 
|---|
| 846 |  | 
|---|
| 847 | `NAME OUTPUT-NAME' | 
|---|
| 848 | OUTPUT-NAME is the name for the program produced by `ld'; the | 
|---|
| 849 | MRI-compatible command `NAME' is equivalent to the command-line | 
|---|
| 850 | option `-o' or the general script language command `OUTPUT'. | 
|---|
| 851 |  | 
|---|
| 852 | `ORDER SECNAME, SECNAME, ... SECNAME' | 
|---|
| 853 | `ORDER SECNAME SECNAME SECNAME' | 
|---|
| 854 | Normally, `ld' orders the sections in its output file in the order | 
|---|
| 855 | in which they first appear in the input files.  In an | 
|---|
| 856 | MRI-compatible script, you can override this ordering with the | 
|---|
| 857 | `ORDER' command.  The sections you list with `ORDER' will appear | 
|---|
| 858 | first in your output file, in the order specified. | 
|---|
| 859 |  | 
|---|
| 860 | `PUBLIC NAME=EXPRESSION' | 
|---|
| 861 | `PUBLIC NAME,EXPRESSION' | 
|---|
| 862 | `PUBLIC NAME EXPRESSION' | 
|---|
| 863 | Supply a value (EXPRESSION) for external symbol NAME used in the | 
|---|
| 864 | linker input files. | 
|---|
| 865 |  | 
|---|
| 866 | `SECT SECNAME, EXPRESSION' | 
|---|
| 867 | `SECT SECNAME=EXPRESSION' | 
|---|
| 868 | `SECT SECNAME EXPRESSION' | 
|---|
| 869 | You can use any of these three forms of the `SECT' command to | 
|---|
| 870 | specify the start address (EXPRESSION) for section SECNAME.  If | 
|---|
| 871 | you have more than one `SECT' statement for the same SECNAME, only | 
|---|
| 872 | the _first_ sets the start address. | 
|---|
| 873 |  | 
|---|