This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
On Thu, Jun 15, 2000 at 12:01:24PM -0700, Ulrich Drepper wrote:
> "H . J . Lu" <hjl@lucon.org> writes:
>
> > Let me try to understand:
> >
> > 1. We want _*frame_* functions in glibc.
>
> Not necessarily. We want to use the functins from the main object.
> This way we can continue to use a glibc version even if this functions
> at some point change (and take care of compatibility themselves).
>
> > 2. We don't want to export them.
>
> See #1. If we cannot avoid having them in glibc (and only avoid using
> them), then we don't want to export them. But the scheme should in
> any case apply automatically too all DSO, even if not using versioning
> scripts.
>
> > 3. If the main object uses them, we want glibc to use copies in
> > the main object.
>
> Right.
>
> > 4. If the the main object doesn't use them, the copies in glibc will
> > be used.
>
> Hum, I cannot see how we can avoid using them in the main object but
> the way you describe it would also work.
>
> > 1. How to make glibc to use the ones from the main object and not
> > export them at the same time? I assume you will give them a non-default
> > version.
> > 2. What about DSOs which need them?
>
> I have not yet an answer to this. But you have to remember: the frame
> functions are called from the crtbegin files and we use different
> files in DSOs and the main object.
>
This is to show how my scheme works.
# make
gcc --shared -o libbar.so bar.c -fPIC
gcc --shared -o libref.so dummy.c -DDUMMY -fPIC
gcc -o t1 -Wl,-rpath,./ main.c libref.so -ldl
gcc --shared -o libnoref.so dummy.c -fPIC
gcc -o t2 -Wl,-rpath,./ main.c libnoref.so -ldl
gcc -DFOO -o t3 -Wl,-rpath,./ main.c libref.so -ldl
gcc -DFOO -o t4 -Wl,-rpath,./ main.c libnoref.so -ldl
./t1
foo in DSO
test in dummy
./t2
foo in DSO
test in dummy
./t3
foo in main
test in dummy
./t4
foo in DSO
test in dummy
H.J.
---
#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2.1).
# 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-06-15 12:30 PDT by <hjl@osmium.su.varesearch.com>.
# Source directory was `/home/hjl/bugs/gas/export'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 65 -rw-r--r-- bar.c
# 140 -rw-r--r-- dummy.c
# 496 -rw-r--r-- main.c
# 553 -rw-r--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
if touch -am -t 200112312359.59 $$.touch >/dev/null 2>&1 && test ! -f 200112312359.59 -a -f $$.touch; then
shar_touch='touch -am -t $1$2$3$4$5$6.$7 "$8"'
elif touch -am 123123592001.59 $$.touch >/dev/null 2>&1 && test ! -f 123123592001.59 -a ! -f 123123592001.5 -a -f $$.touch; then
shar_touch='touch -am $3$4$5$6$1$2.$7 "$8"'
elif touch -am 1231235901 $$.touch >/dev/null 2>&1 && test ! -f 1231235901 -a -f $$.touch; then
shar_touch='touch -am $3$4$5$6$2 "$8"'
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 200112312359.59 123123592001.59 123123592001.5 1231235901 $$.touch
#
if mkdir _sh25202; then
$echo 'x -' 'creating lock directory'
else
$echo 'failed to create lock directory'
exit 1
fi
# ============= bar.c ==============
if test -f 'bar.c' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'bar.c' '(file already exists)'
else
$echo 'x -' extracting 'bar.c' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'bar.c' &&
void
foo ()
{
X printf ("foo in DSO\n");
}
X
bar ()
{
X foo ();
}
SHAR_EOF
(set 20 00 06 15 12 08 50 'bar.c'; eval "$shar_touch") &&
chmod 0644 'bar.c' ||
$echo 'restore of' 'bar.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 'bar.c:' 'MD5 check failed'
133a281dcc6887be0b7f47e8b4c11fd6 bar.c
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'bar.c'`"
test 65 -eq "$shar_count" ||
$echo 'bar.c:' 'original size' '65,' 'current size' "$shar_count!"
fi
fi
# ============= dummy.c ==============
if test -f 'dummy.c' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'dummy.c' '(file already exists)'
else
$echo 'x -' extracting 'dummy.c' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'dummy.c' &&
#if DUMMY
extern void foo (void) __attribute__ ((weak));
X
static void (*dummy) () = &foo;
#endif
X
test ()
{
X printf ("test in dummy\n");
}
SHAR_EOF
(set 20 00 06 15 12 10 23 'dummy.c'; eval "$shar_touch") &&
chmod 0644 'dummy.c' ||
$echo 'restore of' 'dummy.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 'dummy.c:' 'MD5 check failed'
d89b10c038c17750aca4a1bd8b86941d dummy.c
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'dummy.c'`"
test 140 -eq "$shar_count" ||
$echo 'dummy.c:' 'original size' '140,' '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>
#include <dlfcn.h>
X
#ifdef FOO
void
foo ()
{
X printf ("foo in main\n");
}
#endif
X
int
main ()
{
X void *handle;
X void (*fptr)();
X
X handle = dlopen("./libbar.so", RTLD_LAZY);
X if (!handle)
X {
X printf("get handle error\n\t'%s'\n", dlerror());
X exit(1);
X }
X fptr = (void (*)())dlsym(handle, "bar");
X if(!fptr)
X {
X printf("get function error\n\t'%s'\n", dlerror());
X exit (1);
X }
X (*fptr) ();
X dlclose (handle);
X
X test ();
X
X return (0);
}
SHAR_EOF
(set 20 00 06 15 12 29 21 'main.c'; eval "$shar_touch") &&
chmod 0644 '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'
741ca1bccd9980bc1813c0fa0ccf4f50 main.c
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'main.c'`"
test 496 -eq "$shar_count" ||
$echo 'main.c:' 'original size' '496,' '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' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'Makefile' &&
all: libbar.so t1 t2 t3 t4
X ./t1
X ./t2
X ./t3
X ./t4
X
t1: main.c libref.so
X gcc $(LDFLAGS) -o $@ -Wl,-rpath,./ $^ -ldl
X
t2: main.c libnoref.so
X gcc $(LDFLAGS) -o $@ -Wl,-rpath,./ $^ -ldl
X
t3: main.c libref.so
X gcc -DFOO $(LDFLAGS) -o $@ -Wl,-rpath,./ $^ -ldl
X
t4: main.c libnoref.so
X gcc -DFOO $(LDFLAGS) -o $@ -Wl,-rpath,./ $^ -ldl
X
libbar.so: bar.c
X gcc --shared -o $@ $^ -fPIC
X
libref.so: dummy.c
X gcc --shared -o $@ $^ -DDUMMY -fPIC
X
libnoref.so: dummy.c
X gcc --shared -o $@ $^ -fPIC
X
clean:
X rm -f *.o *.so t?
X
shar:
X shar *.c Makefile > export.shar
SHAR_EOF
(set 20 00 06 15 12 30 09 'Makefile'; eval "$shar_touch") &&
chmod 0644 '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'
eb79a0b711175239371e8596cbd6307c Makefile
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'Makefile'`"
test 553 -eq "$shar_count" ||
$echo 'Makefile:' 'original size' '553,' 'current size' "$shar_count!"
fi
fi
rm -fr _sh25202
exit 0
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |