diff mbox

PATCH: Define x86_64_fallback_frame_state only for glibc

Message ID 20120329011531.GA19153@intel.com
State New
Headers show

Commit Message

H.J. Lu March 29, 2012, 1:15 a.m. UTC
Hi,
    
We shouldn't assume that we can define x86_64_fallback_frame_state
for other x86-64 C libraries, like Bionic.  OK for trunk?

Thanks.


H.J.
---
2012-03-27  H.J. Lu  <hongjiu.lu@intel.com>

    	* config/i386/linux-unwind.h (x86_64_fallback_frame_state): Define
    	only for glibc.

Comments

Ian Lance Taylor March 29, 2012, 3:47 a.m. UTC | #1
"H.J. Lu" <hongjiu.lu@intel.com> writes:

> 2012-03-27  H.J. Lu  <hongjiu.lu@intel.com>
>
>     	* config/i386/linux-unwind.h (x86_64_fallback_frame_state): Define
>     	only for glibc.

This is OK.

Thanks.

Ian
H.J. Lu Nov. 27, 2012, 1:48 p.m. UTC | #2
On Wed, Mar 28, 2012 at 6:15 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> Hi,
>
> We shouldn't assume that we can define x86_64_fallback_frame_state
> for other x86-64 C libraries, like Bionic.  OK for trunk?
>
> Thanks.
>
>
> H.J.
> ---
> 2012-03-27  H.J. Lu  <hongjiu.lu@intel.com>
>
>         * config/i386/linux-unwind.h (x86_64_fallback_frame_state): Define
>         only for glibc.
>
> diff --git a/gcc/config/i386/linux-unwind.h b/gcc/config/i386/linux-unwind.h
> index c5f7ea0..61b4ebf 100644
> --- a/libgcc/config/i386/linux-unwind.h
> +++ b/libgcc/config/i386/linux-unwind.h
> @@ -28,11 +28,17 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
>
>  #ifndef inhibit_libc
>
> -#ifdef __x86_64__
> +/* There's no sys/ucontext.h for glibc 2.0, so no
> +   signal-turned-exceptions for them.  There's also no configure-run for
> +   the target, so we can't check on (e.g.) HAVE_SYS_UCONTEXT_H.  Using the
> +   target libc version macro should be enough.  */
> +#if defined __GLIBC__ && !(__GLIBC__ == 2 && __GLIBC_MINOR__ == 0)
>
>  #include <signal.h>
>  #include <sys/ucontext.h>
>
> +#ifdef __x86_64__
> +
>  #define MD_FALLBACK_FRAME_STATE_FOR x86_64_fallback_frame_state
>
>  static _Unwind_Reason_Code
> @@ -102,15 +108,6 @@ x86_64_fallback_frame_state (struct _Unwind_Context *context,
>
>  #else /* ifdef __x86_64__  */
>
> -/* There's no sys/ucontext.h for glibc 2.0, so no
> -   signal-turned-exceptions for them.  There's also no configure-run for
> -   the target, so we can't check on (e.g.) HAVE_SYS_UCONTEXT_H.  Using the
> -   target libc version macro should be enough.  */
> -#if defined __GLIBC__ && !(__GLIBC__ == 2 && __GLIBC_MINOR__ == 0)
> -
> -#include <signal.h>
> -#include <sys/ucontext.h>
> -
>  #define MD_FALLBACK_FRAME_STATE_FOR x86_fallback_frame_state
>
>  static _Unwind_Reason_Code
> @@ -191,6 +188,6 @@ x86_frob_update_context (struct _Unwind_Context *context,
>      _Unwind_SetSignalFrame (context, 1);
>  }
>
> -#endif /* not glibc 2.0 */
>  #endif /* ifdef __x86_64__  */
> +#endif /* not glibc 2.0 */
>  #endif /* ifdef inhibit_libc  */

I'd like to backport it to 4.7 branch.  OK for 4.7?

Thanks.
diff mbox

Patch

diff --git a/gcc/config/i386/linux-unwind.h b/gcc/config/i386/linux-unwind.h
index c5f7ea0..61b4ebf 100644
--- a/libgcc/config/i386/linux-unwind.h
+++ b/libgcc/config/i386/linux-unwind.h
@@ -28,11 +28,17 @@  see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 #ifndef inhibit_libc
 
-#ifdef __x86_64__
+/* There's no sys/ucontext.h for glibc 2.0, so no
+   signal-turned-exceptions for them.  There's also no configure-run for
+   the target, so we can't check on (e.g.) HAVE_SYS_UCONTEXT_H.  Using the
+   target libc version macro should be enough.  */
+#if defined __GLIBC__ && !(__GLIBC__ == 2 && __GLIBC_MINOR__ == 0)
 
 #include <signal.h>
 #include <sys/ucontext.h>
 
+#ifdef __x86_64__
+
 #define MD_FALLBACK_FRAME_STATE_FOR x86_64_fallback_frame_state
 
 static _Unwind_Reason_Code
@@ -102,15 +108,6 @@  x86_64_fallback_frame_state (struct _Unwind_Context *context,
 
 #else /* ifdef __x86_64__  */
 
-/* There's no sys/ucontext.h for glibc 2.0, so no
-   signal-turned-exceptions for them.  There's also no configure-run for
-   the target, so we can't check on (e.g.) HAVE_SYS_UCONTEXT_H.  Using the
-   target libc version macro should be enough.  */
-#if defined __GLIBC__ && !(__GLIBC__ == 2 && __GLIBC_MINOR__ == 0)
-
-#include <signal.h>
-#include <sys/ucontext.h>
-
 #define MD_FALLBACK_FRAME_STATE_FOR x86_fallback_frame_state
 
 static _Unwind_Reason_Code
@@ -191,6 +188,6 @@  x86_frob_update_context (struct _Unwind_Context *context,
     _Unwind_SetSignalFrame (context, 1);
 }
 
-#endif /* not glibc 2.0 */
 #endif /* ifdef __x86_64__  */
+#endif /* not glibc 2.0 */
 #endif /* ifdef inhibit_libc  */