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

--- Comment #26 from Gary Mills <gary_mills at fastmail dot fm> ---
I have no concerns about removal of gcc support for Solaris 10:  That is an
obsolete operating system, after all.  illumos is equivalent to Solaris 11.

gas is used for illumos compilers on x86.  It works on SPARC too, and avoids
the ICE.  Unfortunately, gcc with gas can't be used to compile the SPARC
kernel.  That's because some SPARC kernel files are written in assembler
language.  These won't compile with gas, only with the native assembler.  It
would be difficult, but not impossible, to use gcc with gas on SPARC hardware.

I've just attempted to build gcc-7.3.0 on SPARC with an even more restricted
configuration:

  $
/export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/gcc-7.3.0/configure
--without-gnu-ld --with-ld=/usr/bin/ld --without-gnu-as --with-as=/usr/bin/as

The compilers are not specified on the command line but they are in the
environment.  The compilers were identified correctly.

The build got considerably farther, but ended with this error:

libtool: compile: 
/export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/build/sparcv7/./gcc/xgcc
-shared-libgcc
-B/export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/build/sparcv7/./gcc
-nostdinc++
-L/export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/build/sparcv7/sparc-sun-solaris2.11/libstdc++-v3/src
-L/export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/build/sparcv7/sparc-sun-solaris2.11/libstdc++-v3/src/.libs
-L/export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/build/sparcv7/sparc-sun-solaris2.11/libstdc++-v3/libsupc++/.libs
-B/usr/local/sparc-sun-solaris2.11/bin/ -B/usr/local/sparc-sun-solaris2.11/lib/
-isystem /usr/local/sparc-sun-solaris2.11/include -isystem
/usr/local/sparc-sun-solaris2.11/sys-include
-I/export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/gcc-7.3.0/libstdc++-v3/../libgcc
-I/export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/build/sparcv7/sparc-sun-solaris2.11/libstdc++-v3/include/sparc-sun-solaris2.11
-I/export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/build/sparcv7/sparc-sun-solaris2.11/libstdc++-v3/include
-I/export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/gcc-7.3.0/libstdc++-v3/libsupc++
-D_GLIBCXX_SHARED -fno-implicit-templates -Wall -Wextra -Wwrite-strings
-Wcast-qual -Wabi -fdiagnostics-show-location=once -ffunction-sections
-fdata-sections -frandom-seed=new_opa.lo -g -O2 -std=gnu++1z -c
/export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/gcc-7.3.0/libstdc++-v3/libsupc++/new_opa.cc
 -fPIC -DPIC -D_GLIBCXX_SHARED -o new_opa.o
/export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/gcc-7.3.0/libstdc++-v3/libsupc++/new_opa.cc:
In function 'void* operator new(std::size_t, std::align_val_t)':
/export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/gcc-7.3.0/libstdc++-v3/libsupc++/new_opa.cc:103:33:
error: 'aligned_alloc' was not declared in this scope
   while (__builtin_expect ((p = aligned_alloc (align, sz)) == 0, false))
                                 ^~~~~~~~~~~~~
/export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/gcc-7.3.0/libstdc++-v3/libsupc++/new_opa.cc:103:33:
note: suggested alternative:
In file included from /usr/include/stdlib.h:39:0,
                 from
/export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/build/sparcv7/sparc-sun-solaris2.11/libstdc++-v3/include/cstdlib:75,
                 from
/export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/build/sparcv7/sparc-sun-solaris2.11/libstdc++-v3/include/stdlib.h:36,
                 from
/export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/gcc-7.3.0/libstdc++-v3/libsupc++/new_opa.cc:27:
/usr/include/iso/stdlib_c11.h:60:14: note:   'std::aligned_alloc'
 extern void *aligned_alloc(size_t, size_t);
              ^~~~~~~~~~~~~
Makefile:936: recipe for target 'new_opa.lo' failed
make[6]: *** [new_opa.lo] Error 1
make[6]: Leaving directory
'/dpool/export/home/mills/Downloads/code/oi-userland-apr/components/developer/gcc-7/build/sparcv7/sparc-sun-solaris2.11/libstdc++-v3/libsupc++'

There is a patch which seems to fix this error:

--- gcc-7.1.0.orig/libstdc++-v3/libsupc++/new_opa.cc    2017-01-26
15:30:45.000000000 +0100
+++ gcc-7.1.0/libstdc++-v3/libsupc++/new_opa.cc 2017-05-04 17:16:25.920300456
+0200
@@ -31,7 +31,6 @@
 using std::new_handler;
 using std::bad_alloc;

-#if !_GLIBCXX_HAVE_ALIGNED_ALLOC
 #if _GLIBCXX_HAVE__ALIGNED_MALLOC
 #define aligned_alloc(al,sz) _aligned_malloc(sz,al)
 #elif _GLIBCXX_HAVE_POSIX_MEMALIGN
@@ -82,7 +81,6 @@
   return aligned_ptr;
 }
 #endif
-#endif

 _GLIBCXX_WEAK_DEFINITION void *
 operator new (std::size_t sz, std::align_val_t al)

I can't be certain that this patch does not have unwanted side effects, but it
seems correct.

genmddeps seems to be correct now:

<mills@t2000:862>$ build/sparcv7/gcc/build/genmddeps -?
genmddeps: invalid option `-?'

At least, it doesn't dump core now.  The build got well past that point.  It
did  build xgcc this time:

<mills@t2000:865>$ build/sparcv7/./gcc/xgcc -v                
Using built-in specs.
COLLECT_GCC=build/sparcv7/./gcc/xgcc
Target: sparc-sun-solaris2.11
Configured with:
/export/home/mills/Downloads/code/oi-userland/components/developer/gcc-7/gcc-7.3.0/configure
--without-gnu-ld --with-ld=/usr/bin/ld --without-gnu-as --with-as=/usr/bin/as
Thread model: posix
gcc version 7.3.0 (GCC)

Reply via email to