A patch for STV_PROTECTED
H . J . Lu
hjl@valinux.com
Sun May 21 17:44:00 GMT 2000
On Sun, May 21, 2000 at 04:57:30PM -0700, Ulrich Drepper wrote:
> "H . J . Lu" <hjl@valinux.com> writes:
>
> > This patch may not be 100% correct. But it passed all the visibility
> > tests in today's binutils from CVS.
>
> Why do you assume the binutils tests are correct? Send me a test case
> and I'll take a look. I have no time looking at the binutils test
> suite.
>
This is the second testcase.
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-05-21 17:41 PDT by <hjl@osmium.su.varesearch.com>.
# Source directory was `/home/hjl/bugs/gas/protected1'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 41 -rw-r--r-- bar.c
# 83 -rw-r--r-- foo.c
# 292 -rw-r--r-- main.c
# 752 -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 _sh08576; 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' &&
const char *barxxx = "Hello from bar.c";
SHAR_EOF
(set 20 00 05 19 14 55 08 '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'
99220857605ca400feea0345d7362b1d bar.c
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'bar.c'`"
test 41 -eq "$shar_count" ||
$echo 'bar.c:' 'original size' '41,' 'current size' "$shar_count!"
fi
fi
# ============= foo.c ==============
if test -f 'foo.c' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'foo.c' '(file already exists)'
else
$echo 'x -' extracting 'foo.c' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'foo.c' &&
const char *barxxx = "Hello from foo.c";
X
const char *
foo ()
{
X return barxxx;
}
SHAR_EOF
(set 20 00 05 19 14 53 51 'foo.c'; eval "$shar_touch") &&
chmod 0644 'foo.c' ||
$echo 'restore of' 'foo.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 'foo.c:' 'MD5 check failed'
532d006c190a316a72de8b57b1046665 foo.c
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'foo.c'`"
test 83 -eq "$shar_count" ||
$echo 'foo.c:' 'original size' '83,' '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 <stdlib.h>
X
const char * foo ();
const char * barxxx;
X
int
main ()
{
X printf ("bar: %p, %s\n", barxxx, barxxx);
X printf ("foo (): %p, %s\n", foo (), foo ());
#ifdef FOOBAR
X if (barxxx == foo ())
#else
X if (barxxx != foo ())
#endif
X abort ();
X
X return 0;
}
SHAR_EOF
(set 20 00 05 19 17 37 24 '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'
50e570d3a4243ffa51e919055dcdd6a2 main.c
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'main.c'`"
test 292 -eq "$shar_count" ||
$echo 'main.c:' 'original size' '292,' '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
#LDFLAGS=-Wl,-Bsymbolic
X
PROGS= foo bar foobar
X
all: $(PROGS)
X for f in $(PROGS); do echo "Running: $$f"; ./$$f; \
X if [ $$? != 0 ]; then echo Failed; fi; done
X
foo: libfoo.so main.c
X $(CC) -o $@ $(CFLAGS) $^ -Wl,-rpath,.
X
foobar: libbar.so bar.c main.c
X $(CC) -o $@ -DFOOBAR $(CFLAGS) $^ -Wl,-rpath,.
X
bar: libbar.so main.c
X $(CC) -o $@ $(CFLAGS) $^ -Wl,-rpath,.
X
libfoo.so: foo.o
X $(CC) -shared -o $@ $(CFLAGS) $^
X
libbar.so: bar.o
X $(CC) $(LDFLAGS) -shared -o $@ $(CFLAGS) $^
X
libfoo.so: foo.o
X
foo.o: foo.c
X $(CC) -c $^ $(PIC) $(CFLAGS)
X
bar.o: bar.s
X $(CC) -c $^
X
bar.s: foo.c
X $(CC) -S -o $@ $(PIC) $(CFLAGS) $^
X echo ".protected barxxx" >> $@
X
clean:
X rm -f $(PROGS) *.so *.o *.s
X
X
shar:
X shar *.c Makefile > bug.shar
SHAR_EOF
(set 20 00 05 19 20 25 10 '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'
1f142648e9dbd93eeda8e647d770e158 Makefile
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'Makefile'`"
test 752 -eq "$shar_count" ||
$echo 'Makefile:' 'original size' '752,' 'current size' "$shar_count!"
fi
fi
rm -fr _sh08576
exit 0
More information about the Libc-hacker
mailing list