x86: Avoid single-argument _Static_assert in <tls.h>

Older GCC versions do not support this extension.  Fixes commit f1bdee6179
("x86 tls: Use _Static_assert for TLS access size assertion").
This commit is contained in:
Florian Weimer 2020-02-17 11:08:15 +01:00
parent f1bdee6179
commit fe49a73316
3 changed files with 36 additions and 24 deletions

View File

@ -257,7 +257,8 @@ tls_fill_user_desc (union user_desc_init *desc,
({ __typeof (descr->member) __value; \
_Static_assert (sizeof (__value) == 1 \
|| sizeof (__value) == 4 \
|| sizeof (__value) == 8); \
|| sizeof (__value) == 8, \
"size of per-thread data"); \
if (sizeof (__value) == 1) \
asm volatile ("movb %%gs:%P2,%b0" \
: "=q" (__value) \
@ -282,7 +283,8 @@ tls_fill_user_desc (union user_desc_init *desc,
({ __typeof (descr->member[0]) __value; \
_Static_assert (sizeof (__value) == 1 \
|| sizeof (__value) == 4 \
|| sizeof (__value) == 8); \
|| sizeof (__value) == 8, \
"size of per-thread data"); \
if (sizeof (__value) == 1) \
asm volatile ("movb %%gs:%P2(%3),%b0" \
: "=q" (__value) \
@ -310,7 +312,8 @@ tls_fill_user_desc (union user_desc_init *desc,
({ \
_Static_assert (sizeof (descr->member) == 1 \
|| sizeof (descr->member) == 4 \
|| sizeof (descr->member) == 8); \
|| sizeof (descr->member) == 8, \
"size of per-thread data"); \
if (sizeof (descr->member) == 1) \
asm volatile ("movb %b0,%%gs:%P1" : \
: "iq" (value), \
@ -334,7 +337,8 @@ tls_fill_user_desc (union user_desc_init *desc,
({ \
_Static_assert (sizeof (descr->member[0]) == 1 \
|| sizeof (descr->member[0]) == 4 \
|| sizeof (descr->member[0]) == 8); \
|| sizeof (descr->member[0]) == 8, \
"size of per-thread data"); \
if (sizeof (descr->member[0]) == 1) \
asm volatile ("movb %b0,%%gs:%P1(%2)" : \
: "iq" (value), \

View File

@ -168,7 +168,8 @@ out:
({ __typeof (descr->member) __value; \
_Static_assert (sizeof (__value) == 1 \
|| sizeof (__value) == 4 \
|| sizeof (__value) == 8); \
|| sizeof (__value) == 8, \
"size of per-thread data"); \
if (sizeof (__value) == 1) \
asm volatile ("movb %%gs:%P2,%b0" \
: "=q" (__value) \
@ -193,7 +194,8 @@ out:
({ __typeof (descr->member[0]) __value; \
_Static_assert (sizeof (__value) == 1 \
|| sizeof (__value) == 4 \
|| sizeof (__value) == 8); \
|| sizeof (__value) == 8, \
"size of per-thread data"); \
if (sizeof (__value) == 1) \
asm volatile ("movb %%gs:%P2(%3),%b0" \
: "=q" (__value) \
@ -221,7 +223,8 @@ out:
({ \
_Static_assert (sizeof (descr->member) == 1 \
|| sizeof (descr->member) == 4 \
|| sizeof (descr->member) == 8); \
|| sizeof (descr->member) == 8, \
"size of per-thread data"); \
if (sizeof (descr->member) == 1) \
asm volatile ("movb %b0,%%gs:%P1" : \
: "iq" (value), \
@ -245,7 +248,8 @@ out:
({ \
_Static_assert (sizeof (descr->member[0]) == 1 \
|| sizeof (descr->member[0]) == 4 \
|| sizeof (descr->member[0]) == 8); \
|| sizeof (descr->member[0]) == 8, \
"size of per-thread data"); \
if (sizeof (descr->member[0]) == 1) \
asm volatile ("movb %b0,%%gs:%P1(%2)" : \
: "iq" (value), \

View File

@ -201,7 +201,8 @@ _Static_assert (offsetof (tcbhead_t, __glibc_unused2) == 0x80,
({ __typeof (descr->member) __value; \
_Static_assert (sizeof (__value) == 1 \
|| sizeof (__value) == 4 \
|| sizeof (__value) == 8); \
|| sizeof (__value) == 8, \
"size of per-thread data"); \
if (sizeof (__value) == 1) \
asm volatile ("movb %%fs:%P2,%b0" \
: "=q" (__value) \
@ -224,7 +225,8 @@ _Static_assert (offsetof (tcbhead_t, __glibc_unused2) == 0x80,
({ __typeof (descr->member[0]) __value; \
_Static_assert (sizeof (__value) == 1 \
|| sizeof (__value) == 4 \
|| sizeof (__value) == 8); \
|| sizeof (__value) == 8, \
"size of per-thread data"); \
if (sizeof (__value) == 1) \
asm volatile ("movb %%fs:%P2(%q3),%b0" \
: "=q" (__value) \
@ -258,7 +260,8 @@ _Static_assert (offsetof (tcbhead_t, __glibc_unused2) == 0x80,
({ \
_Static_assert (sizeof (descr->member) == 1 \
|| sizeof (descr->member) == 4 \
|| sizeof (descr->member) == 8); \
|| sizeof (descr->member) == 8, \
"size of per-thread data"); \
if (sizeof (descr->member) == 1) \
asm volatile ("movb %b0,%%fs:%P1" : \
: "iq" (value), \
@ -280,7 +283,8 @@ _Static_assert (offsetof (tcbhead_t, __glibc_unused2) == 0x80,
({ \
_Static_assert (sizeof (descr->member[0]) == 1 \
|| sizeof (descr->member[0]) == 4 \
|| sizeof (descr->member[0]) == 8); \
|| sizeof (descr->member[0]) == 8, \
"size of per-thread data"); \
if (sizeof (descr->member[0]) == 1) \
asm volatile ("movb %b0,%%fs:%P1(%q2)" : \
: "iq" (value), \