From patchwork Tue Sep 23 19:25:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Behan Webster X-Patchwork-Id: 37751 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 625D220970 for ; Tue, 23 Sep 2014 19:26:42 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id l4sf4718011lbv.4 for ; Tue, 23 Sep 2014 12:26:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :mime-version:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe:content-type :content-transfer-encoding; bh=jdc6SdyLDHq8pE36eRbH4OSFkxKDrM/VnpnQ+yk9tK8=; b=CtyFJ495fyBy8syKUN8wSLNuPrE+DpG2d9qEQYf+PD35WmLib1JFmylm2NQkufToqx WqAM2t28DwzjkA8G2bkhYyyZloNs+Hzn1Xnx/H0rJcxl8yANy9QLlsMcoHzOgZy5gcvv rFThqQZej1r4KrGpOZfI0SSEveixkj3ZQSjSblvO7cj6+noTmidPlSC2Drdxl6u76o8F d8ZW5hfJPIgjJwz/Oo0p2fjhl/g5GKKVTPL1upgQxn64N84Xc3zpYtqCRuz6TEftUYs7 LVyxqQCawfyCy6HmTWv5zZAPC+L9J7qpon0yK9c6IDP5Vzm01yrCMDoTxT1+tW9QQ2G/ lZcA== X-Gm-Message-State: ALoCoQl8Bt/zYv9TTr4zDcq02jXO3CDDVezesA5qIMeuB/jYfW7Tk+WAUQOACFzw1O+g7trSODLG X-Received: by 10.152.19.131 with SMTP id f3mr257389lae.0.1411500400689; Tue, 23 Sep 2014 12:26:40 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.19.5 with SMTP id a5ls87514lae.19.gmail; Tue, 23 Sep 2014 12:26:40 -0700 (PDT) X-Received: by 10.152.9.200 with SMTP id c8mr1738060lab.76.1411500400513; Tue, 23 Sep 2014 12:26:40 -0700 (PDT) Received: from mail-la0-x22d.google.com (mail-la0-x22d.google.com [2a00:1450:4010:c03::22d]) by mx.google.com with ESMTPS id sd8si10460086lbb.36.2014.09.23.12.26.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 23 Sep 2014 12:26:40 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22d as permitted sender) client-ip=2a00:1450:4010:c03::22d; Received: by mail-la0-f45.google.com with SMTP id el20so2938855lab.32 for ; Tue, 23 Sep 2014 12:26:40 -0700 (PDT) X-Received: by 10.112.76.6 with SMTP id g6mr1708751lbw.22.1411500400258; Tue, 23 Sep 2014 12:26:40 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp471931lbb; Tue, 23 Sep 2014 12:26:39 -0700 (PDT) X-Received: by 10.68.131.38 with SMTP id oj6mr2298657pbb.168.1411500398659; Tue, 23 Sep 2014 12:26:38 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id jv8si8338067pbc.104.2014.09.23.12.26.37 for ; Tue, 23 Sep 2014 12:26:38 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756374AbaIWT0f (ORCPT + 27 others); Tue, 23 Sep 2014 15:26:35 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:65264 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756277AbaIWT0d (ORCPT ); Tue, 23 Sep 2014 15:26:33 -0400 Received: by mail-pa0-f46.google.com with SMTP id kx10so7068244pab.5 for ; Tue, 23 Sep 2014 12:26:33 -0700 (PDT) X-Received: by 10.70.103.145 with SMTP id fw17mr1458417pdb.169.1411500393304; Tue, 23 Sep 2014 12:26:33 -0700 (PDT) Received: from galdor.websterwood.com (S0106dc9fdb80cffd.gv.shawcable.net. [96.50.97.138]) by mx.google.com with ESMTPSA id gn6sm4953153pbc.40.2014.09.23.12.26.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Sep 2014 12:26:32 -0700 (PDT) From: behanw@converseincode.com To: mq@suse.cz Cc: linux-kernel@vger.kernel.org, Behan Webster , Greg Kroah-Hartman , Ard Biesheuvel , "H. Peter Anvin" , Tom Gundersen , Masahiro Yamada , Arnd Bergmann Subject: [PATCH] kbuild, LLVMLinux: Fix asm-offset generation to work with clang Date: Tue, 23 Sep 2014 12:25:31 -0700 Message-Id: <1411500331-9861-1-git-send-email-behanw@converseincode.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Original-Sender: behanw@converseincode.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22d as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@ Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Behan Webster When using clang with -no-integerated-as clang will use the gnu assembler instead of the integrated assembler. However clang will still perform asm error checking before sending the inline assembly language to gas. The generation of asm-offsets from within C code is dependent on gcc's blind passing of whatever is in asm() through to gas. Arbirary text is passed through which is then modified by a sed script into the appropriate .h and .S code. Since the arbitrary text is not valid assembly language, clang fails. This can be fixed by making the arbitrary text into an ASM comment and then updating the sed scripts accordingly to work as expected. This solution works for both gcc and clang. Signed-off-by: Behan Webster Reviewed-by: Mark Charlebois Reviewed-by: Jan-Simon Möller Cc: Jan Moskyto Matejka Cc: Greg Kroah-Hartman Cc: Ard Biesheuvel Cc: "H. Peter Anvin" Cc: Tom Gundersen Cc: Masahiro Yamada Cc: Arnd Bergmann --- Kbuild | 8 ++++---- include/linux/kbuild.h | 6 +++--- scripts/mod/Makefile | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Kbuild b/Kbuild index b8b708a..2f509c9 100644 --- a/Kbuild +++ b/Kbuild @@ -52,10 +52,10 @@ targets += arch/$(SRCARCH)/kernel/asm-offsets.s # Default sed regexp - multiline due to syntax constraints define sed-y - "/^->/{s:->#\(.*\):/* \1 */:; \ - s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \ - s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \ - s:->::; p;}" + "/^@->/{s:->#\(.*\):/* \1 */:; \ + s:^@->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \ + s:^@->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \ + s:@->::; p;}" endef quiet_cmd_offsets = GEN $@ diff --git a/include/linux/kbuild.h b/include/linux/kbuild.h index 22a7219..75fa2c3 100644 --- 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@->" #sym " %0 " #val : : "i" (val)) -#define BLANK() asm volatile("\n->" : : ) +#define BLANK() asm volatile("\n@->" : : ) #define OFFSET(sym, str, mem) \ DEFINE(sym, offsetof(struct str, mem)) #define COMMENT(x) \ - asm volatile("\n->#" x) + asm volatile("\n@->#" x) #endif diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile index c11212f..86f6b85 100644 --- a/scripts/mod/Makefile +++ b/scripts/mod/Makefile @@ -6,10 +6,10 @@ modpost-objs := modpost.o file2alias.o sumversion.o devicetable-offsets-file := devicetable-offsets.h define sed-y - "/^->/{s:->#\(.*\):/* \1 */:; \ - s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \ - s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \ - s:->::; p;}" + "/^@->/{s:@->#\(.*\):/* \1 */:; \ + s:^@->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \ + s:^@->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \ + s:@->::; p;}" endef quiet_cmd_offsets = GEN $@