I suppose mainline is affected as well, but I've first got a report about this
and
tested on GCC 4.4.2.

Bootstrapping GCC 4.4.2 on Solaris 11/SPARC and Solaris 10/x86 with Sun Studio
12.1 fails in stage 1 linking xgcc:

Undefined                       first referenced
 symbol                             in file
__gmpn_perfect_square_p             gcc.o
__gmpz_tdiv_q                       gcc.o
__gmpq_set                          gcc.o
__gmpz_set                          gcc.o
__gmpn_add_n                        gcc.o
__gmpn_sub_n                        gcc.o
__gmpn_popcount                     gcc.o
ld: fatal: Symbol referencing errors. No output written to xgcc

Re-running the gcc.o build with -E reveals that e.g. the reference to
__gmpn_perfect_square_p is from __gmpz_perfect_square_p which is *defined*
as extern in the header, although __GMP_EXTERN_INLINE is correctly defined
in gmp.h for __SUNPRO_C >= 0x560 (this is 0x5100 for Studio 12.1).  It turned
out that ansidecl.h was the culprit: the current file assumes that inline
is a keyword

#if __STDC_VERSION__ > 199901L

which is wrong: C99 defines __STDC_VERSION__ as 199901L, so the test should be
for >= instead as in several other places in GCC.  But even this doesn't help:
Sun cc only defines it in C99 mode (quelle surprise :-), but trying to
bootstrap
GCC with cc -xc99 or c99 breaks in other places (headers require e.g.
-D_XOPEN_SOURCE=0x600 with c99), so I chose to use another test:

#if (__STDC_VERSION__ >= 199901L) || (defined(__SUNPRO_C) &&
defined(__C99FEATURES__))

since the compiler supports inline even without C99 mode.  This got me somewhat
further, but I ran into a couple of compilation failures in the gcc directory:

"/vol/src/gnu/gcc/gcc-4.4.2/gcc/bitmap.c", line 298: reference to static
identifier "bitmap_elt_clear_from" in extern inline function
"/vol/src/gnu/gcc/gcc-4.4.2/gcc/dominance.c", line 718: reference to static
identifier "dom_convert_dir_to_idx" in extern inline function
"/vol/src/gnu/gcc/gcc-4.4.2/gcc/gimple.c", line 1471: reference to static
identifier "walk_gimple_asm" in extern inline function

I cannot say for certain if the errors are correct, but the do make sense to
me.
Chaning the three functions to extern allowed to compilation to continue, but
again linking xgcc failed with the same set of undefined functions.  Even with
extern inline, cc emits a definition of several functions in gcc.o, which still
reference functions only defined in libgmp.

I'm not sure what is the best way to handle this: one could link xgcc and cpp
with GMPLIBS or avoid including gmp.h in headers used by gcc.c.


-- 
           Summary: Bootstrap with Sun Studio 12.1 fails
           Product: gcc
           Version: 4.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ro at gcc dot gnu dot org
 GCC build triplet: *-*-solaris2.10
  GCC host triplet: *-*-solaris2.10
GCC target triplet: *-*-solaris2.10


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41771

Reply via email to