Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5608147imu; Mon, 26 Nov 2018 02:56:58 -0800 (PST) X-Google-Smtp-Source: AFSGD/UAgPbglXqVDDklUBA6ZjLqaScBdlvgHul6ydwMJ3mv7DCteyP/ksUnCofV2WBXTWYwKX8S X-Received: by 2002:a65:48c4:: with SMTP id o4mr23671867pgs.371.1543229818214; Mon, 26 Nov 2018 02:56:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543229818; cv=none; d=google.com; s=arc-20160816; b=fJiIoKrZ8zwpyXxxp71xiyKyhiHA6jeIGUFwthZqATJX7vIZet1kYveP+Fq5sh+HVJ yXNSNDNjCcXX2Gtj7cBZ4Zy9Xl/gZM1DW325DckwBtOxZ+Ij9zOmI5xWm194IZWdMlE7 09y1ELQIhpHdFOTkpw4KnGANyslxmZ4FLQJfRgDenfxWKehImHzfqvmslM+ZRplbP8/s /FvTVJXwlh/a1ueP9OQw8RqAzsO3oleutmOjgTZh+leZMs8dd1aTOsDWPFYV9mTPLss4 gLphl+F2+r+V6kfLDM+0pHCuHdNuCQYzh47rL/sF1OtxD19DKnlJyYN5lKpu7txz34PM ulrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=C7kiDW7IDRKL5jBvxPgQYsDQnrbpWQCRBm+Pg3DL9ZA=; b=fNxZ08I3pQw5f5QioxLYTxfQNc8LQiPjXfQ7Ql3Ebxj3lGW64Hggf9KYE/Pf9xyTz3 v01zjJGZBlvilEUlX8ZfMulCH6RBzIm8+Kudf2va5pOirWbiDRualvFMJ9YLjKU/OBSP QbfFmq2d+Kqed1bcXEtzl2ba6JBu5s4injWLe2I1YeCglC9r1PmlkLCOlqdzLrzlsA0v kbl3PX6FPKCffLhwbDXhR31E8A+HB75qsbW+6xEsOh3EcqjPxd5iKl9Eh6IATgNj/vLu 5mDoYKvdAMhnydcRQvoU+Los0n1WfRQJIdwNovyS3HxQhGtB+lNrG8ngP9hUArNCHeoA oyrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Bgm4oKrm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o31si60766305pgb.273.2018.11.26.02.56.43; Mon, 26 Nov 2018 02:56:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Bgm4oKrm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727880AbeKZVtE (ORCPT + 99 others); Mon, 26 Nov 2018 16:49:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:57886 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726824AbeKZVtD (ORCPT ); Mon, 26 Nov 2018 16:49:03 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7D5262089F; Mon, 26 Nov 2018 10:55:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543229720; bh=S2iBR1g4sG0lE6OvouxczurnInkVSoINHXmf4+ClVTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bgm4oKrmel67MeD/8tZPSRfAwePCXIhZ8d+GpPewrW8ywsu8oUGJE5Y0YZk+oRTEQ rNdZk63P5DGuir+EbCF9b93BuaiB42skndMxRkobV1a/Z7Tan/LFEtuzobmpbYh5eM ZEjBooU8BIbkZ6mFO5+dhvmsu2TzJT1E9uc8ow/4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeroen Hofstee , Masahiro Yamada , Matthias Kaehlcke , Nathan Chancellor Subject: [PATCH 4.4 10/70] kbuild: fix asm-offset generation to work with clang Date: Mon, 26 Nov 2018 11:50:25 +0100 Message-Id: <20181126105047.892750545@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181126105046.722096341@linuxfoundation.org> References: <20181126105046.722096341@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jeroen Hofstee commit cf0c3e68aa81f992b0301f62e341b710d385bf68 upstream. KBuild abuses the asm statement to write to a file and clang chokes about these invalid asm statements. Hack it even more by fooling this is actual valid asm code. [masahiro: Import Jeroen's work for U-Boot: http://patchwork.ozlabs.org/patch/375026/ Tweak sed script a little to avoid garbage '#' for GCC case, like #define NR_PAGEFLAGS 23 /* __NR_PAGEFLAGS # */ ] Signed-off-by: Jeroen Hofstee Signed-off-by: Masahiro Yamada Reviewed-by: Matthias Kaehlcke Tested-by: Matthias Kaehlcke Signed-off-by: Nathan Chancellor Signed-off-by: Greg Kroah-Hartman --- include/linux/kbuild.h | 6 +++--- scripts/Makefile.lib | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) --- a/include/linux/kbuild.h +++ b/include/linux/kbuild.h @@ -2,14 +2,14 @@ #define __LINUX_KBUILD_H #define DEFINE(sym, val) \ - asm volatile("\n->" #sym " %0 " #val : : "i" (val)) + asm volatile("\n.ascii \"->" #sym " %0 " #val "\"" : : "i" (val)) -#define BLANK() asm volatile("\n->" : : ) +#define BLANK() asm volatile("\n.ascii \"->\"" : : ) #define OFFSET(sym, str, mem) \ DEFINE(sym, offsetof(struct str, mem)) #define COMMENT(x) \ - asm volatile("\n->#" x) + asm volatile("\n.ascii \"->#" x "\"") #endif --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -393,10 +393,14 @@ cmd_xzmisc = (cat $(filter-out FORCE,$^) # --------------------------------------------------------------------------- # Default sed regexp - multiline due to syntax constraints +# +# Use [:space:] because LLVM's integrated assembler inserts around +# the .ascii directive whereas GCC keeps the as-is. define sed-offsets - "/^->/{s:->#\(.*\):/* \1 */:; \ + 's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; \ + /^->/{s:->#\(.*\):/* \1 */:; \ s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \ - s:->::; p;}" + s:->::; p;}' endef # Use filechk to avoid rebuilds when a header changes, but the resulting file