Fix ucontext_t alignment in strict ansi mode

Using `cosmocc -std=c11` was causing `ucontext_t` to become misaligned.
This change also adds the GNU constants on x86_64 for accessing general
registers, so you will not need `#ifdef`s to support both Cosmo and GNU
This commit is contained in:
Justine Tunney 2023-11-09 12:44:42 -08:00
parent b8d1377ae1
commit 15af5c2d7e
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
2 changed files with 28 additions and 12 deletions

View file

@ -174,18 +174,9 @@ typedef struct {
#endif
#ifndef forcealign
#ifndef __STRICT_ANSI__
#define forcealign(bytes) __attribute__((__aligned__(bytes)))
#else
#define forcealign(bytes)
#endif
#endif
#ifndef __STRICT_ANSI__
#define thatispacked __attribute__((__packed__))
#else
#define thatispacked
#endif
#ifndef __STRICT_ANSI__
#define printfesque(n) __attribute__((__format__(__gnu_printf__, n, n + 1)))
@ -727,8 +718,7 @@ void abort(void) wontreturn;
#define __static_yoink_source(PATH)
#endif
#define __weak_reference(sym, alias) \
__weak_reference_impl(sym, alias)
#define __weak_reference(sym, alias) __weak_reference_impl(sym, alias)
#define __weak_reference_impl(sym, alias) \
__asm__(".weak\t" #alias "\n\t" \
".equ\t" #alias ", " #sym "\n\t" \