Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1623446

Re: [RFC PATCH] kbuild: Fix asm-offset generation to work with clang

From Matthias Kaehlcke <mka@chromium.org>
Newsgroups linux.kernel
Subject Re: [RFC PATCH] kbuild: Fix asm-offset generation to work with clang
Date 2017-04-14 02:40 +0200
Message-ID <tvXrj-2iA-1@gated-at.bofh.it> (permalink)
References <tshHY-3Tw-13@gated-at.bofh.it> <tv2Mq-6M3-9@gated-at.bofh.it> <tv8oN-22T-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 <mka@chromium.org>:
> > > 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 <behanw@converseincode.com>
> > > Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> > 
> > 
> > 
> > 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

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [RFC PATCH] kbuild: Fix asm-offset generation to work with clang Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-04-11 14:10 +0200
  Re: [RFC PATCH] kbuild: Fix asm-offset generation to work with clang Matthias Kaehlcke <mka@chromium.org> - 2017-04-11 20:10 +0200
    Re: [RFC PATCH] kbuild: Fix asm-offset generation to work with clang Matthias Kaehlcke <mka@chromium.org> - 2017-04-14 02:40 +0200
      Re: [RFC PATCH] kbuild: Fix asm-offset generation to work with clang Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-04-14 08:00 +0200

csiph-web