This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Allow building if libsanitizer on RHEL5 (i.e. with 2.6.18-ish kernel headers, take 2)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Konstantin Serebryany <konstantin dot s dot serebryany at gmail dot com>, Dodji Seketeli <dseketel at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 10 Dec 2013 12:34:10 +0100
- Subject: [PATCH] Allow building if libsanitizer on RHEL5 (i.e. with 2.6.18-ish kernel headers, take 2)
- Authentication-results: sourceware.org; auth=none
- References: <20131206124342 dot GL892 at tucnak dot redhat dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
Here is an updated version which doesn't warn about #include_next.
Ok for trunk?
2013-12-10 Jakub Jelinek <jakub@redhat.com>
* sanitizer_common/Makefile.am (AM_CPPFLAGS): Add
-isystem $(top_srcdir)/include/system.
* sanitizer_common/Makefile.in: Regenerated.
* include/system/linux/aio_abi.h: New header.
* include/system/linux/mroute.h: New header.
* include/system/linux/mroute6.h: New header.
* include/system/linux/perf_event.h: New header.
* include/system/linux/types.h: New header.
--- libsanitizer/sanitizer_common/Makefile.am.jj 2013-12-10 09:55:19.000000000 +0100
+++ libsanitizer/sanitizer_common/Makefile.am 2013-12-10 09:56:36.748472017 +0100
@@ -1,5 +1,5 @@
-AM_CPPFLAGS = -I $(top_srcdir)/include
-
+AM_CPPFLAGS = -I $(top_srcdir)/include -isystem $(top_srcdir)/include/system
+
# May be used by toolexeclibdir.
gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
--- libsanitizer/include/system/linux/mroute.h.jj 2013-12-10 09:56:03.888640325 +0100
+++ libsanitizer/include/system/linux/mroute.h 2013-12-10 09:56:03.888640325 +0100
@@ -0,0 +1,8 @@
+#include <linux/version.h>
+/* <linux/mroute.h> before 2.6.26 included <linux/in.h>
+ which clashes with userspace headers. */
+#if LINUX_VERSION_CODE < 132634
+#define _LINUX_IN_H
+#include <linux/types.h>
+#endif
+#include_next <linux/mroute.h>
--- libsanitizer/include/system/linux/aio_abi.h.jj 2013-12-10 09:56:03.887640312 +0100
+++ libsanitizer/include/system/linux/aio_abi.h 2013-12-10 09:56:03.887640312 +0100
@@ -0,0 +1,7 @@
+#include <linux/version.h>
+#include_next <linux/aio_abi.h>
+/* IOCB_CMD_PREADV/PWRITEV has been added in 2.6.19 */
+#if LINUX_VERSION_CODE < 132627
+#define IOCB_CMD_PREADV 7
+#define IOCB_CMD_PWRITEV 8
+#endif
--- libsanitizer/include/system/linux/types.h.jj 2013-12-10 09:56:03.888640325 +0100
+++ libsanitizer/include/system/linux/types.h 2013-12-10 09:56:03.888640325 +0100
@@ -0,0 +1,12 @@
+#ifndef LINUX_TYPES_WRAPPER_H
+#define LINUX_TYPES_WRAPPER_H
+
+/* Before
+ https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/include/linux/types.h?id=6c7c6afbb8c0e60d32a563cae7c6889211e9d9d8
+ linux/types.h conflicted with sys/ustat.h. Work around it. */
+
+#define ustat __asan_bad_ustat
+#include_next <linux/types.h>
+#undef ustat
+
+#endif
--- libsanitizer/include/system/linux/perf_event.h.jj 2013-12-10 09:56:03.888640325 +0100
+++ libsanitizer/include/system/linux/perf_event.h 2013-12-10 09:56:03.888640325 +0100
@@ -0,0 +1,7 @@
+#include <linux/version.h>
+/* <linux/perf_event.h> has been added in 2.6.32 */
+#if LINUX_VERSION_CODE >= 132640
+#include_next <linux/perf_event.h>
+#else
+#define perf_event_attr __sanitizer_perf_event_attr
+#endif
--- libsanitizer/include/system/linux/mroute6.h.jj 2013-12-10 09:56:03.888640325 +0100
+++ libsanitizer/include/system/linux/mroute6.h 2013-12-10 09:56:03.888640325 +0100
@@ -0,0 +1,5 @@
+#include <linux/version.h>
+/* <linux/mroute6.h> has been added in 2.6.26 */
+#if LINUX_VERSION_CODE >= 132634
+#include_next <linux/mroute6.h>
+#endif
--- libsanitizer/sanitizer_common/Makefile.in.jj 2013-12-10 09:55:19.000000000 +0100
+++ libsanitizer/sanitizer_common/Makefile.in 2013-12-10 09:57:05.079324403 +0100
@@ -235,7 +235,7 @@ toolexeclibdir = @toolexeclibdir@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-AM_CPPFLAGS = -I $(top_srcdir)/include
+AM_CPPFLAGS = -I $(top_srcdir)/include -isystem $(top_srcdir)/include/system
# May be used by toolexeclibdir.
gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
Jakub