This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc 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]

Inconsistent behavior of ld.so


When a versioned definition is moved from one DSO to another, ld.so may
or may not give an error depending on where the definition is moved to.
If it is moved into a DSO before the original DSO, ld.so will be happy.
Otherwise, ld.so will complain. Here is a testcase:

[hjl@gnu 1]$ make
gcc -fPIC -shared -o libX_iny.so libX.c -Wl,--version-script,libX_iny.map
gcc -DXYZ -g -fPIC -shared -o libY_iny.so libY.c
-Wl,--version-script,libY_iny.map
ln -sf libX_iny.so libX.so; ln -sf libY_iny.so libY.so
gcc -o iny main.c libX.so libY.so -Wl,-rpath,.
gcc -DXYZ -fPIC -shared -o libX_inx.so libX.c -Wl,--version-script,libX_inx.map
gcc -fPIC -shared -o libY_inx.so libY.c -Wl,--version-script,libY_inx.map
ln -sf libX_inx.so libX.so; ln -sf libY_inx.so libY.so
gcc -o inx main.c libX.so libY.so -Wl,-rpath,.
echo "Testing with xyz() in libX"
Testing with xyz() in libX
ln -sf libX_inx.so libX.so; ln -sf libY_inx.so libY.so
./iny
X-xyz
echo "Testing with xyz() in libY"
Testing with xyz() in libY
ln -sf libX_iny.so libX.so; ln -sf libY_iny.so libY.so
./iny
Y-xyz
echo "Testing with xyz() in libX"
Testing with xyz() in libX
ln -sf libX_inx.so libX.so; ln -sf libY_inx.so libY.so
./inx
X-xyz
echo "Testing with xyz() in libY"
Testing with xyz() in libY
ln -sf libX_iny.so libX.so; ln -sf libY_iny.so libY.so
./inx
./inx: relocation error: ./inx: symbol xyz, version VER_1 not defined in file
libX.so with link time reference
make: *** [all] Error 127

If I add the strick check for version->filename when resolving a
reference, I get many "make check" failures in glibc. Is checking
version->filename really necessary?



H.J.

Attachment: test.tar.gz
Description: GNU Zip compressed data


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