public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "amodra at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/102485] -Wa,-many no longer has any effect Date: Thu, 24 Feb 2022 11:07:57 +0000 [thread overview] Message-ID: <bug-102485-4-0LWD3GztHE@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-102485-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102485 --- Comment #10 from Alan Modra <amodra at gmail dot com> --- I have spent some time over the last few days digging into history relevant to this bug as part of looking into a binutils report that an ARCH=powerpc CROSS_COMPILE=powerpc-linux- pmac32_defconfig linux kernel no longer builds with binutils-2.38. As a result I've partly reverted the effect of binutils commit "ignore sticky options for .machine", on both mainline binutils and the 2.38 branch. Given the way gcc operates, that commit was a mistake on my part. The initial .machine passed by gcc will again keep -many, -maltivec, -mvsx, -mvle, -mspe or -mspe2 in effect. A .machine later in an assembly file, after some output to any section (even .align counts), will be more strictly enforced. That's the best I can do to solve this mess. It does not completely fix this bug, which I believe is a valid complaint. For instance a user who has power10 asm() but does not want gcc generated power10 code, perhaps due to a gcc code gen bug, might like to use -mcpu=power9 -Wa,-mpower10 on the gcc command line. Instead they would be forced to write ".machine power10" in their asm. (Ideally, .machine push; .machine power10; user asm; .machine pop, on each use of power10 instructions.) At least, that is the case for current mainline gcc and binutils-2.38 where even "-mcpu=power9 -Wa,-many" won't work. We simply cannot dictate to users that their assembly needs rewriting. A lot of this came about by accident. On the gas side, it was by accident that any of the gas command line cpu options were sticky for .machine. The intent behind the sticky options was to support people writing gas command lines like "-maltivec -mppc" as well as the canonical "-mppc -maltivec". When you consider that gas also needs to support multiple cpu options on a command line, with the last overriding any previous selection, it is more obvious why options that add functional units like -maltivec are special. On the gcc side, we have pr59828 and commit b9f12a01bedb5 which is where gcc started to emit .machine rather than passing correct arguments to gas. Current mainline gcc continues to pass the wrong cpu to gas on the command line when multiple -mcpu options are given to gcc, as can be seen by examining -v output from the kernel compile mentioned above. There have been multiple gcc bug reports about that .machine directive, pr71216, pr91050, pr101393 to point out some. This means there are versions of gcc in widespread use that pass an incorrect .machine to gas, which is why I say my gas change to make .machine more strict was a mistake. We can't expect the kernel and other users of the toolchain to cope with gas using wrong cpu info if -many is disabled by .machine. Of course, the bugs in .machine might have been found earlier if -many hadn't been covering them. Similarly for bugs in the linux kernel makefiles; mfsrin and mtsrin are not ppc64 instructions. Overall, I think using .machine as a workaround for pr59828 was a mistake, especially since digging into this bug reminded me that I'd submitted a conceptually simple patch to fix pr59828 by passing on all the cpu args to gas. Which went unreviewed for a whole year before being dismissed.
prev parent reply other threads:[~2022-02-24 11:07 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-09-25 21:27 [Bug target/102485] New: " 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 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=bug-102485-4-0LWD3GztHE@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: linkBe 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).