[PATCH] Determine libgcc_s version
Andreas Schwab
schwab@linux-m68k.org
Sun Sep 20 14:18:00 GMT 2009
Add configure test to determine the version of the libgcc_s library and
use that instead of hardcoding libgcc_s.so.1.
Andreas.
2009-09-20 Andreas Schwab <schwab@linux-m68k.org>
[BZ #4457]
* configure.in: Determine version of libgcc_s libraray.
* configure: Regenerated.
* config.make.in (libgcc_s-version): Define.
* Makeconfig ($(common-objpfx)libgcc_s-version): New target.
($(common-objpfx)shlib-versions.v.i): Depend on it.
(postclean-generated): Add libgcc_s-version.
* sysdeps/generic/framestate.c (__frame_state_for): Use
LIBGCC_S_SO.
nptl/:
[BZ #4457]
* sysdeps/pthread/unwind-forcedunwind.c (pthread_cancel_init): Use
LIBGCC_S_SO.
* sysdeps/pthread/unwind-resume.c (init): Likewise.
diff --git a/Makeconfig b/Makeconfig
index 9f134cc..7b75c29 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -829,7 +829,9 @@ ifndef avoid-generated
$(common-objpfx)shlib-versions.v.i: \
$(wildcard $(+sysdep_dirs:=/shlib-versions) \
$(subdir-srcdirs:=/shlib-versions)) \
- $(..)shlib-versions
+ $(..)shlib-versions $(common-objpfx)libgcc_s-version
+$(common-objpfx)libgcc_s-version: $(common-objpfx)config.make
+ echo '.*-.*-.* libgcc_s=$(libgcc_s-version)' > $@
soversions-default-setname = $(patsubst %, %,\
$(filter-out %_default,\
@@ -867,7 +869,8 @@ endif
endif
postclean-generated += soversions.mk soversions.i \
- shlib-versions.v shlib-versions.v.i
+ shlib-versions.v shlib-versions.v.i \
+ libgcc_s-version
# Generate the header containing the names of all shared libraries.
# We use a stamp file to avoid unnecessary recompilations.
diff --git a/config.make.in b/config.make.in
index d65706c..f140211 100644
--- a/config.make.in
+++ b/config.make.in
@@ -69,6 +69,7 @@ bind-now = @bindnow@
have-hash-style = @libc_cv_hashstyle@
static-libgcc = @libc_cv_gcc_static_libgcc@
+libgcc_s-version = @libc_cv_libgcc_s_version@
versioning = @VERSIONING@
oldest-abi = @oldest_abi@
diff --git a/configure.in b/configure.in
index 4a81fb0..0d71dd4 100644
--- a/configure.in
+++ b/configure.in
@@ -2170,6 +2170,22 @@ AC_CHECK_SIZEOF(long double, 0)
sizeof_long_double=$ac_cv_sizeof_long_double
AC_SUBST(sizeof_long_double)
+AC_CACHE_CHECK([for version of libgcc_s library], libc_cv_libgcc_s_version, [dnl
+ cat > conftest.c <<EOF
+int main (void) { return 0; }
+EOF
+ if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
+ -fPIC -shared -o conftest.so conftest.c
+ -lgcc_s$libc_cv_libgcc_s_suffix
+ -nostdlib >&AS_MESSAGE_LOG_FD])
+ then
+ libc_cv_libgcc_s_version=`$OBJDUMP -p conftest.so |
+ $AWK '$[]1 == "NEEDED" && $[]2 ~ /libgcc_s/ {
+ sub(/.*\.so\./, "", $[]2)
+ print $[]2 }'`
+ fi
+ rm -f conftest*])
+
### End of automated tests.
### Now run sysdeps configure fragments.
@@ -2291,6 +2307,7 @@ AC_SUBST(libc_cv_localedir)
AC_SUBST(libc_cv_sysconfdir)
AC_SUBST(libc_cv_rootsbindir)
AC_SUBST(libc_cv_forced_unwind)
+AC_SUBST(libc_cv_libgcc_s_version)
dnl sysdeps/CPU/configure.in checks set this via arch-specific asm tests
AC_SUBST(libc_cv_cpp_asm_debuginfo)
diff --git a/nptl/sysdeps/pthread/unwind-forcedunwind.c b/nptl/sysdeps/pthread/unwind-forcedunwind.c
index 402591f..142ca74 100644
--- a/nptl/sysdeps/pthread/unwind-forcedunwind.c
+++ b/nptl/sysdeps/pthread/unwind-forcedunwind.c
@@ -22,6 +22,7 @@
#include <unwind.h>
#include <pthreadP.h>
#include <sysdep.h>
+#include <gnu/lib-names.h>
static void *libgcc_s_handle;
static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
@@ -49,7 +50,7 @@ pthread_cancel_init (void)
return;
}
- handle = __libc_dlopen ("libgcc_s.so.1");
+ handle = __libc_dlopen (LIBGCC_S_SO);
if (handle == NULL
|| (resume = __libc_dlsym (handle, "_Unwind_Resume")) == NULL
@@ -61,7 +62,7 @@ pthread_cancel_init (void)
|| ARCH_CANCEL_INIT (handle)
#endif
)
- __libc_fatal ("libgcc_s.so.1 must be installed for pthread_cancel to work\n");
+ __libc_fatal (LIBGCC_S_SO " must be installed for pthread_cancel to work\n");
PTR_MANGLE (resume);
libgcc_s_resume = resume;
diff --git a/nptl/sysdeps/pthread/unwind-resume.c b/nptl/sysdeps/pthread/unwind-resume.c
index 088f4c6..f06a479 100644
--- a/nptl/sysdeps/pthread/unwind-resume.c
+++ b/nptl/sysdeps/pthread/unwind-resume.c
@@ -20,6 +20,7 @@
#include <dlfcn.h>
#include <stdio.h>
#include <unwind.h>
+#include <gnu/lib-names.h>
static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
static _Unwind_Reason_Code (*libgcc_s_personality)
@@ -32,12 +33,12 @@ init (void)
void *resume, *personality;
void *handle;
- handle = __libc_dlopen ("libgcc_s.so.1");
+ handle = __libc_dlopen (LIBGCC_S_SO);
if (handle == NULL
|| (resume = __libc_dlsym (handle, "_Unwind_Resume")) == NULL
|| (personality = __libc_dlsym (handle, "__gcc_personality_v0")) == NULL)
- __libc_fatal ("libgcc_s.so.1 must be installed for pthread_cancel to work\n");
+ __libc_fatal (LIBGCC_S_SO " must be installed for pthread_cancel to work\n");
libgcc_s_resume = resume;
libgcc_s_personality = personality;
diff --git a/sysdeps/generic/framestate.c b/sysdeps/generic/framestate.c
index a912a8c..15f31a1 100644
--- a/sysdeps/generic/framestate.c
+++ b/sysdeps/generic/framestate.c
@@ -20,6 +20,7 @@
#include <dlfcn.h>
#include <stdlib.h>
+#include <gnu/lib-names.h>
#define STATIC static
#define __frame_state_for fallback_frame_state_for
#include <unwind-dw2.c>
@@ -36,7 +37,7 @@ __frame_state_for (void *pc, struct frame_state *frame_state)
if (frame_state_for == NULL)
{
- void *handle = __libc_dlopen ("libgcc_s.so.1");
+ void *handle = __libc_dlopen (LIBGCC_S_SO);
if (handle == NULL
|| (frame_state_for
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
More information about the Libc-alpha
mailing list