perf: fix strerror_r override detection, apparently part of tools/ relies on non...
authorFelix Fietkau <nbd@openwrt.org>
Tue, 12 Jan 2016 16:42:12 +0000 (16:42 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 12 Jan 2016 16:42:12 +0000 (16:42 +0000)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 48221

package/devel/perf/Makefile
package/devel/perf/musl-compat.h
package/devel/perf/musl-include/string.h [new file with mode: 0644]

index 97eecd715d1c2bff7c783f6e330566406f469a03..e6ee62f5a215321fba373cbb84b5ed72497c7458 100644 (file)
@@ -59,7 +59,7 @@ MAKE_FLAGS = \
        prefix=/usr
 
 ifdef CONFIG_USE_MUSL
- MAKE_FLAGS += EXTRA_CFLAGS="-include $(CURDIR)/musl-compat.h -D__UCLIBC__"
+ MAKE_FLAGS += EXTRA_CFLAGS="-I$(CURDIR)/musl-include -include $(CURDIR)/musl-compat.h -D__UCLIBC__"
 endif
 
 define Build/Compile
index d0fa7810fa8e95de825bae8ed63d00c1b9735128..458915d5eb85106b62a8943330a68c0b8be258e3 100644 (file)
@@ -4,7 +4,6 @@
 #ifndef __ASSEMBLER__
 
 #include <sys/ioctl.h>
-#include <string.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <syscall.h>
 #undef _IOC
 #undef _IO
 
-/* Change XSI compliant version into GNU extension hackery */
-static inline char *
-gnu_strerror_r(int err, char *buf, size_t buflen)
-{
-       if (strerror_r(err, buf, buflen))
-               return NULL;
-       return buf;
-}
-#define strerror_r gnu_strerror_r
-
 #define _SC_LEVEL1_DCACHE_LINESIZE -1
 
 static inline long sysconf_wrap(int name)
diff --git a/package/devel/perf/musl-include/string.h b/package/devel/perf/musl-include/string.h
new file mode 100644 (file)
index 0000000..65dc2f1
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef __MUSL_COMPAT_STRING_H
+#define __MUSL_COMPAT_STRING_H
+
+#include_next <string.h>
+
+/* Change XSI compliant version into GNU extension hackery */
+static inline char *
+gnu_strerror_r(int err, char *buf, size_t buflen)
+{
+       if (strerror_r(err, buf, buflen))
+               return NULL;
+       return buf;
+}
+#ifdef _GNU_SOURCE
+#define strerror_r gnu_strerror_r
+#endif
+
+#endif