Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libco/aarch64.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
extern "C" {
#endif

static thread_local uintptr_t co_active_buffer[64];
static thread_local alignas(16) uintptr_t co_active_buffer[64];
static thread_local cothread_t co_active_handle = 0;
static void (*co_swap)(cothread_t, cothread_t) = 0;

Expand Down
2 changes: 1 addition & 1 deletion libco/amd64.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
extern "C" {
#endif

static thread_local long long co_active_buffer[64];
static thread_local alignas(16) long long co_active_buffer[64];
static thread_local cothread_t co_active_handle = 0;
static void (*co_swap)(cothread_t, cothread_t) = 0;

Expand Down
28 changes: 6 additions & 22 deletions libco/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
#endif

#if __STDC_VERSION__ >= 201112L
#if !defined(_MSC_VER)
#include <stdalign.h>
#endif
#include <stdalign.h>
#else
#define alignas(bytes)
#endif
Expand All @@ -36,26 +34,12 @@
#define section(name) __declspec(allocate(".text"))
#elif defined(__APPLE__)
#define section(name) __attribute__((section("__TEXT,__" #name)))
#else
#elif defined(__GNUC__) && !defined(__clang__)
/* the # is treated as comment token by the GNU assembler. */
/* this is a hack to avoid a warning about changed section attributes. */
#define section(name) __attribute__((section("." #name "#")))
#endif

#if defined(__clang__)
#pragma clang diagnostic ignored "-Wparentheses"

#if !defined(_MSC_VER)
/* placing code in section(text) does not mark it executable with Clang. */
#undef LIBCO_MPROTECT
#define LIBCO_MPROTECT
#endif
#endif

#if defined(__aarch64__)
/* NX also seems to be consistently set under non-Windows arm64 */
#if !defined(_MSC_VER)
#undef LIBCO_MPROTECT
#define LIBCO_MPROTECT
#endif
#else
#define section(name) __attribute__((section("." #name)))
#endif

/* if defined(LIBCO_C) */
Expand Down
Loading