From mboxrd@z Thu Jan 1 00:00:00 1970 From: "H . J . Lu" To: Ulrich Drepper Cc: Mark Kettenis , nickc@cygnus.com, binutils@sourceware.cygnus.com Subject: Re: Bug in dynamic linker Date: Thu, 20 Jul 2000 10:02:00 -0000 Message-id: <20000720100224.A6059@lucon.org> References: <200007201306.PAA10937@debye.wins.uva.nl> <20000720095113.A6016@lucon.org> X-SW-Source: 2000-07/msg00311.html On Thu, Jul 20, 2000 at 09:56:32AM -0700, Ulrich Drepper wrote: > "H . J . Lu" writes: > > > > I agree with Mark. The proposed change is creating much more severe > > > problems than it's solving. > > > > Please show me the problem. A testcase will be very nice. > > Mark described it: > > - liba.so is built using libb.so (i.e., has a DT_NEEDED entry) > > - program foo is linked with liba.so > > - new version of liba.so out; same interface, but does not use libb.so > anymore; libb.so is removed > Have you tried binutils from CVS today to see what it does? As I have said, I have verified that program foo WON'T have a DT_NEEDED entry for libb.so unless program foo uses symbols from libb.so directly. As I said before, please send me a testcase to show it is not the case. BTW, I am enclosing my testcase here. Thanks. 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-07-20 10:00 PDT by . # Source directory was `/home/hjl/bugs/gas/needed'. # # Existing files will *not* be overwritten unless `-c' is specified. # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 131 -rw-r--r-- test.c # 218 -rw-r--r-- threadlib.c # 207 -rw-r--r-- threadtest.c # 696 -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 _sh31904; then $echo 'x -' 'creating lock directory' else $echo 'failed to create lock directory' exit 1 fi # ============= test.c ============== if test -f 'test.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'test.c' '(file already exists)' else $echo 'x -' extracting 'test.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'test.c' && #include X extern int dummy(void); X int main(int argc, char **argv) { X printf("spec = %d\n", dummy()); X return 0; } SHAR_EOF (set 20 00 07 18 14 15 54 'test.c'; eval "$shar_touch") && chmod 0644 'test.c' || $echo 'restore of' 'test.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 'test.c:' 'MD5 check failed' 4b6bed819d069a08ecdba10903aac6b2 test.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'test.c'`" test 131 -eq "$shar_count" || $echo 'test.c:' 'original size' '131,' 'current size' "$shar_count!" fi fi # ============= threadlib.c ============== if test -f 'threadlib.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'threadlib.c' '(file already exists)' else $echo 'x -' extracting 'threadlib.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'threadlib.c' && #include X pthread_key_t mykey; X int dummy(void) { X int spec; X X pthread_key_create(&mykey, NULL); X pthread_setspecific(mykey, (void *)10); X spec = (int)pthread_getspecific(mykey); X return spec; } SHAR_EOF (set 20 00 07 18 11 33 03 'threadlib.c'; eval "$shar_touch") && chmod 0644 'threadlib.c' || $echo 'restore of' 'threadlib.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 'threadlib.c:' 'MD5 check failed' 19ecddd05773202c443a249d7583bc47 threadlib.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'threadlib.c'`" test 218 -eq "$shar_count" || $echo 'threadlib.c:' 'original size' '218,' 'current size' "$shar_count!" fi fi # ============= threadtest.c ============== if test -f 'threadtest.c' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'threadtest.c' '(file already exists)' else $echo 'x -' extracting 'threadtest.c' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'threadtest.c' && #include #include X extern int dummy(void); X pthread_t *me; X int main(int argc, char **argv) { X printf("spec = %d\n", dummy()); X me = (pthread_t *) pthread_self(); X return 0; } SHAR_EOF (set 20 00 07 18 11 36 40 'threadtest.c'; eval "$shar_touch") && chmod 0644 'threadtest.c' || $echo 'restore of' 'threadtest.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 'threadtest.c:' 'MD5 check failed' b9df452c72adac53de184bc4effa931a threadtest.c SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'threadtest.c'`" test 207 -eq "$shar_count" || $echo 'threadtest.c:' 'original size' '207,' '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' && CFLAGS=-O -B./ PIC=-fPIC NODELETE=-Wl,-z,nodelete X PROGS= threadtest test X all: $(PROGS) X for f in $(PROGS); do echo "Running: $$f"; ./$$f; \ X if [ $$? != 0 ]; then echo Failed; fi; done X for f in $(PROGS); do echo "Running: ldd $$f"; ldd ./$$f; \ X if [ $$? != 0 ]; then echo Failed; fi; done X threadtest: threadtest.o libthreadlib.so X $(CC) -o $@ $(CFLAGS) threadtest.o -L. -lthreadlib -Wl,-rpath,. X test: test.o libthreadlib.so X $(CC) -o $@ $(CFLAGS) test.o -L. -lthreadlib #-Wl,-rpath,. X libthreadlib.so: threadlib.c X $(CC) $(NODELETE) -shared -o $@ $(CFLAGS) $(PIC) $^ -lpthread X X.c.o: X $(CC) $(CFLAGS) -c $< X clean: X rm -f $(PROGS) *.so* *.o *.s *.a X shar: X shar *.c Makefile > bug.shar SHAR_EOF (set 20 00 07 19 14 33 41 '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' 2b653f2c654e24704696aa1416274039 Makefile SHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'Makefile'`" test 696 -eq "$shar_count" || $echo 'Makefile:' 'original size' '696,' 'current size' "$shar_count!" fi fi rm -fr _sh31904 exit 0