[libc-commits] [libc] a342f77 - [libc] Fix ucontext_t and mcontext_t for C compliance (#192648)

via libc-commits libc-commits at lists.llvm.org
Fri Apr 17 08:35:20 PDT 2026


Author: Jeff Bailey
Date: 2026-04-17T16:35:15+01:00
New Revision: a342f779af8ccaebeedaec7a59dc789a0c7e8db3

URL: https://github.com/llvm/llvm-project/commit/a342f779af8ccaebeedaec7a59dc789a0c7e8db3
DIFF: https://github.com/llvm/llvm-project/commit/a342f779af8ccaebeedaec7a59dc789a0c7e8db3.diff

LOG: [libc] Fix ucontext_t and mcontext_t for C compliance (#192648)

* x86_64/ucontext_t.h: Removed alignas to fix C compilation error.

* x86_64/mcontext_t.h: Updated include guard to prevent collision.

Added: 
    

Modified: 
    libc/include/llvm-libc-types/x86_64/mcontext_t.h
    libc/include/llvm-libc-types/x86_64/ucontext_t.h

Removed: 
    


################################################################################
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