diff --git a/boards/native/Makefile.include b/boards/native/Makefile.include
index 5ab3dc00173033c1860fb99525a17867db82f958..ffb0cb430717db0848d42161d6a9257adf830364 100644
--- a/boards/native/Makefile.include
+++ b/boards/native/Makefile.include
@@ -95,6 +95,11 @@ all-gprof: export LINKFLAGS += -pg
 
 export INCLUDES += $(NATIVEINCLUDES)
 
+# workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52624
+ifneq ($(shell gcc --version | head -1 | grep -E ' (4.6|4.7)'),)
+	export CFLAGS += -DHAVE_NO_BUILTIN_BSWAP16
+endif
+
 # backward compatability with glibc <= 2.17 for native
 ifeq ($(CPU),native)
 ifeq ($(shell uname -s),Linux)
diff --git a/core/include/byteorder.h b/core/include/byteorder.h
index a67dcc2097b5b1a235ad801082e0e86080e4c7b6..abac956ed5c0b063911e6f778365117eab68cb78 100644
--- a/core/include/byteorder.h
+++ b/core/include/byteorder.h
@@ -275,6 +275,12 @@ static inline uint64_t NTOHLL(uint64_t v);
 
 /* **************************** IMPLEMENTATION ***************************** */
 
+#ifdef HAVE_NO_BUILTIN_BSWAP16
+static inline unsigned short __builtin_bswap16(unsigned short a)
+{
+    return (a<<8)|(a>>8);
+}
+#endif
 
 static inline uint16_t byteorder_swaps(uint16_t v)
 {