diff mbox series

aarch64: Avoid -Wincompatible-pointer-types warning in Linux unwinder

Message ID 874jht5tsq.fsf@oldenburg.str.redhat.com
State New
Headers show
Series aarch64: Avoid -Wincompatible-pointer-types warning in Linux unwinder | expand

Commit Message

Florian Weimer Nov. 10, 2023, 6:48 p.m. UTC
* config/aarch64/linux-unwind.h
	(aarch64_fallback_frame_state): Add cast to the expected type
	in sc assignment.

(Almost a v2, but the other issue was already fixed via in r14-4183.)

---
 libgcc/config/aarch64/linux-unwind.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)


base-commit: 3a6df3281a525ae6113f50d7b38b09fcd803801e

Comments

Szabolcs Nagy Nov. 29, 2023, 3:50 p.m. UTC | #1
The 11/10/2023 19:48, Florian Weimer wrote:
> 	* config/aarch64/linux-unwind.h
> 	(aarch64_fallback_frame_state): Add cast to the expected type
> 	in sc assignment.
> 
> (Almost a v2, but the other issue was already fixed via in r14-4183.)
> 
> ---
>  libgcc/config/aarch64/linux-unwind.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/libgcc/config/aarch64/linux-unwind.h b/libgcc/config/aarch64/linux-unwind.h
> index 00eba866049..18b3df71e7b 100644
> --- a/libgcc/config/aarch64/linux-unwind.h
> +++ b/libgcc/config/aarch64/linux-unwind.h
> @@ -77,7 +77,10 @@ aarch64_fallback_frame_state (struct _Unwind_Context *context,
>      }
>  
>    rt_ = context->cfa;
> -  sc = &rt_->uc.uc_mcontext;
> +  /* Historically, the uc_mcontext member was of type struct sigcontext, but
> +     glibc uses a different type now with member names in the implementation
> +     namespace.  */
> +  sc = (struct sigcontext *) &rt_->uc.uc_mcontext;

FWIW this looks good to me.
(but i cannot approve patches)

(changing the type of sc to mcontext_t* is another option,
but then _GNU_SOURCE is required for the field names to
remain the same across glibc versions, while struct
sigcontext* is unlikely to cause API issues.)

>  
>  /* This define duplicates the definition in aarch64.md */
>  #define SP_REGNUM 31
> 
> base-commit: 3a6df3281a525ae6113f50d7b38b09fcd803801e
>
diff mbox series

Patch

diff --git a/libgcc/config/aarch64/linux-unwind.h b/libgcc/config/aarch64/linux-unwind.h
index 00eba866049..18b3df71e7b 100644
--- a/libgcc/config/aarch64/linux-unwind.h
+++ b/libgcc/config/aarch64/linux-unwind.h
@@ -77,7 +77,10 @@  aarch64_fallback_frame_state (struct _Unwind_Context *context,
     }
 
   rt_ = context->cfa;
-  sc = &rt_->uc.uc_mcontext;
+  /* Historically, the uc_mcontext member was of type struct sigcontext, but
+     glibc uses a different type now with member names in the implementation
+     namespace.  */
+  sc = (struct sigcontext *) &rt_->uc.uc_mcontext;
 
 /* This define duplicates the definition in aarch64.md */
 #define SP_REGNUM 31