Subject: Subtle problem with ld -r option and pic object files
To: netbsd-current-users <>
From: Thomas Eberhardt <>
List: current-users
Date: 08/08/1994 13:49:55
There seems to be a subtle problem with the -r option of ld(1) and
pic object files:  I had some fun this weekend with an X application which
uses the Xt library (which I had built, as all my other shared libraries,
with first compiling, then "ld -x -r" on the object files and finally
"ld -x -Bshareable ...").  The problems seems to be that during the "ld -x -r"
some relocations in the object file are turned from "global" to "local"
relocations and this is asking for trouble when a program that uses a shared
library built this way causes some of the shared library data items
to be flagged for "run-time copy" since references to these items from inside
of the shared library (i.e. in the same object file that also defines the
item) point to the shared library copy and not the run-time copy
after run-time linking!  Running the same application with a shared Xt
library built without "ld -x -r" works just fine.

/  Thomas Eberhardt <>  \            Moo!  (__)
| Center for Complex Systems and Visualization (CeVis) |_________/--------(oo)
|     University of Bremen, FB 3, Bibliothekstr. 1     |        * |______||\/
\_o_ D-28359 Bremen, Germany, FAX: +49 421 218-4236 _o_/          ^^     ^^