[Bug target/104829] [12 Regression] Pure 32-bit PowerPC build broken
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104829 --- Comment #19 from CVS Commits --- The releases/gcc-11 branch has been updated by Sebastian Huber : https://gcc.gnu.org/g:d87e0e297b1cba73a0c055d2a3e9267d288f435a commit r11-10084-gd87e0e297b1cba73a0c055d2a3e9267d288f435a Author: Segher Boessenkool Date: Fri Mar 11 21:15:18 2022 + rs6000: Do not use rs6000_cpu for .machine ppc and ppc64 (PR104829) Fixes: 77eccbf39ed5 rs6000.h has #define PROCESSOR_POWERPC PROCESSOR_PPC604 #define PROCESSOR_POWERPC64 PROCESSOR_RS64A which means that if you use things like -mcpu=powerpc -mvsx it will no longer work after my latest .machine patch. This causes GCC build errors in some cases, not a good idea (even if the errors are actually pre-existing: using -mvsx with a machine that does not have VSX cannot work properly). 2022-03-11 Segher Boessenkool PR target/104829 * config/rs6000/rs6000.c (rs6000_machine_from_flags): Don't output "ppc" and "ppc64" based on rs6000_cpu. (cherry picked from commit 80fcc4b6afee72443bef551064826b3b4b6785e6)
[Bug target/104829] [12 Regression] Pure 32-bit PowerPC build broken
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104829 --- Comment #18 from CVS Commits --- The releases/gcc-10 branch has been updated by Sebastian Huber : https://gcc.gnu.org/g:58465d673bb21fc234f642166ec0cf9e621787c3 commit r10-10859-g58465d673bb21fc234f642166ec0cf9e621787c3 Author: Segher Boessenkool Date: Fri Mar 11 21:15:18 2022 + rs6000: Do not use rs6000_cpu for .machine ppc and ppc64 (PR104829) Fixes: 77eccbf39ed5 rs6000.h has #define PROCESSOR_POWERPC PROCESSOR_PPC604 #define PROCESSOR_POWERPC64 PROCESSOR_RS64A which means that if you use things like -mcpu=powerpc -mvsx it will no longer work after my latest .machine patch. This causes GCC build errors in some cases, not a good idea (even if the errors are actually pre-existing: using -mvsx with a machine that does not have VSX cannot work properly). 2022-03-11 Segher Boessenkool PR target/104829 * config/rs6000/rs6000.c (rs6000_machine_from_flags): Don't output "ppc" and "ppc64" based on rs6000_cpu. (cherry picked from commit 80fcc4b6afee72443bef551064826b3b4b6785e6)
[Bug target/104829] [12 Regression] Pure 32-bit PowerPC build broken
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104829 Segher Boessenkool changed: What|Removed |Added Resolution|--- |FIXED Status|ASSIGNED|RESOLVED --- Comment #17 from Segher Boessenkool --- Fixed.
[Bug target/104829] [12 Regression] Pure 32-bit PowerPC build broken
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104829 --- Comment #16 from CVS Commits --- The master branch has been updated by Segher Boessenkool : https://gcc.gnu.org/g:80fcc4b6afee72443bef551064826b3b4b6785e6 commit r12-7628-g80fcc4b6afee72443bef551064826b3b4b6785e6 Author: Segher Boessenkool Date: Fri Mar 11 21:15:18 2022 + rs6000: Do not use rs6000_cpu for .machine ppc and ppc64 (PR104829) Fixes: 77eccbf39ed5 rs6000.h has #define PROCESSOR_POWERPC PROCESSOR_PPC604 #define PROCESSOR_POWERPC64 PROCESSOR_RS64A which means that if you use things like -mcpu=powerpc -mvsx it will no longer work after my latest .machine patch. This causes GCC build errors in some cases, not a good idea (even if the errors are actually pre-existing: using -mvsx with a machine that does not have VSX cannot work properly). 2022-03-11 Segher Boessenkool PR target/104829 * config/rs6000/rs6000.cc (rs6000_machine_from_flags): Don't output "ppc" and "ppc64" based on rs6000_cpu.
[Bug target/104829] [12 Regression] Pure 32-bit PowerPC build broken
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104829 --- Comment #15 from joseph at codesourcery dot com --- I confirm that the second patch does fix the problem I see.
[Bug target/104829] [12 Regression] Pure 32-bit PowerPC build broken
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104829 Segher Boessenkool changed: What|Removed |Added Attachment #52599|0 |1 is obsolete|| --- Comment #14 from Segher Boessenkool --- Created attachment 52605 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52605&action=edit proposed patch v2 I added this some time ago, but it disappeared again? This restores more of the previous not-so-good behaviour. "Old bugs are better than new".
[Bug target/104829] [12 Regression] Pure 32-bit PowerPC build broken
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104829 --- Comment #13 from Peter Bergner --- (In reply to jos...@codesourcery.com from comment #12) > I still get the same error (and the same ".machine ppc") with that patch > applied. Confirmed, the patch doesn't fix the issue for me either: [bergner@makalu-lp1 PR104829]$ cat bug.i _Decimal32 foo (_Decimal32 *f) { return *f; } [bergner@makalu-lp1 PR104829]$ /home/bergner/gcc/build/gcc-fsf-mainline-32bit/gcc/xgcc -B/home/bergner/gcc/build/gcc-fsf-mainline-32bit/gcc -O2 -mcpu=powerpc -mvsx -c bug.i /tmp/cc1CLPZR.s: Assembler messages: /tmp/cc1CLPZR.s:10: Error: unrecognized opcode: `lfiwzx'
[Bug target/104829] [12 Regression] Pure 32-bit PowerPC build broken
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104829 --- Comment #12 from joseph at codesourcery dot com --- I still get the same error (and the same ".machine ppc") with that patch applied.
[Bug target/104829] [12 Regression] Pure 32-bit PowerPC build broken
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104829 --- Comment #11 from Segher Boessenkool --- Created attachment 52599 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52599&action=edit proposed patch This patch should restore the previous behaviour. Joseph, can you test it please?
[Bug target/104829] [12 Regression] Pure 32-bit PowerPC build broken
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104829 --- Comment #10 from Segher Boessenkool --- (In reply to jos...@codesourcery.com from comment #6) > The generated .s file has ".machine ppc". Maybe there is some > inconsistency arising from the use of -mvsx -mfloat128 for this 32-bit > configuration with no --with option to change the default CPU? Should > these KFmode functions really be being built for 32-bit libgcc at all? Using -mvsx with a CPU that does not support VSX insns is problematic. All this code should use -mcpu=power7. But, I'll make a patch for rs6000_machine_from_flags to make this work the way it did before, I now know what the problem is. Thanks!
[Bug target/104829] [12 Regression] Pure 32-bit PowerPC build broken
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104829 --- Comment #9 from Joseph S. Myers --- Created attachment 52598 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52598&action=edit generated assembly Assembly output attached.
[Bug target/104829] [12 Regression] Pure 32-bit PowerPC build broken
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104829 --- Comment #8 from Joseph S. Myers --- Created attachment 52597 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52597&action=edit preprocessed source Preprocessed source attached.
[Bug target/104829] [12 Regression] Pure 32-bit PowerPC build broken
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104829 --- Comment #7 from Peter Bergner --- (In reply to jos...@codesourcery.com from comment #6) > The compilation command is: Can you attach the _kf_to_sd.i preprocessed file from your command so I can more easily try your exact compile options without having all of your -B and -I options pointing at your glibc build?
[Bug target/104829] [12 Regression] Pure 32-bit PowerPC build broken
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104829 --- Comment #6 from joseph at codesourcery dot com --- The compilation command is: /scratch/jmyers/glibc/many12/build/compilers/powerpc-linux-gnu/gcc/./gcc/xgcc -B/scratch/jmyers/glibc/many12/build/compilers/powerpc-linux-gnu/gcc/./gcc/ -B/scratch/jmyers/glibc/many12/install/compilers/powerpc-linux-gnu/powerpc-glibc-linux-gnu/bin/ -B/scratch/jmyers/glibc/many12/install/compilers/powerpc-linux-gnu/powerpc-glibc-linux-gnu/lib/ -isystem /scratch/jmyers/glibc/many12/install/compilers/powerpc-linux-gnu/powerpc-glibc-linux-gnu/include -isystem /scratch/jmyers/glibc/many12/install/compilers/powerpc-linux-gnu/powerpc-glibc-linux-gnu/sys-include -g -O2 -O2 -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -mlong-double-128 -mno-minimal-toc -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -fPIC -mlong-double-128 -mno-minimal-toc -I. -I. -I../.././gcc -I/scratch/jmyers/glibc/many12/src/gcc/libgcc -I/scratch/jmyers/glibc/many12/src/gcc/libgcc/. -I/scratch/jmyers/glibc/many12/src/gcc/libgcc/../gcc -I/scratch/jmyers/glibc/many12/src/gcc/libgcc/../include -I/scratch/jmyers/glibc/many12/src/gcc/libgcc/../libdecnumber/dpd -I/scratch/jmyers/glibc/many12/src/gcc/libgcc/../libdecnumber -DHAVE_CC_TLS -Wno-type-limits -mvsx -mfloat128 -mno-float128-hardware -mno-gnu-attribute -I/scratch/jmyers/glibc/many12/src/gcc/libgcc/soft-fp -I/scratch/jmyers/glibc/many12/src/gcc/libgcc/config/rs6000 -mno-gnu-attribute -Wno-psabi -mabi=ieeelongdouble -o _kf_to_sd.o -MT _kf_to_sd.o -MD -MP -MF _kf_to_sd.dep -c /scratch/jmyers/glibc/many12/src/gcc/libgcc/config/rs6000/_kf_to_sd.c -fvisibility=hidden -DHIDE_EXPORTS The generated .s file has ".machine ppc". Maybe there is some inconsistency arising from the use of -mvsx -mfloat128 for this 32-bit configuration with no --with option to change the default CPU? Should these KFmode functions really be being built for 32-bit libgcc at all?
[Bug target/104829] [12 Regression] Pure 32-bit PowerPC build broken
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104829 --- Comment #5 from Segher Boessenkool --- No difference with binutils-2.38 .
[Bug target/104829] [12 Regression] Pure 32-bit PowerPC build broken
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104829 Sebastian Huber changed: What|Removed |Added CC||sebastian.huber@embedded-br ||ains.de --- Comment #4 from Sebastian Huber --- Maybe you can reproduce it with Binutils 2.38. There was a recent change in Binutils which could prevent the error: commit cebc89b9328eab994f6b0314c263f94e7949a553 Author: Alan Modra Date: Mon Feb 21 10:58:57 2022 +1030 binutils 2.38 vs. ppc32 linux kernel Commit b25f942e18d6 made .machine more strict. Weaken it again. * config/tc-ppc.c (ppc_machine): Treat an early .machine specially, keeping sticky options to work around gcc bugs. diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index 054f9c72161..89bc7d3f9b9 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -5965,7 +5965,30 @@ ppc_machine (int ignore ATTRIBUTE_UNUSED) options do not count as a new machine, instead they add to currently selected opcodes. */ ppc_cpu_t machine_sticky = 0; - new_cpu = ppc_parse_cpu (ppc_cpu, &machine_sticky, cpu_string); + /* Unfortunately, some versions of gcc emit a .machine +directive very near the start of the compiler's assembly +output file. This is bad because it overrides user -Wa +cpu selection. Worse, there are versions of gcc that +emit the *wrong* cpu, not even respecting the -mcpu given +to gcc. See gcc pr101393. And to compound the problem, +as of 20220222 gcc doesn't pass the correct cpu option to +gas on the command line. See gcc pr59828. Hack around +this by keeping sticky options for an early .machine. */ + asection *sec; + for (sec = stdoutput->sections; sec != NULL; sec = sec->next) + { + segment_info_type *info = seg_info (sec); + /* Are the frags for this section perturbed from their +initial state? Even .align will count here. */ + if (info != NULL + && (info->frchainP->frch_root != info->frchainP->frch_last + || info->frchainP->frch_root->fr_type != rs_fill + || info->frchainP->frch_root->fr_fix != 0)) + break; + } + new_cpu = ppc_parse_cpu (ppc_cpu, + sec == NULL ? &sticky : &machine_sticky, + cpu_string); if (new_cpu != 0) ppc_cpu = new_cpu; else
[Bug target/104829] [12 Regression] Pure 32-bit PowerPC build broken
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104829 --- Comment #3 from Segher Boessenkool --- I cannot reproduce it either. The machine instruction that gives the error is lfiwzx, a power7 insn; GCC will not generate this instruction unless you are compiling for power7 or later. That is not the default of course. Building with --with-cpu=power7 does not reproduce it either. Help?
[Bug target/104829] [12 Regression] Pure 32-bit PowerPC build broken
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104829 Peter Bergner changed: What|Removed |Added CC||bergner at gcc dot gnu.org --- Comment #2 from Peter Bergner --- I did a 32-bit build using top of tree sources for gcc and binutils and cannot recreate the reported error.
[Bug target/104829] [12 Regression] Pure 32-bit PowerPC build broken
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104829 Andrew Pinski changed: What|Removed |Added Last reconfirmed||2022-03-07 Ever confirmed|0 |1 Status|UNCONFIRMED |ASSIGNED --- Comment #1 from Andrew Pinski --- .
[Bug target/104829] [12 Regression] Pure 32-bit PowerPC build broken
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104829 Andrew Pinski changed: What|Removed |Added Summary|Pure 32-bit PowerPC build |[12 Regression] Pure 32-bit |broken |PowerPC build broken Target Milestone|--- |12.0