[PATCH] Export _Unwind_Find_FDE from glibc (GCC 3.0.1 vs GLIBC 2.2.4 solution part)
Jakub Jelinek
jakub@redhat.com
Thu Jul 19 04:11:00 GMT 2001
Hi!
This patch incorporates Mark's suggestions.
It depends on http://gcc.gnu.org/ml/gcc-patches/2001-07/msg01309.html
beeing commited to gcc first.
2001-07-19 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/ia64/Makefile (sysdep-LDFLAGS): Append
-static-libgcc.
* sysdeps/unix/sysv/linux/arm/Makefile: Likewise.
(sysdep_routines, shared-only-routines): Add framestate if ELF,
shared and GCC 3.0+.
* sysdeps/unix/sysv/linux/alpha/Makefile: Likewise.
* sysdeps/unix/sysv/linux/i386/Makefile: Likewise.
* sysdeps/unix/sysv/linux/m68k/Makefile: Likewise.
* sysdeps/unix/sysv/linux/mips/Makefile: Likewise.
* sysdeps/unix/sysv/linux/powerpc/Makefile: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/Makefile: Likewise.
* sysdeps/unix/sysv/linux/sparc/Makefile: Likewise.
* sysdeps/mach/hurd/i386/Makefile: Likewise.
* sysdeps/unix/sysv/linux/arm/Versions (__register_frame_info_bases,
__register_frame_info_table_bases, __deregister_frame_info_bases,
_Unwind_Find_FDE): Export at GCC_3.0.
* sysdeps/unix/sysv/linux/alpha/Versions: Likewise.
* sysdeps/unix/sysv/linux/i386/Versions: Likewise.
* sysdeps/unix/sysv/linux/m68k/Versions: Likewise.
* sysdeps/unix/sysv/linux/mips/Versions: Likewise.
* sysdeps/unix/sysv/linux/powerpc/Versions: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/Versions: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/Versions: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/Versions: Likewise.
* sysdeps/mach/hurd/i386/Versions: Likewise.
* Versions.def (libc): Add GCC_3.0.
* configure.in: Check for _Unwind_Find_FDE.
* configure: Rebuilt.
* config.make.in (unwind-find-fde): New.
* config.h.in (HAVE_UNWIND_FIND_FDE): New.
* sysdeps/generic/framestate.c: New.
--- libc/sysdeps/mach/hurd/i386/Versions.jj Mon Jun 26 04:18:48 2000
+++ libc/sysdeps/mach/hurd/i386/Versions Thu Jul 19 04:34:29 2001
@@ -5,4 +5,11 @@ libc {
__register_frame_info; __deregister_frame_info; __frame_state_for;
__register_frame_info_table;
}
+%ifdef HAVE_UNWIND_FIND_FDE
+ GCC_3.0 {
+ # Exception handling support functions from libgcc
+ __register_frame_info_bases; __register_frame_info_table_bases;
+ __deregister_frame_info_bases; _Unwind_Find_FDE;
+ }
+%endif
}
--- libc/sysdeps/mach/hurd/i386/Makefile.jj Wed Jun 6 10:05:41 2001
+++ libc/sysdeps/mach/hurd/i386/Makefile Thu Jul 19 04:42:29 2001
@@ -7,3 +7,12 @@ $(objpfx)crt0.o: $(objpfx)static-start.o
$(link-relocatable)
endif
+
+ifeq ($(subdir)$(build-shared)$(unwind-find-fde),elfyesyes)
+sysdep_routines += framestate
+shared-only-routines += framestate
+endif
+
+ifeq ($(unwind-find-fde),yes)
+sysdep-LDFLAGS += -static-libgcc
+endif
--- libc/sysdeps/unix/sysv/linux/arm/Makefile.jj Fri Mar 16 13:40:07 2001
+++ libc/sysdeps/unix/sysv/linux/arm/Makefile Wed Jul 18 07:27:17 2001
@@ -20,3 +20,12 @@ sysdep_routines += dl-procinfo
# extra shared linker files to link only into dl-allobjs.so
sysdep-rtld-routines += dl-procinfo
endif
+
+ifeq ($(subdir)$(build-shared)$(unwind-find-fde),elfyesyes)
+sysdep_routines += framestate
+shared-only-routines += framestate
+endif
+
+ifeq ($(unwind-find-fde),yes)
+sysdep-LDFLAGS += -static-libgcc
+endif
--- libc/sysdeps/unix/sysv/linux/arm/Versions.jj Sat Aug 19 13:10:40 2000
+++ libc/sysdeps/unix/sysv/linux/arm/Versions Thu Jul 19 04:29:04 2001
@@ -32,4 +32,11 @@ libc {
# v*
versionsort64;
}
+%ifdef HAVE_UNWIND_FIND_FDE
+ GCC_3.0 {
+ # Exception handling support functions from libgcc
+ __register_frame_info_bases; __register_frame_info_table_bases;
+ __deregister_frame_info_bases; _Unwind_Find_FDE;
+ }
+%endif
}
--- libc/sysdeps/unix/sysv/linux/alpha/Makefile.jj Fri Nov 17 19:20:14 2000
+++ libc/sysdeps/unix/sysv/linux/alpha/Makefile Wed Jul 18 07:27:11 2001
@@ -23,3 +23,12 @@ ifeq ($(subdir),signal)
sysdep_routines += rt_sigsuspend rt_sigprocmask rt_sigtimedwait \
rt_sigqueueinfo rt_sigaction rt_sigpending
endif
+
+ifeq ($(subdir)$(build-shared)$(unwind-find-fde),elfyesyes)
+sysdep_routines += framestate
+shared-only-routines += framestate
+endif
+
+ifeq ($(unwind-find-fde),yes)
+sysdep-LDFLAGS += -static-libgcc
+endif
--- libc/sysdeps/unix/sysv/linux/alpha/Versions.jj Fri Feb 16 03:44:54 2001
+++ libc/sysdeps/unix/sysv/linux/alpha/Versions Thu Jul 19 04:29:17 2001
@@ -58,4 +58,11 @@ libc {
# w*
wordexp;
}
+%ifdef HAVE_UNWIND_FIND_FDE
+ GCC_3.0 {
+ # Exception handling support functions from libgcc
+ __register_frame_info_bases; __register_frame_info_table_bases;
+ __deregister_frame_info_bases; _Unwind_Find_FDE;
+ }
+%endif
}
--- libc/sysdeps/unix/sysv/linux/i386/Versions.jj Sat Aug 19 13:10:41 2000
+++ libc/sysdeps/unix/sysv/linux/i386/Versions Thu Jul 19 04:29:28 2001
@@ -34,4 +34,11 @@ libc {
# v*
versionsort64;
}
+%ifdef HAVE_UNWIND_FIND_FDE
+ GCC_3.0 {
+ # Exception handling support functions from libgcc
+ __register_frame_info_bases; __register_frame_info_table_bases;
+ __deregister_frame_info_bases; _Unwind_Find_FDE;
+ }
+%endif
}
--- libc/sysdeps/unix/sysv/linux/i386/Makefile.jj Wed Jun 6 10:06:07 2001
+++ libc/sysdeps/unix/sysv/linux/i386/Makefile Wed Jul 18 06:54:09 2001
@@ -17,3 +17,12 @@ endif
ifeq ($(subdir),resource)
sysdep_routines += oldgetrlimit64
endif
+
+ifeq ($(subdir)$(build-shared)$(unwind-find-fde),elfyesyes)
+sysdep_routines += framestate
+shared-only-routines += framestate
+endif
+
+ifeq ($(unwind-find-fde),yes)
+sysdep-LDFLAGS += -static-libgcc
+endif
--- libc/sysdeps/unix/sysv/linux/ia64/Makefile.jj Wed Jun 6 10:06:14 2001
+++ libc/sysdeps/unix/sysv/linux/ia64/Makefile Wed Jul 18 06:53:49 2001
@@ -16,3 +16,7 @@ sysdep-dl-routines += dl-static
sysdep_routines += $(sysdep-dl-routines)
sysdep-rtld-routines += $(sysdep-dl-routines)
endif
+
+ifeq ($(unwind-find-fde),yes)
+sysdep-LDFLAGS += -static-libgcc
+endif
--- libc/sysdeps/unix/sysv/linux/m68k/Makefile.jj Mon Oct 16 16:21:16 2000
+++ libc/sysdeps/unix/sysv/linux/m68k/Makefile Wed Jul 18 07:27:20 2001
@@ -15,3 +15,12 @@ endif
ifeq ($(subdir),resource)
sysdep_routines += oldgetrlimit64
endif
+
+ifeq ($(subdir)$(build-shared)$(unwind-find-fde),elfyesyes)
+sysdep_routines += framestate
+shared-only-routines += framestate
+endif
+
+ifeq ($(unwind-find-fde),yes)
+sysdep-LDFLAGS += -static-libgcc
+endif
--- libc/sysdeps/unix/sysv/linux/m68k/Versions.jj Mon Oct 16 16:21:16 2000
+++ libc/sysdeps/unix/sysv/linux/m68k/Versions Thu Jul 19 04:29:36 2001
@@ -30,4 +30,11 @@ libc {
# v*
versionsort64;
}
+%ifdef HAVE_UNWIND_FIND_FDE
+ GCC_3.0 {
+ # Exception handling support functions from libgcc
+ __register_frame_info_bases; __register_frame_info_table_bases;
+ __deregister_frame_info_bases; _Unwind_Find_FDE;
+ }
+%endif
}
--- libc/sysdeps/unix/sysv/linux/mips/Makefile.jj Mon Sep 11 08:46:31 2000
+++ libc/sysdeps/unix/sysv/linux/mips/Makefile Wed Jul 18 07:27:24 2001
@@ -9,3 +9,12 @@ sysdep_routines += cachectl cacheflush s
sysdep_headers += sys/cachectl.h sys/sysmips.h sys/tas.h
endif
+
+ifeq ($(subdir)$(build-shared)$(unwind-find-fde),elfyesyes)
+sysdep_routines += framestate
+shared-only-routines += framestate
+endif
+
+ifeq ($(unwind-find-fde),yes)
+sysdep-LDFLAGS += -static-libgcc
+endif
--- libc/sysdeps/unix/sysv/linux/mips/Versions.jj Mon Jul 31 16:42:41 2000
+++ libc/sysdeps/unix/sysv/linux/mips/Versions Thu Jul 19 04:29:45 2001
@@ -18,4 +18,11 @@ libc {
# _*
_test_and_set;
}
+%ifdef HAVE_UNWIND_FIND_FDE
+ GCC_3.0 {
+ # Exception handling support functions from libgcc
+ __register_frame_info_bases; __register_frame_info_table_bases;
+ __deregister_frame_info_bases; _Unwind_Find_FDE;
+ }
+%endif
}
--- libc/sysdeps/unix/sysv/linux/powerpc/Makefile.jj Wed Jun 6 10:06:16 2001
+++ libc/sysdeps/unix/sysv/linux/powerpc/Makefile Wed Jul 18 07:27:31 2001
@@ -6,3 +6,12 @@ endif
ifeq ($(subdir),resource)
sysdep_routines += oldgetrlimit64
endif
+
+ifeq ($(subdir)$(build-shared)$(unwind-find-fde),elfyesyes)
+sysdep_routines += framestate
+shared-only-routines += framestate
+endif
+
+ifeq ($(unwind-find-fde),yes)
+sysdep-LDFLAGS += -static-libgcc
+endif
--- libc/sysdeps/unix/sysv/linux/powerpc/Versions.jj Sat Aug 19 13:10:44 2000
+++ libc/sysdeps/unix/sysv/linux/powerpc/Versions Thu Jul 19 04:29:52 2001
@@ -21,4 +21,11 @@ libc {
# s*
scandir64;
}
+%ifdef HAVE_UNWIND_FIND_FDE
+ GCC_3.0 {
+ # Exception handling support functions from libgcc
+ __register_frame_info_bases; __register_frame_info_table_bases;
+ __deregister_frame_info_bases; _Unwind_Find_FDE;
+ }
+%endif
}
--- libc/sysdeps/unix/sysv/linux/s390/s390-32/Makefile.jj Wed Jun 6 10:06:17 2001
+++ libc/sysdeps/unix/sysv/linux/s390/s390-32/Makefile Wed Jul 18 07:27:34 2001
@@ -6,3 +6,12 @@ endif
ifeq ($(subdir),resource)
sysdep_routines += oldgetrlimit64
endif
+
+ifeq ($(subdir)$(build-shared)$(unwind-find-fde),elfyesyes)
+sysdep_routines += framestate
+shared-only-routines += framestate
+endif
+
+ifeq ($(unwind-find-fde),yes)
+sysdep-LDFLAGS += -static-libgcc
+endif
--- libc/sysdeps/unix/sysv/linux/s390/s390-32/Versions.jj Fri Mar 16 13:40:11 2001
+++ libc/sysdeps/unix/sysv/linux/s390/s390-32/Versions Thu Jul 19 04:30:03 2001
@@ -24,5 +24,11 @@ libc {
# v*
versionsort64;
}
+%ifdef HAVE_UNWIND_FIND_FDE
+ GCC_3.0 {
+ # Exception handling support functions from libgcc
+ __register_frame_info_bases; __register_frame_info_table_bases;
+ __deregister_frame_info_bases; _Unwind_Find_FDE;
+ }
+%endif
}
-
--- libc/sysdeps/unix/sysv/linux/sparc/sparc32/Versions.jj Sat Aug 19 13:10:46 2000
+++ libc/sysdeps/unix/sysv/linux/sparc/sparc32/Versions Thu Jul 19 04:30:10 2001
@@ -18,4 +18,11 @@ libc {
# s*
scandir64;
}
+%ifdef HAVE_UNWIND_FIND_FDE
+ GCC_3.0 {
+ # Exception handling support functions from libgcc
+ __register_frame_info_bases; __register_frame_info_table_bases;
+ __deregister_frame_info_bases; _Unwind_Find_FDE;
+ }
+%endif
}
--- libc/sysdeps/unix/sysv/linux/sparc/sparc64/Versions.jj Fri Feb 16 03:44:54 2001
+++ libc/sysdeps/unix/sysv/linux/sparc/sparc64/Versions Thu Jul 19 04:30:16 2001
@@ -9,4 +9,11 @@ libc {
# w*
wordexp;
}
+%ifdef HAVE_UNWIND_FIND_FDE
+ GCC_3.0 {
+ # Exception handling support functions from libgcc
+ __register_frame_info_bases; __register_frame_info_table_bases;
+ __deregister_frame_info_bases; _Unwind_Find_FDE;
+ }
+%endif
}
--- libc/sysdeps/unix/sysv/linux/sparc/Makefile.jj Thu Nov 9 16:54:47 2000
+++ libc/sysdeps/unix/sysv/linux/sparc/Makefile Wed Jul 18 07:27:46 2001
@@ -42,3 +42,12 @@ $(objpfx)syscall-%.h $(objpfx)syscall-%.
mv -f $(@:.h=.d)-t2 $(@:.h=.d)
endif
+
+ifeq ($(subdir)$(build-shared)$(unwind-find-fde),elfyesyes)
+sysdep_routines += framestate
+shared-only-routines += framestate
+endif
+
+ifeq ($(unwind-find-fde),yes)
+sysdep-LDFLAGS += -static-libgcc
+endif
--- libc/Versions.def.jj Tue Mar 6 11:06:27 2001
+++ libc/Versions.def Thu Jul 19 04:28:12 2001
@@ -15,6 +15,9 @@ libc {
%ifdef USE_IN_LIBIO
HURD_CTHREADS_0.3
%endif
+%ifdef HAVE_UNWIND_FIND_FDE
+ GCC_3.0
+%endif
}
libcrypt {
GLIBC_2.0
--- libc/configure.jj Mon Jul 9 15:42:52 2001
+++ libc/configure Thu Jul 19 04:27:36 2001
@@ -1533,6 +1533,62 @@ if test -n "$critic_missing"; then
*** Check the INSTALL file for required versions." 1>&2; exit 1; }
fi
+# Check for GCC 3.0+ frame unwinder
+# check if ranlib is necessary
+echo $ac_n "checking for _Unwind_Find_FDE""... $ac_c" 1>&6
+echo "configure:1540: checking for _Unwind_Find_FDE" >&5
+if eval "test \"`echo '$''{'ac_cv_func__Unwind_Find_FDE'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1545 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char _Unwind_Find_FDE(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char _Unwind_Find_FDE();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub__Unwind_Find_FDE) || defined (__stub____Unwind_Find_FDE)
+choke me
+#else
+_Unwind_Find_FDE();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1568: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func__Unwind_Find_FDE=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func__Unwind_Find_FDE=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'_Unwind_Find_FDE`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ libc_cv_unwind_find_fde=yes
+ cat >> confdefs.h <<\EOF
+#define HAVE_UNWIND_FIND_FDE 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+libc_cv_unwind_find_fde=no
+fi
+
+
for ac_prog in gnumsgfmt gmsgfmt msgfmt
do
@@ -3776,6 +3832,7 @@ s%@build_vendor@%$build_vendor%g
s%@build_os@%$build_os%g
s%@CC@%$CC%g
s%@MAKE@%$MAKE%g
+s%@libc_cv_unwind_find_fde@%$libc_cv_unwind_find_fde%g
s%@MSGFMT@%$MSGFMT%g
s%@MAKEINFO@%$MAKEINFO%g
s%@SED@%$SED%g
--- libc/configure.in.jj Mon Jul 9 15:42:52 2001
+++ libc/configure.in Thu Jul 19 04:23:06 2001
@@ -588,6 +588,13 @@ AC_MSG_ERROR([
*** Check the INSTALL file for required versions.])
fi
+# Check for GCC 3.0+ frame unwinder
+# check if ranlib is necessary
+AC_CHECK_FUNC(_Unwind_Find_FDE,
+ [libc_cv_unwind_find_fde=yes
+ AC_DEFINE(HAVE_UNWIND_FIND_FDE)],
+ [libc_cv_unwind_find_fde=no])
+AC_SUBST(libc_cv_unwind_find_fde)
AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
[GNU gettext.* \([0-9]*\.[0-9.]*\)],
--- libc/config.make.in.jj Mon Jul 9 14:56:55 2001
+++ libc/config.make.in Wed Jul 18 06:24:36 2001
@@ -71,6 +71,7 @@ stdio = @stdio@
add-ons = @subdirs@
cross-compiling = @cross_compiling@
force-install = @force_install@
+unwind-find-fde = @libc_cv_unwind_find_fde@
# Build tools.
CC = @CC@
--- libc/config.h.in.jj Tue Mar 6 11:06:27 2001
+++ libc/config.h.in Thu Jul 19 04:26:18 2001
@@ -79,6 +79,9 @@
(gcc on ix86 only). */
#undef USE_REGPARMS
+/* Define if libgcc.a has _Unwind_Find_FDE function. */
+#undef HAVE_UNWIND_FIND_FDE
+
/* Defined on PowerPC if the GCC being used has a problem with clobbering
certain registers (CR0, MQ, CTR, LR) in asm statements. */
#undef BROKEN_PPC_ASM_CR0
--- libc/sysdeps/generic/framestate.c.jj Wed Jul 18 06:29:26 2001
+++ libc/sysdeps/generic/framestate.c Thu Jul 19 04:31:41 2001
@@ -0,0 +1,44 @@
+/* __frame_state_for unwinder helper function wrapper
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub@redhat.com>, 2001.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <dlfcn.h>
+#include <stdlib.h>
+
+void *__frame_state_for (void *pc, void *frame_state);
+
+void *
+__frame_state_for (void *pc, void *frame_state)
+{
+ static void * (*frame_state_for) (void *pc, void *frame_state);
+
+ if (frame_state_for == NULL)
+ {
+ void *handle = __libc_dlopen ("libgcc_s.so.1");
+
+ if (handle == NULL)
+ return NULL;
+ frame_state_for =
+ (void * (*) (void *, void *)) __libc_dlsym (handle, "__frame_state_for");
+ if (frame_state_for == NULL)
+ return NULL;
+ }
+
+ return frame_state_for (pc, frame_state);
+}
Jakub
More information about the Libc-alpha
mailing list