This is the mail archive of the libc-hacker@sources.redhat.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]

A sample implemenation (Re: My proposal for the libgcc runtime ABI)


On Tue, Jul 11, 2000 at 07:47:41PM -0300, Alexandre Oliva wrote:
> On Jul 11, 2000, "H . J . Lu" <hjl@valinux.com> wrote:
> 
> > The problem is we, Ulrich and I, don't believe gcc will do it right
> > for Linux in time.
> 
> Please post your patches, even if they initially only work on
> GNU/Linux.  Since we already have the encoding of ABI in the libstdc++
> SONAME only on GNU/Linux, we can probably start by building libgcc.so
> only on GNU/Linux too.
> 

This is not a real patch. It just shows how it can done under Linux.
You will need

http://gcc.gnu.org/ml/gcc-bugs/2000-07/msg00117.html

for <runtime.h>. When it is used with glibc build, we can use

..../libgcc/libgcc.so `$(CC) -print-libgcc-file-name`

or

..../libgcc/libgcc.so -lgcc

instead of just -lgcc.


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-11 21:42 PDT by <hjl@osmium.su.varesearch.com>.
# Source directory was `/work/gnu/src/libgcc'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode       name
# ------ ---------- ------------------------------------------
#   1081 -rw-r--r-- Makefile
#    297 -rw-r--r-- dummy.c
#
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 _sh17043; then
  $echo 'x -' 'creating lock directory'
else
  $echo 'failed to create lock directory'
  exit 1
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' &&
LD=ld
CC=/opt/gcc-3.0/bin/gcc
X
LN_S=ln -s
X
INSTALL_PROGRAM=install -c
X
slibdir=/lib
X
inst_slibdir=$(install_root)$(slibdir)
X
libgcc-a=$(shell $(CC) -print-libgcc-file-name)
libgcc-so=$(shell $(CC) -print-libgcc-file-name | sed -e 's/a$$/so/')
X
soname=libgcc.so.3
libgcc=libgcc-$(shell $(CC) -dumpversion).so
X
libgcc.so: dummy.o $(libgcc-a)
X	$(LD) -shared -soname $(soname) -o $@ $^
X
dummy.o: dummy.c
X	$(CC) -fPIC -O -c $<
X
install: $(install_root)$(libgcc-so) $(inst_slibdir)/$(soname)
X
$(inst_slibdir)/$(libgcc): $(libgcc)
X	mkdir -p $(@D)
X	rm -f $@.new 
X	$(INSTALL_PROGRAM) $< $@.new
X	mv $@.new $@
X
$(inst_slibdir)/$(soname): $(inst_slibdir)/$(libgcc)
X	mkdir -p $(@D)
X	rm -f $@.new 
X	$(LN_S) $< $@.new
X	mv $@.new $@
X
$(install_root)$(libgcc-so): libgcc.so $(libgcc-a)
X	mkdir -p $(@D)
X	(echo '/* GNU ld script';\
X	 echo '   Use the shared library, but some functions are only in';\
X	 echo '   the static library, so try that secondarily.  */';\
X	 echo 'GROUP ( $(slibdir)/$(soname)' \
X	      '$(libgcc-a))' \
X	) > $@.new
X	mv -f $@.new $@
X
clean:
X	rm -f dummy.o $(soname) libgcc.so
SHAR_EOF
  (set 20 00 07 11 21 39 24 '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'
7da3126882752574533e8b1919cdc416  Makefile
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'Makefile'`"
    test 1081 -eq "$shar_count" ||
    $echo 'Makefile:' 'original size' '1081,' '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' &&
#include <runtime.h>
X
static
const void *dummy [] =
{
X  (const void *) __register_frame,
X  (const void *) __register_frame_table,
X  (const void *) __deregister_frame,
X  (const void *) __register_frame_info,
X  (const void *) __register_frame_info_table,
X  (const void *) __deregister_frame_info
};
SHAR_EOF
  (set 20 00 07 11 21 01 25 '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'
a6d5eb1b19ef9afbc7a2b96e151ef6ae  dummy.c
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'dummy.c'`"
    test 297 -eq "$shar_count" ||
    $echo 'dummy.c:' 'original size' '297,' 'current size' "$shar_count!"
  fi
fi
rm -fr _sh17043
exit 0

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