summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SConstruct6
-rw-r--r--gpsd.h-tail12
2 files changed, 8 insertions, 10 deletions
diff --git a/SConstruct b/SConstruct
index 756616c9..ab9bafa7 100644
--- a/SConstruct
+++ b/SConstruct
@@ -88,10 +88,6 @@ systemd = os.path.exists("/usr/share/systemd/system")
# Set distribution-specific defaults here
imloads = True
-# Does our platform has a working memory-barrier instruction?
-# The shared-memory export won't be reliable without it.
-mfence = (platform.machine() in ('x86_64',))
-
boolopts = (
# GPS protocols
("nmea", True, "NMEA support"),
@@ -127,7 +123,7 @@ boolopts = (
# Export methods
("socket_export", True, "data export over sockets"),
("dbus_export", False, "enable DBUS export support"),
- ("shm_export", mfence,"export via shared memory"),
+ ("shm_export", True, "export via shared memory"),
# Communication
('usb', True, "libusb support for USB devices"),
("bluez", True, "BlueZ support for Bluetooth devices"),
diff --git a/gpsd.h-tail b/gpsd.h-tail
index 87c31386..80319e82 100644
--- a/gpsd.h-tail
+++ b/gpsd.h-tail
@@ -998,11 +998,13 @@ void cfmakeraw(struct termios *);
/* memory barriers */
static /*@unused@*/ inline void barrier(void) {
-#if defined(__GNUC__) && defined(__x86_64__)
-#ifndef S_SPLINT_S
- asm volatile("mfence");
-#endif /* S_SPLINT_S */
-#endif /* defined(__GNUC__) && defined(__x86_64__) */
+#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
+ __atomic_thread_fence(__ATOMIC_SEQ_CST);
+#elif (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
+ __sync_synchronize();
+#else
+# error Memory barriers are not supported. Disable SHM export.
+#endif /* defined(__GNUC__) */
}
#endif /* _GPSD_H_ */