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]

ld problem


Hi,

I am trying to generate a shared library by linking an object file (.o)
an archive (.a) and some other shared library (.so) on a linux system.
When linking the object code (.o) file I want to force some symbols to
be undefined, such that they are linked from the archive, where they are
defined. If I use the -u option this is working. However, since I have a
number of symbols and don't want to list them all on the command line I
wanted to use a linker script, and that is not working for me at all.
The script basically has a bunch of EXTERN definitions in it, and
according to the documentation this is the same as -u on the command
line. Here is a snippet.

EXTERN(ucorr_);
EXTERN(uel_);
EXTERN(uexpan_);
EXTERN(uexternaldb_);
EXTERN(ufield_);
EXTERN(ufluid_);

There are no complaints during linking, but when I try to load the
library created with this linker script I get the following error.

error while loading shared libraries: undefined symbol: uexternaldb_

Now if I use the same link command with the exception of replacing the
link script name with a -u uexternaldb_ everything works as expected.
What am I messing up here?

The info pages state the following:

`EXTERN(SYMBOL SYMBOL ...)'
     Force SYMBOL to be entered in the output file as an undefined
     symbol.  Doing this may, for example, trigger linking of additional

     modules from standard libraries.  You may list several SYMBOLs for
     each `EXTERN', and you may use `EXTERN' multiple times.  This
     command has the same effect as the `-u' command-line option.

Any help is much appreciated. This is on a SuSE 7.1 and RedHat 6.2
system

SuSE:
ld -v
GNU ld version 2.10.91 (with BFD 2.10.0.33)

RedHat:
ld -v
GNU ld version 2.9.5 (with BFD 2.9.5.0.22)


Thanks,
Robert

--
Robert Schweikert                   MAY THE SOURCE BE WITH YOU
                                              LINUX




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