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
<stdint.h>.
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
-#include <stdint.h>
+#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)
-#include <stdint.h>
+#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)