ld input file and INPUT command - file location problem

Galit Heller Galit.Heller@nsc.com
Sun Oct 26 10:39:00 GMT 2003


Hi,

ld seems to have 2 problems in locating files which reside in the archive
library search path (and not in the current directory):

First:
-----

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 ?

Second:
------

When library or object file which resides in the archive library search
path appears in the input file specification, e.g.

SECTIONS {

        .text : { library.a(.text) }
}

then ld returns
"cannot open library.a": No such file or directory".

The same is true for object files as well.

This happens even when using the command INPUT(library.a) at the top of the
linker script, or when specifying full_path/library.a on the ld command line.

This behavior contrasts the ld user manual 3.6.4.1:

"When you use a file name which does not contain any wild card characters,
the linker will first see if you also specified the file name on the linker
command line or in an INPUT command. If you did not, the linker will attempt
to open the file as an input file, as though it appeared on the command line."

Doesn't the first sentence above mean that the references in INPUT command or
the command line should have caused the file to be found ?


Regards,
Galit.



More information about the Binutils mailing list