From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Alex Schieber Newsgroups: gmane.os.tru64.managers Subject: [SUMMARY] compiling gcc3.2.x Date: Thu, 24 Apr 2003 16:13:02 +0200 Sender: tru64-unix-managers-owner@ornl.gov Message-ID: <5.1.0.14.0.20030424161007.01a26a30@mailhost.montpellier.cpu.fr> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1051193616 16784 80.91.224.249 (24 Apr 2003 14:13:36 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 24 Apr 2003 14:13:36 +0000 (UTC) Original-X-From: tru64-unix-managers-owner-gotm-tru64-unix-managers=m.gmane.org@sws1.ctd.ornl.gov Thu Apr 24 16:13:34 2003 Return-path: Original-Received: from sws1.ctd.ornl.gov ([160.91.22.101]) by main.gmane.org with smtp (Exim 3.35 #1 (Debian)) id 198hSb-0004Gt-00 for ; Thu, 24 Apr 2003 16:12:25 +0200 Original-Received: (qmail 16785 invoked by uid 5); 24 Apr 2003 14:13:13 -0000 Original-Followup-To: poster Precedence: bulk Original-Received: (qmail 16776 invoked by uid 49493); 24 Apr 2003 14:13:13 -0000 Original-Received: from alex.schieber@montpellier.cpu.fr by sws1 by uid 49491 with qmail-scanner-1.14 (clamscan: 0.54. spamassassin: 2.50-cvs. Clear:SA:0(0.6/5.0):. Processed in 0.631413 secs); 24 Apr 2003 14:13:13 -0000 Original-Received: from unknown (HELO emroute1.cind.ornl.gov) (160.91.4.119) by 0 with SMTP; 24 Apr 2003 14:13:12 -0000 Original-Received: from emroute1.cind.ornl.gov (localhost [127.0.0.1]) by emroute1.cind.ornl.gov (PMDF V6.2 #30669) with ESMTP id <0HDU00CM1Q5YAC@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Thu, 24 Apr 2003 10:13:11 -0400 (EDT) Original-Received: from kaa.montpellier.cpu.fr (kaa.montpellier.cpu.fr [195.83.191.5]) by emroute1.cind.ornl.gov (PMDF V6.2 #30669) with ESMTP id <0HDU00EKHQ5SZM@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Thu, 24 Apr 2003 10:13:05 -0400 (EDT) Original-Received: from pc-als.montpellier.cpu.fr (pc-als.montpellier.cpu.fr [195.83.191.212]) by kaa.montpellier.cpu.fr (8.11.6/8.11.3) with ESMTP id h3OED3v131067 for ; Thu, 24 Apr 2003 16:13:03 +0200 (MEST) X-Sender: alex@mailhost.montpellier.cpu.fr Original-To: tru64-unix-managers@ornl.gov X-Mailer: QUALCOMM Windows Eudora Version 5.1 Xref: main.gmane.org gmane.os.tru64.managers:4053 X-Report-Spam: http://spam.gmane.org/gmane.os.tru64.managers:4053 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 to detect the pragma. The V5.1B bootstrap failure reported in PR other/9671 can be observed with the following trivial example: #include #include 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 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 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 * 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 . * 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 . + */ +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. */