[SUMMARY] compiling gcc3.2.x

From: Alex Schieber (alex.schieber@montpellier.cpu.fr)
Date: Thu Apr 24 2003 - 10:13:02 EDT


Hello,
Special thanks to all of whom answered. My original post :

Hello wizards,

I'd like to get gcc 3.2.X running on a Tru64 5.1B box (ev68 proc). Whenever I type "make bootstrap", I get the following error message after a while :

_F64__F64_stat
_F64__F64_fstat
_F64__F64_lstat
collect2: ld returned 1 exit status
make[2]: *** [cc1] Error 1

Any help/hints much appreciated.

The answer :
This is a known bug tha a patch fixes :
This patch fixes the Tru64 UNIX V5.1B bootstrap failure reported by Olle
and fixes two other PRs related to the support for #pragma extern_prefix
introduced for GCC 3.1: starting from that release, in addition to support
for the pragma, gcc predefines __EXTERN_PREFIX. Unfortunately, unlike
__PRAGMA_REDEFINE_EXTNAME used by the Solaris 2 system headers to detect
support for their similar #pragma redefine_extname, this __EXTERN_PREFIX
macro is not a general feature test macro used to detect whether the
compiler used supports the pragma, but only used in <sys/stat.h> to detect
the pragma.
The V5.1B bootstrap failure reported in PR other/9671 can be observed with
the following trivial example:
#include <sys/types.h>
#include <sys/stat.h>
int
main (void)
{
struct stat st;
stat ("/", &st);
return (0);
}
which, when linked, results in an unresolved reference to _F64__F64_stat.
The V5.1B <sys/stat.h> has this code section (condensed for clarity):
# if defined(__DECC)
# define __EXTERN_PREFIX /* rename via #pragma extern_prefix "_F64_" */
# else /* ! __DECC */
# define __F64_USE_JACKET __inline__ static
# undef __STAT__
# define __STAT__ _F64_stat /* Add _F64_ prefix */
# endif /* __DECC */
# defined(__EXTERN_PREFIX)
# pragma extern_prefix "_F64_"
# endif
extern int __STAT__ __((const char *, struct stat *));
# if defined(__EXTERN_PREFIX)
# pragma extern_prefix ""
# endif
# if defined(__F64_USE_JACKET)
__F64_USE_JACKET int stat(const char *__a, struct stat *__b) {
return(_F64_stat(__a,__b));
}
# endif /* __F64_USE_JACKET */
In effect, we get both the effects of #pragma extern_prefix (since gcc
predefines __EXTERN_PREFIX) and the wrapper functions (since obviously
__DECC isn't defined), resulting in the double prefix observed.
The fix is trivial: instead of defining __EXTERN_PREFIX ourselves, define
__PRAGMA_EXTERN_PREFIX (similar to the Solaris 2 solution above) and change
the __DECC test via fixincludes to test for __DECC || __PRAGMA_EXTERN_PREFIX
instead.
The patch below implements this and allows me to bootstrap gcc 3.2.2 on
alpha-dec-osf5.1b (thanks to Larry McVoy for providing a test system).
Besides, the patch fixes PR c/6126 (verified on the 3.3 branch on
alpha-dec-osf5.1) and most likely PR c/5059 as well. I couldn't check
mainline, which doesn't bootstrap on Tru64 UNIX for about 2 months ;-(
It passes make check in fixinc, too.
Note that 3.3/3.4 need a slightly different version of the osf.h patch,
appended separately below.
Unfortunately, this patch fixes only part of the #pragma extern_prefix
problem on Tru64 UNIX: besides <sys/stat.h> with its __EXTERN_PREFIX magic,
many other system headers use that pragma. I'll have to provide
fixincludes fixes to test for __PRAGMA_EXTERN_PREFIX in addition to __DECC,
but this will have to wait for a different patch since several forms of the
__DECC test are used there.
Ok for 3.2 and 3.3 branches as well as mainline?
Rainer
Fri Feb 21 14:32:29 2003 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* config/alpha/osf.h (TARGET_OS_CPP_BUILTINS): Rename
__EXTERN_PREFIX to __PRAGMA_EXTERN_PREFIX.
* doc/extend.texi (Tru64 Pragmas): Reflect this.
* fixinc/inclhack.def (alpha___extern_prefix): Indicate #pragma
extern_prefix support for Tru64 UNIX V5 <sys/stat.h>.
* fixinc/fixincl.x: Regenerate.
* fixinc/tests/base/sys/stat.h [ALPHA___EXTERN_PREFIX_CHECK]: New
testcase.
Fixes PR c/5059, c/6126, other/9671.
testsuite:
* g++.dg/other/pragma-ep-1.C: Test for __PRAGMA_EXTERN_PREFIX.
* gcc.dg/pragma-ep-1.c: Likewise.
Index: config/alpha/osf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/osf.h,v
retrieving revision 1.29
diff -u -p -b -r1.29 osf.h
--- config/alpha/osf.h 26 Nov 2002 04:54:47 -0000 1.29
+++ config/alpha/osf.h 21 Feb 2003 13:45:42 -0000
@@ -39,7 +39,7 @@ Boston, MA 02111-1307, USA. */
builtin_define ("_SYSTYPE_BSD"); \
builtin_define ("__osf__"); \
builtin_define ("_LONGLONG"); \
- builtin_define ("__EXTERN_PREFIX"); \
+ builtin_define ("__PRAGMA_EXTERN_PREFIX"); \
builtin_assert ("system=unix"); \
builtin_assert ("system=xpg4"); \
/* Tru64 UNIX V5 has a 16 byte long \
Index: fixinc/inclhack.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fixinc/inclhack.def,v
retrieving revision 1.139.4.2
diff -u -p -b -r1.139.4.2 inclhack.def
--- fixinc/inclhack.def 14 Feb 2003 04:34:35 -0000 1.139.4.2
+++ fixinc/inclhack.def 21 Feb 2003 13:45:43 -0000
@@ -599,6 +599,22 @@ fix = {

/*
+ * Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX V5 <sys/stat.h>.
+ */
+fix = {
+ hackname = alpha___extern_prefix;
+ files = sys/stat.h;
+ select = "#[ \t]*if[ \t]*defined\\(__DECC\\)";
+
+ mach = "alpha*-dec-osf5*";
+ c_fix = format;
+ c_fix_arg = "%0 || defined(__PRAGMA_EXTERN_PREFIX)";
+
+ test_text = "# if defined(__DECC)";
+};
+
+
+/*
* Fix assert macro in assert.h on Alpha OSF/1.
* The superfluous int cast breaks C++.
*/
Index: doc/extend.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/extend.texi,v
retrieving revision 1.109.2.3
diff -u -p -b -r1.109.2.3 extend.texi
--- doc/extend.texi 27 Jan 2003 10:48:18 -0000 1.109.2.3
+++ doc/extend.texi 21 Feb 2003 13:45:43 -0000
@@ -6465,7 +6465,8 @@ empty string.
This pragma is similar in intent to to the asm labels extension
(@pxref{Asm Labels}) in that the system programmer wants to change
the assembly-level ABI without changing the source-level API. The
-preprocessor defines @code{__EXTERN_PREFIX} if the pragma is available.
+preprocessor defines @code{__PRAGMA_EXTERN_PREFIX} if the pragma is
+available.
@end table
@node Unnamed Fields
Index: testsuite/g++.dg/other/pragma-ep-1.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.dg/other/pragma-ep-1.C,v
retrieving revision 1.2
diff -u -p -b -r1.2 pragma-ep-1.C
--- testsuite/g++.dg/other/pragma-ep-1.C 22 Mar 2002 22:51:47 -0000 1.2
+++ testsuite/g++.dg/other/pragma-ep-1.C 21 Feb 2003 13:45:43 -0000
@@ -5,7 +5,7 @@
/* { dg-final { scan-assembler "four" } } */
/* { dg-final { scan-assembler-not "_four" } } */
-#ifndef __EXTERN_PREFIX
+#ifndef __PRAGMA_EXTERN_PREFIX
#error
#endif
Index: testsuite/gcc.dg/pragma-ep-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pragma-ep-1.c,v
retrieving revision 1.2
diff -u -p -b -r1.2 pragma-ep-1.c
--- testsuite/gcc.dg/pragma-ep-1.c 22 Mar 2002 22:51:47 -0000 1.2
+++ testsuite/gcc.dg/pragma-ep-1.c 21 Feb 2003 13:45:43 -0000
@@ -5,7 +5,7 @@
/* { dg-final { scan-assembler "four" } } */
/* { dg-final { scan-assembler-not "_four" } } */
-#ifndef __EXTERN_PREFIX
+#ifndef __PRAGMA_EXTERN_PREFIX
#error
#endif
* config/alpha/osf.h (CPP_SUBTARGET_SPEC): Rename
__EXTERN_PREFIX to __PRAGMA_EXTERN_PREFIX.
Index: config/alpha/osf.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/osf.h,v
retrieving revision 1.22.14.3
diff -u -p -b -r1.22.14.3 osf.h
--- config/alpha/osf.h 12 Apr 2002 22:16:56 -0000 1.22.14.3
+++ config/alpha/osf.h 21 Feb 2003 13:48:19 -0000
@@ -48,7 +48,7 @@ Boston, MA 02111-1307, USA. */
#undef CPP_SUBTARGET_SPEC
#define CPP_SUBTARGET_SPEC \
"%{pthread|threads:-D_REENTRANT} %{threads:-D_PTHREAD_USE_D4} %(cpp_xfloat) \
--D__EXTERN_PREFIX"
+-D__PRAGMA_EXTERN_PREFIX"
/* Under OSF4, -p and -pg require -lprof1, and -lprof1 requires -lpdf. */



This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 10:49:17 EDT