public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/102485] New: -Wa,-many no longer has any effect
@ 2021-09-25 21:27 pc at us dot ibm.com
  2021-10-04 17:26 ` [Bug target/102485] " bergner at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: pc at us dot ibm.com @ 2021-09-25 21:27 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-02-24 11:07 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-25 21:27 [Bug target/102485] New: -Wa,-many no longer has any effect pc at us dot ibm.com
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

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).