[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [patches] Allow ports to define the version of libgcc_s



On Mon, Aug 17, 2009 at 7:17 AM, Maxim Kuvyrkov<maxim@xxxxxxxxxxxxxxxx> wrote:
> The attached patch makes another attempt on GLIBC's PR4457
> (http://sourceware.org/bugzilla/show_bug.cgi?id=4457).
>
> This patch is not exactly what Ulrich proposed to do about the issue; it
> doesn't detects the version of libgcc_s.so installed, but rather relies on
> shlib-versions files to specify it.  The entry in top-level shlib-versions
> file specifies the version of libgcc_s to be '1' (what most architectures
> have) and shlib-versions in sysdeps directories can override that.  This
> patch sets libgcc_s' version to 2 for m68k and hppa architectures.
>
> FWIW, making GLIBC to autodetect the version of libgcc_s installed does not
> seem trivial to me.

There will always be multiple versions of libgcc_s.so installed, and
the one to use for a new glibc is always the most recent version e.g.
`ls -a /lib/libgcc_s.so* | tail -1`

If you need to know the SONAME just add "| xargs $(target)-readelf -a
| grep SONAME | sed -e 's,^.*\[\(.*\)\].*$,\1,g'"

> 2009-08-17  Maxim Kuvyrkov  <maxim@xxxxxxxxxxxxxxxx>
>
>        Allow ports to define the version of the libgcc_s.so library.
>
>        * shlib-versions: Add line for libgcc_s, set version to 1.
>        * sysdeps/generic/framestate.c: Include gnu/lib-names.h,
>        use LIBGCC_S_SO instead of hardcoded string.
>        * nptl/sysdeps/pthread/unwind-resume.c: Same.
>        * nptl/sysdeps/pthread/unwind-forceunwind.c: Same.
>
>        ports/
>        * sysdeps/m68k/shlib-versions: New file, set libgcc_s' version to 2.
>        * sysdeps/hppa/shlib-versions: Add line for libgcc_s, set version to
> 1.

The comment is not correct (and the value is not correct either, see below).

> Index: glibc-trunk-2.10/shlib-versions
> ===================================================================
> --- glibc-trunk-2.10/shlib-versions     (revision 257814)
> +++ glibc-trunk-2.10/shlib-versions     (working copy)
> @@ -134,3 +134,8 @@ sparc64.*-.*-.*             libBrokenLocale=1
> GLIBC
>
>  # The asynchronous name lookup library.
>  .*-.*-.*               libanl=1
> +
> +# The GCC support library.
> +# We don't really provide this one as the part of GLIBC,
> +# but we declare it here to produce LIBGCC_S_SO macro in gnu/lib-names.h.
> +.*-.*-.*                libgcc_s=1
> Index: glibc-trunk-2.10/sysdeps/generic/framestate.c
> ===================================================================
> --- glibc-trunk-2.10/sysdeps/generic/framestate.c       (revision 257814)
> +++ glibc-trunk-2.10/sysdeps/generic/framestate.c       (working copy)
> @@ -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 fram
>
>   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
> Index: glibc-trunk-2.10/nptl/sysdeps/pthread/unwind-resume.c
> ===================================================================
> --- glibc-trunk-2.10/nptl/sysdeps/pthread/unwind-resume.c       (revision
> 257814)
> +++ glibc-trunk-2.10/nptl/sysdeps/pthread/unwind-resume.c       (working
> copy)
> @@ -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;
> Index: glibc-trunk-2.10/nptl/sysdeps/pthread/unwind-forcedunwind.c
> ===================================================================
> --- glibc-trunk-2.10/nptl/sysdeps/pthread/unwind-forcedunwind.c (revision
> 257814)
> +++ glibc-trunk-2.10/nptl/sysdeps/pthread/unwind-forcedunwind.c (working
> copy)
> @@ -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;
> Index: glibc-ports-trunk-2.10/sysdeps/m68k/shlib-versions
> ===================================================================
> --- glibc-ports-trunk-2.10/sysdeps/m68k/shlib-versions  (revision 0)
> +++ glibc-ports-trunk-2.10/sysdeps/m68k/shlib-versions  (revision 0)
> @@ -0,0 +1 @@
> +m68k-.*-.*              libgcc_s=2
> Index: glibc-ports-trunk-2.10/sysdeps/hppa/shlib-versions
> ===================================================================
> --- glibc-ports-trunk-2.10/sysdeps/hppa/shlib-versions  (revision 257814)
> +++ glibc-ports-trunk-2.10/sysdeps/hppa/shlib-versions  (working copy)
> @@ -5,3 +5,5 @@ hppa.*-.*-.*            libc=6                  GLIBC_2.2
>  hppa.*-.*-.*           ld=ld.so.1              GLIBC_2.2
>
>  hppa-.*-.*             libBrokenLocale=1       GLIBC_2.2
> +
> +hppa-.*-.*              libgcc_s=2

This shold be set to "4". Thanks.

Cheers,
Carlos.