public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pc at us dot ibm.com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/102485] New: -Wa,-many no longer has any effect
Date: Sat, 25 Sep 2021 21:27:32 +0000	[thread overview]
Message-ID: <bug-102485-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102485

            Bug ID: 102485
           Summary: -Wa,-many no longer has any effect
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pc at us dot ibm.com
  Target Milestone: ---

The assembler option "-many" tells the assembler to support assembly of
instructions from any vintage of processor. This can be passed through the GCC
compiler using the command line option "-Wa,-many".

The "-many" functionality has been under attack of late. ;-)

It once was that GCC would always pass "-many" to the assembler.  This was
stopped with commit e154242724b084380e3221df7c08fcdbd8460674 "Don't pass -many
to the assembler".

A recent change to binutils, commit b25f942e18d6ecd7ec3e2d2e9930eb4f996c258a
"ignore sticky options for .machine" stopped preserving "sticky"
options across a base `.machine` directive. This change caused sequences like:
.machine altivec
.machine power5
...to disable AltiVec instructions afterward, because "power5" did not support
AltiVec, and "power5" is a base ".machine" directive.

A perhaps unintended consequence is that using GCC to pass "-many" to the
assembler (via "-Wa,-many") has no effect because GCC adds a base ".machine"
directive to every(?) assembler file given to the assembler, but only passes
"-many" (no ".machine" directives are added). The assember sees the "-many"
parameter, then sees the base ".machine" directive, and suppresses any impact
of the "-many" parameter.

-- mfppr32.c:
long f () {
  long ppr;
  asm volatile ("mfppr32 %0" : "=r"(ppr));
  return ppr;
}
--
$ gcc -c ./mfppr32.c
gcc -c ./mfppr32.c
/tmp/ccAShoDb.s: Assembler messages:
/tmp/ccAShoDb.s:18: Error: unrecognized opcode: `mfppr32'
$ gcc -Wa,-many ./mfppr32.c
/tmp/cc0tRDPx.s: Assembler messages:
/tmp/cc0tRDPx.s:18: Error: unrecognized opcode: `mfppr32'
$ gcc -S -Wa,-many -O ./mfppr32.c
$ cat mfppr32.s
[edited for brevity]
        .file   "mfppr32.c"
        .machine ppc
        .section        ".text"
        .globl f
        .type   f, @function
f:
        mfppr32 3
        blr
$ as mfppr32.s
mfppr32.s: Assembler messages:
mfppr32.s:12: Error: unrecognized opcode: `mfppr32'

With older binutils, this worked:
$ older-as mfppr32.s
$
--

If binutils assembler (as) is doing the right thing now with respect to the
base ".machine" directives and sticky ".machine" directives, then it would
perhaps be GCCs responsibility to build an assembler file that allows for
passing the "-many" assembler command line option through GCC and have that
continue to work as likely expected.

             reply	other threads:[~2021-09-25 21:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-25 21:27 pc at us dot ibm.com [this message]
2021-10-04 17:26 ` [Bug target/102485] " bergner at gcc dot gnu.org
2021-10-04 18:17 ` pc at us dot ibm.com
2021-10-05 22:11 ` segher at gcc dot gnu.org
2021-10-05 22:58 ` bergner at gcc dot gnu.org
2021-10-05 23:41 ` segher at gcc dot gnu.org
2022-02-23 17:11 ` npiggin at gmail dot com
2022-02-23 17:38 ` segher at gcc dot gnu.org
2022-02-24  1:11 ` npiggin at gmail dot com
2022-02-24  1:25 ` npiggin at gmail dot com
2022-02-24 11:07 ` amodra at gmail dot com

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=bug-102485-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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).