Skip to content

Commit e42a46d

Browse files
committed
C library: __asm("<X>fence") is x86-only
Builds on Mac M1 were failing when (rightly) reporting that these were unrecognised mnemonics.
1 parent 31e4ddf commit e42a46d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/ansi-c/library/gcc.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,36 @@
11
/* FUNCTION: __builtin_ia32_sfence */
22

3+
#if defined(__i386__) || defined(__x86_64__)
4+
35
void __builtin_ia32_sfence(void)
46
{
57
__asm("sfence");
68
}
79

10+
#endif
11+
812
/* FUNCTION: __builtin_ia32_lfence */
913

14+
#if defined(__i386__) || defined(__x86_64__)
15+
1016
void __builtin_ia32_lfence(void)
1117
{
1218
__asm("lfence");
1319
}
1420

21+
#endif
22+
1523
/* FUNCTION: __builtin_ia32_mfence */
1624

25+
#if defined(__i386__) || defined(__x86_64__)
26+
1727
void __builtin_ia32_mfence(void)
1828
{
1929
__asm("mfence");
2030
}
2131

32+
#endif
33+
2234
/* FUNCTION: __sync_synchronize */
2335

2436
void __sync_synchronize(void)

0 commit comments

Comments
 (0)