Skip to content

Commit 9971292

Browse files
committed
win32: fix GCC attribute placement for NaClThreadContext
Move the Windows alignment attribute after the struct keyword so GCC accepts the declaration without triggering -Werror=attributes.
1 parent 8e1fc11 commit 9971292

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎src/trusted/service_runtime/arch/x86_32/sel_rt_32.h‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,17 @@ struct NaClGsSegment {
9898
*/
9999
#if NACL_WINDOWS
100100
/* Align gs_segment for better performance on Intel Atom */
101-
__declspec(align(64))
101+
#if defined(_MSC_VER)
102+
#define NACL_THREAD_CONTEXT_ALIGN __declspec(align(64))
103+
#elif defined(__GNUC__)
104+
#define NACL_THREAD_CONTEXT_ALIGN __attribute__((aligned(64)))
105+
#else
106+
#define NACL_THREAD_CONTEXT_ALIGN
102107
#endif
103-
struct NaClThreadContext {
108+
#else
109+
#define NACL_THREAD_CONTEXT_ALIGN
110+
#endif
111+
struct NACL_THREAD_CONTEXT_ALIGN NaClThreadContext {
104112
/*
105113
* We align gs_segment to a multiple of 64 bytes because otherwise
106114
* memory accesses through the %gs segment are slow on Intel Atom

0 commit comments

Comments
 (0)