undefined symbol: __dso_handle with current CVS breaks C++
Martin v. Loewis
martin@loewis.home.cs.tu-berlin.de
Mon Apr 10 16:02:00 GMT 2000
> This bug is complex to explain, but the fix is very simple.
I'm not so sure it is that simple, though. Did you try building -fPIC
shared libraries containing hidden symbols with that patch?
I'll include a test case which I can't get to work with your patch. It
is important that the patched assembler and linker is used in each
compilation step; you may need to adapt the Makefile. If I made some
error in the code, please let me know. Essentially, this builds a
shared library which exports a function, which in turn calls a hidden
function. On my glibc 2.1.3 installation, this crashes in the dynamic
linker. readelf reports for the shared library
Relocation section '.rel.plt' at offset 0x5b8 contains 5 entries:
Offset Info Type Symbol's Value Symbol's Name
0000186c 01807 R_386_JUMP_SLOT 00000000 atexit
00001870 01b07 R_386_JUMP_SLOT 00000000 __register_frame_info
00001874 01e07 R_386_JUMP_SLOT 00000000 __deregister_frame_info
00001878 ffffff07 R_386_JUMP_SLOT bad symbol index: 00ffffff
0000187c 02707 R_386_JUMP_SLOT 00000000 __gmon_start__
My guess is that the "bad symbol index" is causing the ld.so crash;
this is the PLT slot for the hidden symbol. It may be possible to make
this work like hiding mechanism in symbol versioning, but that appears
to be more complex.
Anyway, please let me know what you find.
Regards,
Martin
#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 2000-04-11 00:48 CEST by <martin@mira>.
# Source directory was `/home/martin/tmp/hidden'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 47 -rw-rw-r-- exporter.c
# 75 -rw-rw-r-- importer.c
# 81 -rw-rw-r-- main.c
# 667 -rw-rw-r-- Makefile
#
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
if test "$gettext_dir" = FAILED && test -f $dir/gettext \
&& ($dir/gettext --version >/dev/null 2>&1)
then
set `$dir/gettext --version 2>&1`
if test "$3" = GNU
then
gettext_dir=$dir
fi
fi
if test "$locale_dir" = FAILED && test -f $dir/shar \
&& ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
then
locale_dir=`$dir/shar --print-text-domain-dir`
fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
echo=echo
else
TEXTDOMAINDIR=$locale_dir
export TEXTDOMAINDIR
TEXTDOMAIN=sharutils
export TEXTDOMAIN
echo="$gettext_dir/gettext -s"
fi
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
shar_touch=touch
else
shar_touch=:
echo
$echo 'WARNING: not restoring timestamps. Consider getting and'
$echo "installing GNU \`touch', distributed in GNU File Utilities..."
echo
fi
rm -f 1231235999 $$.touch
#
if mkdir _sh05571; then
$echo 'x -' 'creating lock directory'
else
$echo 'failed to create lock directory'
exit 1
fi
# ============= exporter.c ==============
if test -f 'exporter.c' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'exporter.c' '(file already exists)'
else
$echo 'x -' extracting 'exporter.c' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'exporter.c' &&
asm(".hidden foo");
int foo()
{
X return 42;
}
SHAR_EOF
$shar_touch -am 04110030100 'exporter.c' &&
chmod 0664 'exporter.c' ||
$echo 'restore of' 'exporter.c' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'exporter.c:' 'MD5 check failed'
5f6ae1450d16e7fce8a6a17bc0eb0921 exporter.c
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'exporter.c'`"
test 47 -eq "$shar_count" ||
$echo 'exporter.c:' 'original size' '47,' 'current size' "$shar_count!"
fi
fi
# ============= importer.c ==============
if test -f 'importer.c' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'importer.c' '(file already exists)'
else
$echo 'x -' extracting 'importer.c' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'importer.c' &&
asm(".hidden foo");
extern int foo();
X
int bar()
{
X return foo()*foo();
}
SHAR_EOF
$shar_touch -am 04110030100 'importer.c' &&
chmod 0664 'importer.c' ||
$echo 'restore of' 'importer.c' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'importer.c:' 'MD5 check failed'
b2101ef969c5f39d66848f338e916feb importer.c
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'importer.c'`"
test 75 -eq "$shar_count" ||
$echo 'importer.c:' 'original size' '75,' 'current size' "$shar_count!"
fi
fi
# ============= main.c ==============
if test -f 'main.c' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'main.c' '(file already exists)'
else
$echo 'x -' extracting 'main.c' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'main.c' &&
#include <stdio.h>
int bar();
int main()
{
X printf("%d\n",bar());
X return 0;
}
SHAR_EOF
$shar_touch -am 04110038100 'main.c' &&
chmod 0664 'main.c' ||
$echo 'restore of' 'main.c' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'main.c:' 'MD5 check failed'
cd56325918132fef227dd4b7ba087ced main.c
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'main.c'`"
test 81 -eq "$shar_count" ||
$echo 'main.c:' 'original size' '81,' 'current size' "$shar_count!"
fi
fi
# ============= Makefile ==============
if test -f 'Makefile' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'Makefile' '(file already exists)'
else
$echo 'x -' extracting 'Makefile' '(binary)'
sed 's/^X//' << 'SHAR_EOF' | uudecode &&
begin 600 Makefile
M0T,]9V-C("UG"D%3/2]U<W(O;&]C86PO;F5W86)I+V)I;B]A<PI,1#TO=7-R
M+VQO8V%L+VYE=V%B:2]B:6XO;&0*"G)U;CH)<')O9PH)+B]P<F]G"@IP<F]G
M.@EL:6)H:61D96XN<V\@;6%I;BYO"@DD*$-#*2`M;R!P<F]G(&UA:6XN;R!L
M:6)H:61D96XN<V\@+5=L+"U2+@H*;&EB:&ED9&5N+G-O.@EE>'!O<G1E<BYO
M(&EM<&]R=&5R+F\*"20H3$0I("UM(&5L9E]I,S@V("US:&%R960@+6\@;&EB
M:&ED9&5N+G-O("]U<W(O;&EB+V-R=&DN;R`O=7-R+VQI8B]G8V,M;&EB+VDU
M.#8M<&,M;&EN=7@M9VYU+S(N.34N,B]C<G1B96=I;E,N;R`M3"]U<W(O;&EB
M+V=C8RUL:6(O:34X-BUP8RUL:6YU>"UG;G4O,BXY-2XR("U,+W5S<B]I-3@V
M+7!C+6QI;G5X+6=N=2]L:6(@97AP;W)T97(N;R!I;7!O<G1E<BYO("UL9V-C
M("UL8R`M;&=C8R`O=7-R+VQI8B]G8V,M;&EB+VDU.#8M<&,M;&EN=7@M9VYU
M+S(N.34N,B]C<G1E;F13+F\@+W5S<B]L:6(O8W)T;BYO"@IE>'!O<G1E<BYO
M.@EE>'!O<G1E<BYC(`H))"A#0RD@+5,@+69024,@97AP;W)T97(N8PH))"A!
M4RD@+6\@97AP;W)T97(N;R!E>'!O<G1E<BYS"@II;7!O<G1E<BYO.@EI;7!O
M<G1E<BYC(`H))"A#0RD@+5,@+69024,@:6UP;W)T97(N8PH))"A!4RD@+6\@
E:6UP;W)T97(N;R!I;7!O<G1E<BYS"@IM86EN+F\Z(&UA:6XN8RA!
`
end
SHAR_EOF
$shar_touch -am 04110046100 'Makefile' &&
chmod 0664 'Makefile' ||
$echo 'restore of' 'Makefile' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'Makefile:' 'MD5 check failed'
9125f35bc3db60a896ca9dc815c5eada Makefile
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'Makefile'`"
test 667 -eq "$shar_count" ||
$echo 'Makefile:' 'original size' '667,' 'current size' "$shar_count!"
fi
fi
rm -fr _sh05571
exit 0
More information about the Gcc-bugs
mailing list