From patchwork Tue Feb 13 12:27:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baruch Siach X-Patchwork-Id: 872813 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zghdv6bfvz9t5w for ; Tue, 13 Feb 2018 23:28:18 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 02C4C880F6; Tue, 13 Feb 2018 12:28:15 +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 56a6L83cSPIb; Tue, 13 Feb 2018 12:28:14 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 2C75E880DF; Tue, 13 Feb 2018 12:28:14 +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 076EF1C062C for ; Tue, 13 Feb 2018 12:28:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 007CE880E4 for ; Tue, 13 Feb 2018 12:28:13 +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 X-PL1-c5LU2v for ; Tue, 13 Feb 2018 12:28:10 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx.tkos.co.il (guitar.tcltek.co.il [192.115.133.116]) by whitealder.osuosl.org (Postfix) with ESMTPS id A46C9880DF for ; Tue, 13 Feb 2018 12:28:10 +0000 (UTC) Received: from tarshish.tkos.co.il (unknown [10.0.8.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx.tkos.co.il (Postfix) with ESMTPSA id A3F8A440A6A; Tue, 13 Feb 2018 14:28:07 +0200 (IST) From: Baruch Siach To: buildroot@busybox.net Date: Tue, 13 Feb 2018 14:27:50 +0200 Message-Id: X-Mailer: git-send-email 2.15.1 In-Reply-To: <00926ed70cd14972bac0ce653b1f383b4a31492c.1518524870.git.baruch@tkos.co.il> References: <00926ed70cd14972bac0ce653b1f383b4a31492c.1518524870.git.baruch@tkos.co.il> Subject: [Buildroot] [PATCH 2/2] toolchain: limit musl/kernel headers conflict workaround X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Petazzoni MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" The musl/kernel headers workaround was added in commit 196932cd91 (toolchain: workaround musl/kernel headers conflict) to fix definition collisions in networking related headers between musl headers and kernel headers. Kernel headers from version 4.15 and newer do not need this workaround anymore since kernel commit c0bace798436bc (uapi libc compat: add fallback for unsupported libcs). The C library does not have to define the __GLIBC__ macro to make the __UAPI_DEF_* macros effective. Updated the comment to accordingly. Tested with the xl2tp package. This package fails to build with older kernel headers without the workaround (struct in_pktinfo redefinition, among others). With 4.15 headers, xl2tp builds fine with this patch applied. That is, no workaround needed. Cc: Thomas Petazzoni Signed-off-by: Baruch Siach --- toolchain/toolchain/toolchain.mk | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/toolchain/toolchain/toolchain.mk b/toolchain/toolchain/toolchain.mk index b55b0c712cb9..179c09edf1ad 100644 --- a/toolchain/toolchain/toolchain.mk +++ b/toolchain/toolchain/toolchain.mk @@ -13,18 +13,18 @@ endif TOOLCHAIN_ADD_TOOLCHAIN_DEPENDENCY = NO # Apply a hack that Rick Felker suggested[1] to avoid conflicts between libc -# headers and kernel headers. This is a temporary measure until musl finds a -# better solution. +# headers and kernel headers. This is needed for kernel headers older than +# 4.15. Kernel headers 4.15 and newer don't require __GLIBC__ to be defined. # # Augment the original suggestion with __USE_MISC since recent kernels -# require this glibc internal macro. Also, as musl defines IFF_LOWER_UP, -# IFF_DORMANT and IFF_ECHO, add another macro to suppress them in the -# kernel header, and avoid macro/enum conflict. +# (older than 4.15) require this glibc internal macro. Also, as musl defines +# IFF_LOWER_UP, IFF_DORMANT and IFF_ECHO, add another macro to suppress +# them in the kernel header, and avoid macro/enum conflict. # # Kernel version 3.12 introduced the libc-compat.h header. # # [1] http://www.openwall.com/lists/musl/2015/10/08/2 -ifeq ($(BR2_TOOLCHAIN_USES_MUSL)$(BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12),yy) +ifeq ($(BR2_TOOLCHAIN_USES_MUSL)$(BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12):$(BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_15),yy:) define TOOLCHAIN_MUSL_KERNEL_HEADERS_COMPATIBILITY_HACK $(SED) 's/^#if defined(__GLIBC__)$$/#if 1/' \ $(STAGING_DIR)/usr/include/linux/libc-compat.h