This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: ld input file and INPUT command - file location problem
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Galit Heller <Galit dot Heller at nsc dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Tue, 28 Oct 2003 00:52:34 +1030
- Subject: Re: ld input file and INPUT command - file location problem
- References: <3F9BA45B.4AC81F2C@nsc.com>
On Sun, Oct 26, 2003 at 12:39:23PM +0200, Galit Heller wrote:
> When a library file is the argument to INPUT command, the archive library
> search path is searched, and the archive is found. However, for object
> files the search path isn't searched. E.g. if file.o resides in .., and
> -L.. is used in the command line, and the linker script has the line:
>
> INPUT(file.o)
>
> then ld returns the following error:
> "cannot open file.o": No such file or directory".
>
> This is in contrast to the ld user manual 3.4.2 INPUT command description:
>
> "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."
>
> Is the second sentence above true only for library files ?
Yes. The treatment of files specified in INPUT statements is consistent
with the treatment of files on the command line.
> SECTIONS {
>
> .text : { library.a(.text) }
> }
>
> then ld returns
> "cannot open library.a": No such file or directory".
>From memory, I don't think that it's possible to specify an archive file
as an input section spec. The linker expects object file names here
(which might be matched by object files withing an archive).
--
Alan Modra
IBM OzLabs - Linux Technology Centre