Copyright (C) 2000-2012 |
GNU Info (ld.info)File CommandsCommands dealing with files --------------------------- Several linker script commands deal with files. `INCLUDE FILENAME' Include the linker script FILENAME at this point. The file will be searched for in the current directory, and in any directory specified with the `-L' option. You can nest calls to `INCLUDE' up to 10 levels deep. `INPUT(FILE, FILE, ...)' `INPUT(FILE FILE ...)' The `INPUT' command directs the linker to include the named files in the link, as though they were named on the command line. For example, if you always want to include `subr.o' any time you do a link, but you can't be bothered to put it on every link command line, then you can put `INPUT (subr.o)' in your linker script. In fact, if you like, you can list all of your input files in the linker script, and then invoke the linker with nothing but a `-T' option. The linker will first try to open the file in the current directory. If it is not found, the linker will search through the archive library search path. See the description of `-L' in Note: Command Line Options. If you use `INPUT (-lFILE)', `ld' will transform the name to `libFILE.a', as with the command line argument `-l'. When you use the `INPUT' command in an implicit linker script, the files will be included in the link at the point at which the linker script file is included. This can affect archive searching. `GROUP(FILE, FILE, ...)' `GROUP(FILE FILE ...)' The `GROUP' command is like `INPUT', except that the named files should all be archives, and they are searched repeatedly until no new undefined references are created. See the description of `-(' in Note: Command Line Options. `OUTPUT(FILENAME)' The `OUTPUT' command names the output file. Using `OUTPUT(FILENAME)' in the linker script is exactly like using `-o FILENAME' on the command line (*note Command Line Options: Options.). If both are used, the command line option takes precedence. You can use the `OUTPUT' command to define a default name for the output file other than the usual default of `a.out'. `SEARCH_DIR(PATH)' The `SEARCH_DIR' command adds PATH to the list of paths where `ld' looks for archive libraries. Using `SEARCH_DIR(PATH)' is exactly like using `-L PATH' on the command line (Note: Command Line Options.). If both are used, then the linker will search both paths. Paths specified using the command line option are searched first. `STARTUP(FILENAME)' The `STARTUP' command is just like the `INPUT' command, except that FILENAME will become the first input file to be linked, as though it were specified first on the command line. This may be useful when using a system in which the entry point is always the start of the first file. automatically generated by info2www version 1.2.2.9 |