public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: Peter Bergner <bergner@linux.ibm.com>
Cc: Waldemar Brodkorb <wbx@openadk.org>, binutils@sourceware.org
Subject: Re: regression with binutils 2.28 for ppc
Date: Fri, 18 Feb 2022 12:04:20 +1030	[thread overview]
Message-ID: <Yg73nJR9450cdsFA@squeak.grove.modra.org> (raw)
In-Reply-To: <8b8a3144-5c59-786f-a2ba-6f8813d60845@linux.ibm.com>

On Thu, Feb 17, 2022 at 02:03:24PM -0600, Peter Bergner wrote:
> On 2/17/22 3:28 AM, Waldemar Brodkorb wrote:
> > -mcpu=powerpc -mbig-endian -m32 -msoft-float -mcpu=powerpc64 -mno-altivec -mno-vsx
> 
> So a 32-bit compile, which is why the assembler complains about ptesync.

Not from what you posted there.  The last -mcpu=powerpc64 ought to
enable ppc64.  If you remove that, then yes, you'll get a complaint
about ptesync.

> You could try adding -Wa,-mppc64 or -Wa,-many to your options as a work around.
> Newish GCCs removed passing -many to the assembler and the commit you
> mentioned changed handling of sticky cpu options which is exposing the
> issue.  

-Wa cpu hacks won't work any more.  gcc emits a .machine directive
early in the assembly output that will override them.  I think that
early .machine is just plain wrong.  .machine ought to only be emitted
by gcc to handle something like a pragma or attribute changing code
generation.  That's the only compromise I can see to satisfy the
disparate users of the toolchain.  On the one hand you have developers
who'd like an error when they accidentally use the wrong assembly (and
gcc developers who'd rather not find out gcc is emitting invalid
instructions by user reports of crashes!), and on the other hand you
have kernel delelopers who need to write code supporting a whole range
of cpus who just want the assembler to accept anything.

> The use of those ptesyncs in the kernel really needs to be audited though!
> If they are legitimate, then the inline assembler needs to wrap their
> use with ".machine push ; .machine ppc64 ; ptesync ; .machine pop".

Right.  Or we should allow the user command line to control the
assembler, even with -Wa,-many if they so desire.  But that's killed
by that stupid .machine from gcc.

I didn't even get as far as Waldemar.  With recent gcc, binutils and
linux git source my
ARCH=powerpc CROSS_COMPILE=powerpc-linux- pmac32_defconfig
kernel compile bombs here:

powerpc-linux-gcc -Wp,-MMD,arch/powerpc/kernel/ptrace/.ptrace.o.d -nostdinc -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 -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -I ./arch/powerpc -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -mcpu=powerpc -mcpu=powerpc -mbig-endian -m32 -msoft-float -pipe -ffixed-r2 -mmultiple -mno-readonly-in-sdata -mcpu=powerpc64 -mno-altivec -mno-vsx -fno-asynchronous-unwind-tables -mno-string -Wa,-maltivec -mbig-endian -mstack-protector-guard=tls -mstack-protector-guard-reg=r2 -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=1024 -fstack-protector-strong -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -fomit-frame-pointer -ftrivial-auto-var-init=zero -fno-stack-clash-protection -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wcast-function-type -Wno-stringop-truncation -Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -Wno-alloc-size-larger-than -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -mstack-protector-guard-offset=576 -Werror    -DKBUILD_MODFILE='"arch/powerpc/kernel/ptrace/ptrace"' -DKBUILD_BASENAME='"ptrace"' -DKBUILD_MODNAME='"ptrace"' -D__KBUILD_MODNAME=kmod_ptrace -c -o arch/powerpc/kernel/ptrace/ptrace.o arch/powerpc/kernel/ptrace/ptrace.c 
{standard input}: Assembler messages:
{standard input}:997: Error: unrecognized opcode: `mfsrin'
{standard input}:1003: Error: unrecognized opcode: `mtsrin'
{standard input}:1028: Error: unrecognized opcode: `mfsrin'
{standard input}:1034: Error: unrecognized opcode: `mtsrin'
{standard input}:1061: Error: unrecognized opcode: `mfsrin'
{standard input}:1067: Error: unrecognized opcode: `mtsrin'
make[3]: *** [scripts/Makefile.build:288: arch/powerpc/kernel/ptrace/ptrace.o] Error 1

So, last -mcpu is powerpc64.  gas quite correctly flags an error on
instructions phased out for ppc64.

-- 
Alan Modra
Australia Development Lab, IBM

  reply	other threads:[~2022-02-18  1:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-16 13:35 Waldemar Brodkorb
2022-02-16 14:32 ` Peter Bergner
2022-02-16 18:24   ` Peter Bergner
2022-02-17  9:28     ` Waldemar Brodkorb
2022-02-17 20:03       ` Peter Bergner
2022-02-18  1:34         ` Alan Modra [this message]
2022-02-18  4:21           ` Peter Bergner
2022-02-20 11:58             ` Alan Modra
2022-02-23  8:51               ` Alan Modra
2022-02-23 17:34                 ` Waldemar Brodkorb

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=Yg73nJR9450cdsFA@squeak.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=bergner@linux.ibm.com \
    --cc=binutils@sourceware.org \
    --cc=wbx@openadk.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).