This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ld input file and INPUT command - file location problem


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]