[Bug go/83308] New: Missing platform definitions for SH in libgo

glaubitz at physik dot fu-berlin.de gcc-bugzilla@gcc.gnu.org
Thu Dec 7 00:38:00 GMT 2017


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

            Bug ID: 83308
           Summary: Missing platform definitions for SH in libgo
           Product: gcc
           Version: 7.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: go
          Assignee: ian at airs dot com
          Reporter: glaubitz at physik dot fu-berlin.de
                CC: bugdal at aerifal dot cx, cmang at google dot com, ian at airs dot com,
                    jrtc27 at jrtc27 dot com, olegendo at gcc dot gnu.org
  Target Milestone: ---
            Target: sh*-*-*

Trying to build gcc-7 with the Go frontend enabled fails with:

libtool: compile:  /<<PKGBUILDDIR>>/build/./gcc/xgcc
-B/<<PKGBUILDDIR>>/build/./gcc/ -B/usr/sh4-linux-gnu/bin/
-B/usr/sh4-linux-gnu/lib/ -isystem /usr/sh4-linux-gnu/include
 -isystem /usr/sh4-linux-gnu/sys-include -isystem
/<<PKGBUILDDIR>>/build/sys-include -DHAVE_CONFIG_H -I.
-I../../../src/libgfortran -iquote../../../src/libgfortran/io -I../
../../src/libgfortran/../gcc -I../../../src/libgfortran/../gcc/config
-I../.././gcc -I../../../src/libgfortran/../libgcc -I../libgcc
-I../../../src/libgfortran/../libbacktr
ace -I../libbacktrace -I../libbacktrace -std=gnu11 -Wall -Wstrict-prototypes
-Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings
-Werror=implicit-function-d
eclaration -Werror=vla -fcx-fortran-rules -ffunction-sections -fdata-sections
-mieee -g -O2 -MT maxloc0_16_i16.lo -MD -MP -MF .deps/maxloc0_16_i16.Tpo -c
../../../src/libgf
ortran/generated/maxloc0_16_i16.c -o maxloc0_16_i16.o >/dev/null 2>&1
libtool: compile:  /<<PKGBUILDDIR>>/build/./gcc/gccgo
-B/<<PKGBUILDDIR>>/build/./gcc/ -B/usr/sh4-linux-gnu/bin/
-B/usr/sh4-linux-gnu/lib/ -isystem /usr/sh4-linux-gnu/includ
e -isystem /usr/sh4-linux-gnu/sys-include -isystem
/<<PKGBUILDDIR>>/build/sys-include -O2 -g -I . -c
-fgo-pkgpath=runtime/internal/sys -fgo-compiling-runtime ../../../src/l
ibgo/go/runtime/internal/sys/intrinsics.go
../../../src/libgo/go/runtime/internal/sys/stubs.go
../../../src/libgo/go/runtime/internal/sys/sys.go version.go  -fPIC -o runtim
e/internal/.libs/sys.o
version.go:54:15: error: reference to undefined name 'unknown'
  ArchFamily = unknown
               ^

Looking at libgo/configure.ac, it seems that SH is missing here.

I'm currently testing the following change:

--- libgo/configure.ac.orig     2017-01-23 19:10:13.000000000 +0100
+++ libgo/configure.ac  2017-12-07 01:33:21.424493549 +0100
@@ -354,6 +354,13 @@
     GOARCH_CACHELINESIZE=256
     GOARCH_PCQUANTUM=2
     ;;
+  sh*-*-*)
+    GOARCH=sh
+    GOARCH_FAMILY=SH
+    GOARCH_CACHELINESIZE=32
+    GOARCH_PCQUANTUM=4
+    GOARCH_MINFRAMESIZE=4
+    ;;
   sparc*-*-*)
     AC_COMPILE_IFELSE([
 #if defined(__sparcv9) || defined(__arch64__)

I know that PCQUANTUM=4 is the proper value for SH (jemalloc's source code has
4 for SH), but I'm not sure about CACHELINESIZE and MINFRAMESIZE. According to
[1], SH supports multiple page sizes, so the 4k default seems reasonable.

> [1] http://lars.nocrew.org/computers/processors/SuperH/sh4cpu_sh1.pdf


More information about the Gcc-bugs mailing list