From patchwork Fri Dec 6 12:43:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 297728 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 86D642C0091 for ; Fri, 6 Dec 2013 23:43:59 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=iEa4j+AtZ5Zi2xbF8vHXiU7/L5iJH z6UJ2RtN8rignm663kDe2sYRYBnrlD5CuINewvKtz/DnjpdRTvZN4fCa9ymH/UbT NbPzqHIUyBQBzu5/XUOpTwTxFK1RLDrJZ/Dan9Xreu5d7eWdsh32dsgrFjwH4BUb 7qFNW9fJUCfJks= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=QzSr+kr63OR1/42PdRBKPmM7DMg=; b=TvC /WB2oYJvLWufu/3MsTRWGnyDfL3edEwfOyr7PyZKqizHec9/lzNXsruAHk+jP3Xz efgVPJblCk9bS38U+CrsKhiAY00oovGm0FEYPmVtnbgczLDAYlXJCRKvshs0znI5 HN7DT6MGJKq4xz6dvXJFprHmpLR03sBQ5KLbo/8g= Received: (qmail 10049 invoked by alias); 6 Dec 2013 12:43:53 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 10040 invoked by uid 89); 6 Dec 2013 12:43:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.8 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from Unknown (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Dec 2013 12:43:52 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rB6ChiKI027556 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 6 Dec 2013 07:43:44 -0500 Received: from tucnak.zalov.cz (vpn1-5-16.ams2.redhat.com [10.36.5.16]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id rB6Chg4d017520 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 6 Dec 2013 07:43:44 -0500 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.14.7/8.14.7) with ESMTP id rB6ChggV009983; Fri, 6 Dec 2013 13:43:42 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.14.7/8.14.7/Submit) id rB6Chgmq009982; Fri, 6 Dec 2013 13:43:42 +0100 Date: Fri, 6 Dec 2013 13:43:42 +0100 From: Jakub Jelinek To: Konstantin Serebryany , Dodji Seketeli Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Allow building if libsanitizer on RHEL5 (i.e. with 2.6.18-ish kernel headers) Message-ID: <20131206124342.GL892@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Hi! Here is an alternative version of the patch I've posted earlier to allow building libsanitizer on 2.6.18-ish kernel headers, this time by adding 5 tiny kernel header wrappers. The only drawback of this are warnings like: ../../../../libsanitizer/include/linux/aio_abi.h:2:2: warning: #include_next is a GCC extension [enabled by default] (and generally just on the two source files that include these problematic kernel headers, so about 10 warnings total). We could avoid that by not building with -pedantic, or by using -isystem instead of -I for the libsanitizer/include headers (which has drawback that we wouldn't get warnings for stuff in libsanitizer/include/sanitizer/ headers), or these could live in some other directory, say libsanitizer/include/wrappers/linux/*.h and we would add -isystem $(top_srcdir)/include/wrappers/. Note that testing still shows some issues, e.g. because the kThreadDescriptorSize change has not been applied. But it at least builds and for many tests works. 2013-12-06 Jakub Jelinek * include/linux/aio_abi.h: New header. * include/linux/mroute.h: New header. * include/linux/mroute6.h: New header. * include/linux/perf_event.h: New header. * include/linux/types.h: New header. Jakub --- libsanitizer/include/linux/aio_abi.h.jj 2013-12-06 06:02:29.000000000 -0500 +++ libsanitizer/include/linux/aio_abi.h 2013-12-06 06:03:11.000000000 -0500 @@ -0,0 +1,7 @@ +#include +#include_next +/* 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/linux/mroute.h.jj 2013-12-06 06:14:30.000000000 -0500 +++ libsanitizer/include/linux/mroute.h 2013-12-06 06:10:09.000000000 -0500 @@ -0,0 +1,8 @@ +#include +/* before 2.6.26 included + which clashes with userspace headers. */ +#if LINUX_VERSION_CODE < 132634 +#define _LINUX_IN_H +#include +#endif +#include_next --- libsanitizer/include/linux/mroute6.h.jj 2013-12-06 03:58:19.000000000 -0500 +++ libsanitizer/include/linux/mroute6.h 2013-12-06 06:13:59.000000000 -0500 @@ -0,0 +1,5 @@ +#include +/* has been added in 2.6.26 */ +#if LINUX_VERSION_CODE >= 132634 +#include_next +#endif --- libsanitizer/include/linux/perf_event.h.jj 2013-12-06 03:58:01.000000000 -0500 +++ libsanitizer/include/linux/perf_event.h 2013-12-06 05:59:16.000000000 -0500 @@ -0,0 +1,7 @@ +#include +/* has been added in 2.6.32 */ +#if LINUX_VERSION_CODE >= 132640 +#include_next +#else +#define perf_event_attr __sanitizer_perf_event_attr +#endif --- libsanitizer/include/linux/types.h.jj 2013-12-06 03:57:37.000000000 -0500 +++ libsanitizer/include/linux/types.h 2013-12-06 03:57:33.000000000 -0500 @@ -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 +#undef ustat + +#endif