[libc-commits] [libc] [libc] Fix ucontext_t and mcontext_t for C compliance (PR #192648)
Jeff Bailey via libc-commits
libc-commits at lists.llvm.org
Fri Apr 17 06:21:10 PDT 2026
https://github.com/kaladron created https://github.com/llvm/llvm-project/pull/192648
* x86_64/ucontext_t.h: Removed alignas to fix C compilation error.
* x86_64/mcontext_t.h: Updated include guard to prevent collision.
>From 70d17b2f2f274525015dffcf597e600089e3b600 Mon Sep 17 00:00:00 2001
From: Jeff Bailey <jbailey at raspberryginger.com>
Date: Fri, 17 Apr 2026 14:13:57 +0100
Subject: [PATCH] [libc] Fix ucontext_t and mcontext_t for C compliance
* x86_64/ucontext_t.h: Removed alignas to fix C compilation error.
* x86_64/mcontext_t.h: Updated include guard to prevent collision.
---
libc/include/llvm-libc-types/x86_64/mcontext_t.h | 6 +++---
libc/include/llvm-libc-types/x86_64/ucontext_t.h | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/libc/include/llvm-libc-types/x86_64/mcontext_t.h b/libc/include/llvm-libc-types/x86_64/mcontext_t.h
index df9263f9411eb..4351f491294e7 100644
--- a/libc/include/llvm-libc-types/x86_64/mcontext_t.h
+++ b/libc/include/llvm-libc-types/x86_64/mcontext_t.h
@@ -8,8 +8,8 @@
// Note: Definitions in this file are based on the Linux kernel ABI.
-#ifndef LLVM_LIBC_TYPES_MCONTEXT_T_H
-#define LLVM_LIBC_TYPES_MCONTEXT_T_H
+#ifndef LLVM_LIBC_TYPES_X86_64_MCONTEXT_T_H
+#define LLVM_LIBC_TYPES_X86_64_MCONTEXT_T_H
// The following definitions correspond to the general purpose registers.
// The layout of gregset_t and the enum indices must match the layout of
@@ -118,4 +118,4 @@ typedef struct {
unsigned long long __reserved1[8];
} mcontext_t;
-#endif // LLVM_LIBC_TYPES_MCONTEXT_T_H
+#endif // LLVM_LIBC_TYPES_X86_64_MCONTEXT_T_H
diff --git a/libc/include/llvm-libc-types/x86_64/ucontext_t.h b/libc/include/llvm-libc-types/x86_64/ucontext_t.h
index 15d755050076f..bb8cfe6069aae 100644
--- a/libc/include/llvm-libc-types/x86_64/ucontext_t.h
+++ b/libc/include/llvm-libc-types/x86_64/ucontext_t.h
@@ -15,7 +15,7 @@
#include "../stack_t.h"
#include "mcontext_t.h"
-typedef struct alignas(16) ucontext_t {
+typedef struct ucontext_t {
// The following fields must match the Linux kernel's struct ucontext
// on x86_64 to ensure ABI compatibility for signal handling.
unsigned long uc_flags;
@@ -34,7 +34,7 @@ typedef struct alignas(16) ucontext_t {
// provide space here for the FP state, and the pointer in uc_mcontext
// can be set to point here. 64 long ints provide 512 bytes, which is
// the size required for FXSAVE.
- alignas(16) long int __fpregs_mem[64];
+ _Alignas(16) long int __fpregs_mem[64];
// Support for Shadow Stack Pointer (Intel CET).
unsigned long long __ssp[4];
More information about the libc-commits
mailing list