linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <patch-notifications@ellerman.id.au>
To: Joel Stanley <joel@jms.id.au>, linuxppc-dev@lists.ozlabs.org
Cc: Nick Desaulniers <ndesaulniers@google.com>,
	Nicholas Piggin <npiggin@gmail.com>
Subject: Re: [v3] powerpc/Makefile: Fix PPC_BOOK3S_64 ASFLAGS
Date: Mon, 15 Oct 2018 15:01:08 +1100 (AEDT)	[thread overview]
Message-ID: <42YPr53Snlz9sjH@ozlabs.org> (raw)
In-Reply-To: <20181011024303.23921-1-joel@jms.id.au>

On Thu, 2018-10-11 at 02:43:03 UTC, Joel Stanley wrote:
> Ever since commit 15a3204d24a3 ("powerpc/64s: Set assembler machine type
> to POWER4") we force -mpower4 to be passed to the assembler irrespective
> of the CFLAGS used.
> 
> When building a powerpc64 kernel with clang, clang will not add -many to
> the assembler flags, so any instructions that the compiler has generated
> that are not available on power4 will cause an error:
> 
>  /usr/bin/as -a64 -mppc64 -mlittle-endian -mpower8 \
>   -I ./arch/powerpc/include -I ./arch/powerpc/include/generated \
>   -I ./include -I ./arch/powerpc/include/uapi \
>   -I ./arch/powerpc/include/generated/uapi -I ./include/uapi \
>   -I ./include/generated/uapi -I arch/powerpc -I arch/powerpc \
>   -maltivec -mpower4 -o init/do_mounts.o /tmp/do_mounts-3b0a3d.s
>  /tmp/do_mounts-51ce54.s:748: Error: unrecognized opcode: `isel'
> 
> GCC does include -many, so the GCC driven gas call will succeed:
> 
>   as -v -I ./arch/powerpc/include -I ./arch/powerpc/include/generated -I
>   ./include -I ./arch/powerpc/include/uapi
>   -I ./arch/powerpc/include/generated/uapi -I ./include/uapi
>   -I ./include/generated/uapi -I arch/powerpc -I arch/powerpc
>    -a64 -mpower8 -many -mlittle -maltivec -mpower4 -o init/do_mounts.o
> 
> Note that isel is power7 and above for IBM CPUs. GCC only generates it
> for Power9 and above, but the above test was run against the clang
> generated assembly.
> 
> Peter Bergner explains:
> 
>  > When using -many -mpower4, gas will first try and find a matching
>  > power4 mnemonic and failing that, it will then allow any valid mnemonic
>  > that gas knows about.  GCC's use of -many predates me though.
>  >
>  > IIRC, Alan looked at trying to remove it, but I forget why he didn't.
>  > Could be either a gcc or gas issue at the time.  I'm not sure whether
>  > issue still exists or not.  He and I have modified how gas works
>  > internally a fair amount since he tried removing gcc use of -many
>  >
>  > I will also note that when using -many, gas will choose the first
>  > mnemonic that matches in the mnemonic table and we have (mostly) sorted
>  > the table so that server mnemonics show up earlier in the table than
>  > other mnemonics, so they'll be seen/chosen first
> 
> By explicitly setting -many we can build with Clang and GCC while
> retaining the -mpower4 option.
> 
> Signed-off-by: Joel Stanley <joel@jms.id.au>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/960e30029863db95ec79a71009272d

cheers

      parent reply	other threads:[~2018-10-15  4:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-11  2:43 [PATCH v3] powerpc/Makefile: Fix PPC_BOOK3S_64 ASFLAGS Joel Stanley
2018-10-11 10:44 ` Michael Ellerman
2018-10-15  4:01 ` Michael Ellerman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42YPr53Snlz9sjH@ozlabs.org \
    --to=patch-notifications@ellerman.id.au \
    --cc=joel@jms.id.au \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=ndesaulniers@google.com \
    --cc=npiggin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).