From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754185AbdDNAht (ORCPT ); Thu, 13 Apr 2017 20:37:49 -0400 Received: from mail-pg0-f54.google.com ([74.125.83.54]:34873 "EHLO mail-pg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753288AbdDNAhr (ORCPT ); Thu, 13 Apr 2017 20:37:47 -0400 Date: Thu, 13 Apr 2017 17:37:45 -0700 From: Matthias Kaehlcke To: Masahiro Yamada Cc: Michal Marek , Linux Kernel Mailing List , Linux Kbuild mailing list , Grant Grundler , Michael Davidson , Greg Hackmann , Behan Webster , Peter Foley Subject: Re: [RFC PATCH] kbuild: Fix asm-offset generation to work with clang Message-ID: <20170414003745.GI28657@google.com> References: <20170403212537.124217-1-mka@chromium.org> <20170411180354.GD28657@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20170411180354.GD28657@google.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org El Tue, Apr 11, 2017 at 11:03:54AM -0700 Matthias Kaehlcke ha dit: > El Tue, Apr 11, 2017 at 09:01:41PM +0900 Masahiro Yamada ha dit: > > > 2017-04-04 6:25 GMT+09:00 Matthias Kaehlcke : > > > 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. > > > > > > Based-on-patch-from: Behan Webster > > > Signed-off-by: Matthias Kaehlcke > > > > > > > > Could you check Jeroen Hofstee's work for U-Boot? > > > > http://patchwork.ozlabs.org/patch/375026/ > > No I didn't come across it, thanks for the pointer! > > > His idea is to use .ascii string > > in order to handle this in arch-agnostic way. > > Looks good, way cleaner than my proposed solution :) > > > If you are happy about this idea, > > I can forward his patch (with a little bit adjustment). > > With forward you mean you plan to port it? Otherwise I'm also happy to > give it a go, just let me know. > > > We may want to refactor the patch because > > the double mark ".ascii" and "->" seem redundant, > > but it is just a detail. > > Agree, since we are already touching this part we might as well remove > the "->". Thinking about it a bit more it seems safer to keep the "->" since the input file might contain actual ".ascii" directives. Cheers Matthias