From: Uros Bizjak Date: Thu, 25 Sep 2025 07:50:13 +0000 (+0200) Subject: x86: Simplify stack and pointer guard macros X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e47728a77c38926945d3759f8654106b18be9427;p=thirdparty%2Fglibc.git x86: Simplify stack and pointer guard macros Replace manual casts with a direct `(__tcbhead_t __seg_gs *)0` dereferences for `stack_guard` and `pointer_guard`. This makes the macros more straightforward and removes the dependency on . Signed-off-by: Uros Bizjak Reviewed-by: H.J. Lu --- diff --git a/sysdeps/i386/stackguard-macros.h b/sysdeps/i386/stackguard-macros.h index 574a409584..2939934ef1 100644 --- a/sysdeps/i386/stackguard-macros.h +++ b/sysdeps/i386/stackguard-macros.h @@ -1,7 +1,3 @@ -#include +#define STACK_CHK_GUARD (((tcbhead_t __seg_gs *)0)->stack_guard) -#define STACK_CHK_GUARD \ - (*(uintptr_t __seg_gs *) offsetof (tcbhead_t, stack_guard)) - -#define POINTER_CHK_GUARD \ - (*(uintptr_t __seg_gs *) offsetof (tcbhead_t, pointer_guard)) +#define POINTER_CHK_GUARD (((tcbhead_t __seg_gs *)0)->pointer_guard) diff --git a/sysdeps/x86_64/stackguard-macros.h b/sysdeps/x86_64/stackguard-macros.h index 1d4c620ff1..77f13c986d 100644 --- a/sysdeps/x86_64/stackguard-macros.h +++ b/sysdeps/x86_64/stackguard-macros.h @@ -1,7 +1,3 @@ -#include +#define STACK_CHK_GUARD (((tcbhead_t __seg_fs *)0)->stack_guard) -#define STACK_CHK_GUARD \ - (*(uintptr_t __seg_fs *) offsetof (tcbhead_t, stack_guard)) - -#define POINTER_CHK_GUARD \ - (*(uintptr_t __seg_fs *) offsetof (tcbhead_t, pointer_guard)) +#define POINTER_CHK_GUARD (((tcbhead_t __seg_fs *)0)->pointer_guard)