tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Regression of GCC >= 4.8.5 for 32-bit powerpc



Hi,

I'm so sorry that the problem has already been resolved, and pulled-up
into gcc-5-branch:

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

Blame me! My lazy eye-ball grep overlooked it. Their fix is similar,
but slightly different from Matt's proposal:

  https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=238789

====
--- src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c.orig	2016-12-16 04:34:21.738518823 +0900
+++ src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c	2016-12-16 12:36:00.909027059 +0900
@@ -5185,8 +5185,8 @@
     }
#ifdef USING_ELFOS_H
-  if (rs6000_default_cpu == 0 || rs6000_default_cpu[0] == '\0'
-      || !global_options_set.x_rs6000_cpu_index)
+  if (!(rs6000_default_cpu && rs6000_default_cpu[0])
+      && !global_options_set.x_rs6000_cpu_index)
     {
       fputs ("\t.machine ", asm_out_file);
       if ((rs6000_isa_flags & OPTION_MASK_DIRECT_MOVE) != 0)
====

With this patch, ".machine ppc" pseudo-op appears only when -mcpu option
is not specified. I'd like to commit this. Is it OK with you?

However, I've got a new question; we can no longer specify -Wa,-mXXX
option for C source codes. I've found, by real-grep this time, only one
case in our source tree:

src/sys/arch/evbppc/conf/Makefile.mpc85xx.inc:
     1  #       $NetBSD: Makefile.mpc85xx.inc,v 1.5 2014/08/10 17:44:26 joerg Exp $
     2
     3  CFLAGS+=                ${${ACTIVE_CC} == "gcc":? -misel -Wa,-me500 :}
     4  CFLAGS+=                ${${ACTIVE_CC} == "gcc":? -fno-inline-functions-called-once :}
     5  AFLAGS+=                ${${ACTIVE_CC} == "gcc":? -Wa,-me500 :}
     6  # gcc emits bad code with these options
     7  #AFLAGS+=               -mcpu=8548
     8  #CFLAGS+=               -mcpu=8548
     9  TEXTADDR?=              20000
    10
    11  SYSTEM_FIRST_OBJ=       mpc85xx_start.o
    12  SYSTEM_FIRST_SFILE=     ${THISPPC}/mpc85xx/mpc85xx_start.S

-Wa,-me500 in CFLAGS does not work anymore, and GCC does not support
-mcpu=e500 option. At this moment, kernel seems to work fine on my
RB800, but we should better fix this IMO. I propose two solutions here,
both have pros and cons.

(1) Add -mcpu=powerpc to CFLAGS. This option stops GCC to emit
".machine ppc" pseudo-op. Instead, -mppc option is passed to assembler.
But it is preceding to -me500 option, and therefore harmless. This is
tricky, but known to work at least for GCC 5.4.

(2) Replace -Wa,-me500 with -mcpu=8548 (which is equivalent to
-mcpu=8540 when combined with -msoft-float). This also stops GCC to
generate .machine pseudo-op, and gives -me500 option to assembler. As a
side effect, GCC optimizes codes for 854x CPUs. As the comment in
Makefile.mpc85xx.inc says, it formerly results in bad codes. But as far
as I checked on my RB800, kernel seems to work stably.

Which one should we take? Or leave it as is? In any cases, we must add
some comment at least.

Thanks,
Rin


Home | Main Index | Thread Index | Old Index