This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


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

Re: Symbol visibility revised


On Mon, May 01, 2000 at 09:12:38PM +0200, Martin v. Loewis wrote:
> > That is incorrect. At our last ABI meeting, we have cleared that
> > confusion. We decided that the normal symbol resolution shouldn't
> > be changed due to STV_PROTECTED. That means we cannot do it in the
> > way of DT_SYMBOLIC. The PLT entry has to be there and the dynamic
> > linker has to support it.
> 
> Can you provide the modified wording for STV_PROTECTED? What is the

I don't have exact words. We are waiting for the revision from SCO.

> "normal symbol resolution"? Can you give an example where this
> implementation of STV_PROTECTED would differ from the new
> interpretation of that feature? If there was a change, what is the
> difference between a protected symbol, and one that isn't?
> 

Basically, the function pointer should work as usual if there is
only one definition of the STV_PROTECTED symbol. I brought it up
in the last meeting. That is why I believe the dynamic linker has
to check at the run-time for STV_PROTECTED. If there is no other
definition or it is chosen by the normal symbol resolution, a
protected symbol behaves the same as the global symbol. You can
compare its function pointer. With symbolic, you can get different
function pointers inside and outside of DSO, although they lead to
the same function.

Here is the testcase.


-- 
H.J. Lu (hjl@gnu.org)
--
#!/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-01 12:36 PDT by <hjl@osmium.su.varesearch.com>.
# Source directory was `/home/hjl/bugs/gas/protected'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode       name
# ------ ---------- ------------------------------------------
#     49 -rw-r--r-- bar.c
#    159 -rw-r--r-- foo.c
#    125 -rw-r--r-- main.c
#    711 -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 _sh06573; 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
bar ()
{
X  printf ("Hello from bar.c\n");
}
SHAR_EOF
  (set 20 00 05 01 12 32 45 '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'
5f5c6ded997364ba3358e596d7bf1848  bar.c
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'bar.c'`"
    test 49 -eq "$shar_count" ||
    $echo 'bar.c:' 'original size' '49,' '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' &&
static int called = 0;
X
void
bar ()
{
X  called = 1;
X  printf ("Hello from foo.c\n");
}
X
void *
foo ()
{
X  bar ();
X  if (!called)
X    abort ();
X  return bar;
}
SHAR_EOF
  (set 20 00 05 01 12 34 54 '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'
6cd25fcc4e24e85c28a41d2e4eee840a  foo.c
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'foo.c'`"
    test 159 -eq "$shar_count" ||
    $echo 'foo.c:' 'original size' '159,' '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 <stdlib.h>
X
void * foo ();
void bar ();
X
int
main ()
{
X
X  bar ();
X  if (bar != foo ())
X    abort ();
X
X  return 0;
}
SHAR_EOF
  (set 20 00 05 01 12 33 13 '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'
040e929f5d5e73b27634ec306676ffc1  main.c
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'main.c'`"
    test 125 -eq "$shar_count" ||
    $echo 'main.c:' 'original size' '125,' '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./
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: libfoo.so bar.c main.c
X	$(CC) -o $@ $(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 $^
X
bar.o: bar.s
X	$(CC) -c $^
X
bar.s: foo.c
X	$(CC) -S -o $@ -fPIC $(CFLAGS) $^
X	echo ".protected bar" >> $@
X
clean:
X	rm -f $(PROGS) *.so *.o *.s
X
X
shar:
X	shar *.c Makefile > bug.shar
SHAR_EOF
  (set 20 00 05 01 12 35 55 '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'
9e186647e4e0c67ba47fab9996a25f2c  Makefile
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'Makefile'`"
    test 711 -eq "$shar_count" ||
    $echo 'Makefile:' 'original size' '711,' 'current size' "$shar_count!"
  fi
fi
rm -fr _sh06573
exit 0

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