From patchwork Sun Aug 28 16:12:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 663379 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sMfvr5WzBz9s9N for ; Mon, 29 Aug 2016 02:13:11 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=Fgics16k; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 3AE5F30754; Sun, 28 Aug 2016 16:13:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id a0P284-18u52; Sun, 28 Aug 2016 16:13:04 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 21DBF26B5E; Sun, 28 Aug 2016 16:13:04 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 6EFE11C1698 for ; Sun, 28 Aug 2016 16:13:03 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 6D4BF8A65C for ; Sun, 28 Aug 2016 16:13:03 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Xb+BKMhIFpQP for ; Sun, 28 Aug 2016 16:12:59 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by whitealder.osuosl.org (Postfix) with ESMTPS id 267B68A656 for ; Sun, 28 Aug 2016 16:12:59 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id i5so6404469wmg.2 for ; Sun, 28 Aug 2016 09:12:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=zRv0SF01UA5VOLG1m37yH78KG6CAA2u5fmyWLmkXZ/Y=; b=Fgics16kZAmDCMBJr91yNjPhHEK82Mv8NNl4C5KOcv+IKlKowhAaL3BhsUTBSI7CTQ npZ7igDnty/+eH1J6bsgkexdy3LTYLmBx3/XDJHqkDTP+6IUoXJa5TXXF9l/B96IfjGU VcF/I7mKoQqPEmoprMGy26BQ6cO40Bg2l7w2t0bw0w6kzmnBeXUAJKrD2TOVQi5bQNfL HCXXebHHtpvcQK3arIqNFTZfNY+cGksINL4xHNDD/+ssb2Xmd479o7uC7sd0A+y/sDTW 3Df8F7g6516QigB8ESGxcOGPRSBvqdt5v8D/S9HxNFvF8ikhYVYK6bJjPU5Me341RSIv yzhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=zRv0SF01UA5VOLG1m37yH78KG6CAA2u5fmyWLmkXZ/Y=; b=StRABUQNGJBdyn08wR6KmLzuHRExMXNZK8wCBbPM5NXVr1VZBEen3OQG0/WF3YaoNh iNVnO2voMDDqvwPqleFfkLy+a6zBx3mJt0/buuEXmLj6rXE4Zfb2HerbjKJFGUi3olQq 7Eq4wa1A8onmIyZ7au82e1pSOYYysvghbrgEavk4fjuruI6W9v37yEnt6RU9ZU9JptSJ /njtZjIjqc2O3e5OWw/p+FidDy+s1c03FnTkkfSwapbBY3mgcB5T8ZV1z0cLFcsmYf/I LDK6zqCT29VBEeUhz9qwMmzwqd+shUwOqBHd3v4FPhahuo1/azEYGcA7IblWU3LSWwFC Yteg== X-Gm-Message-State: AE9vXwNNE04tMmcv5Cy9V7Zxohs2IKgczEl3x904v46d+Xr4nsxkzK3Ab1/fp0TiPSmGjw== X-Received: by 10.28.168.83 with SMTP id r80mr7392176wme.44.1472400777373; Sun, 28 Aug 2016 09:12:57 -0700 (PDT) Received: from gourin.bzh.lan (ns304657.ip-46-105-103.eu. [46.105.103.66]) by smtp.gmail.com with ESMTPSA id f187sm9183226wmf.15.2016.08.28.09.12.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 28 Aug 2016 09:12:56 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Sun, 28 Aug 2016 18:12:52 +0200 Message-Id: <1472400772-13647-1-git-send-email-yann.morin.1998@free.fr> X-Mailer: git-send-email 2.7.4 Cc: "Yann E. MORIN" Subject: [Buildroot] [PATCH] package/systemd: fix build with old toolchains X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Toolchains using glibc-218 or older do not define O_TMPFILE, which causes build failures on some archs. systemd has a definition for O_TMPFILE if it is missing, but only defines it for i386 or x86_64. Furthermore, the header defining it is not included everywhere O_TMPFILE is used. Fix that with two patches: - include the needed header where it is needed (he!), - define O_TMPFILE for all archs, according to linux-4.8rc3. Signed-off-by: "Yann E. MORIN" --- Status: patches sent upstream: https://github.com/systemd/systemd/pull/4052 --- ...-export-raw-needs-missing.h-for-O_TMPFILE.patch | 28 ++++++++++ ...h-add-missing-definitions-for-__O_TMPFILE.patch | 63 ++++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 package/systemd/0004-importd-export-raw-needs-missing.h-for-O_TMPFILE.patch create mode 100644 package/systemd/0005-missing.h-add-missing-definitions-for-__O_TMPFILE.patch diff --git a/package/systemd/0004-importd-export-raw-needs-missing.h-for-O_TMPFILE.patch b/package/systemd/0004-importd-export-raw-needs-missing.h-for-O_TMPFILE.patch new file mode 100644 index 0000000..2ebdf3f --- /dev/null +++ b/package/systemd/0004-importd-export-raw-needs-missing.h-for-O_TMPFILE.patch @@ -0,0 +1,28 @@ +From d3d268037e65c51e674f297018b92d51b2f3ec25 Mon Sep 17 00:00:00 2001 +From: "Yann E. MORIN" +Date: Sun, 28 Aug 2016 16:26:04 +0200 +Subject: [PATCH 4/5] importd/export-raw: needs missing.h for O_TMPFILE + +O_TMPFILE may be missing from the system headers, so use our fallback +definition. + +Signed-off-by: "Yann E. MORIN" +--- + src/import/export-raw.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/import/export-raw.c b/src/import/export-raw.c +index db06e11..2ec06b0 100644 +--- a/src/import/export-raw.c ++++ b/src/import/export-raw.c +@@ -25,6 +25,7 @@ + #include + #undef basename + ++#include "missing.h" + #include "sd-daemon.h" + + #include "alloc-util.h" +-- +2.7.4 + diff --git a/package/systemd/0005-missing.h-add-missing-definitions-for-__O_TMPFILE.patch b/package/systemd/0005-missing.h-add-missing-definitions-for-__O_TMPFILE.patch new file mode 100644 index 0000000..8a283d3 --- /dev/null +++ b/package/systemd/0005-missing.h-add-missing-definitions-for-__O_TMPFILE.patch @@ -0,0 +1,63 @@ +From d34c5bdb4635edd23dbbc761033063da4d7d55e3 Mon Sep 17 00:00:00 2001 +From: "Yann E. MORIN" +Date: Sun, 28 Aug 2016 17:26:42 +0200 +Subject: [PATCH 5/5] missing.h: add missing definitions for __O_TMPFILE + +Currently, a missing __O_TMPFILE was only defined for i386 and x86_64, +leaving any other architectures with an "old" toolchain fail miserably +at build time: + src/import/export-raw.c: In function 'reflink_snapshot': + src/import/export-raw.c:271:26: error: 'O_TMPFILE' undeclared (first use in this function) + new_fd = open(d, O_TMPFILE|O_CLOEXEC|O_NOCTTY|O_RDWR, 0600); + ^ + +__O_TMPFILE (and O_TMPFILE) are available since glibc 2.19. However, a +lot of existing toolchains are still using glibc-2.18, and some even +before that, and it is not really possible to update those toolchains. + +Instead of defining it only for i386 and x86_64, define __O_TMPFILE +with the specific values for those archs where it is different from the +generic value. Use the values as found in the Linux kernel (v4.8-rc3, +current as of time of commit). + +Signed-off-by: "Yann E. MORIN" + +--- +Note: tested on ARM (build+run), with glibc-2.18 and linux headers 3.12. +Untested on other archs, though (I have no board to test this). +--- + src/basic/missing.h | 16 ++++++++++++---- + 1 file changed, 12 insertions(+), 4 deletions(-) + +diff --git a/src/basic/missing.h b/src/basic/missing.h +index f8e0966..057d3fe 100644 +--- a/src/basic/missing.h ++++ b/src/basic/missing.h +@@ -537,12 +537,20 @@ struct btrfs_ioctl_quota_ctl_args { + # define DRM_IOCTL_DROP_MASTER _IO('d', 0x1f) + #endif + +-#if defined(__i386__) || defined(__x86_64__) +- +-/* The precise definition of __O_TMPFILE is arch specific, so let's +- * just define this on x86 where we know the value. */ ++/* The precise definition of __O_TMPFILE is arch specific; use the ++ * values defined by the kernel: ++ * - alpha, parisc, sparc: all have a specific value; ++ * - others: they use the "generic" value. ++ */ + + #ifndef __O_TMPFILE ++#if defined(__alpha__) ++#define __O_TMPFILE 0100000000 ++#elif defined(__parisc__) || defined(__hppa__) ++#define __O_TMPFILE 0400000000 ++#elif defined(__sparc__) || defined(__sparc64__) ++#define __O_TMPFILE 0x2000000 ++#else + #define __O_TMPFILE 020000000 + #endif + +-- +2.7.4 +