From owner-freebsd-bugs Sat Jun 8 12:56:16 2002 Delivered-To: freebsd-bugs@freebsd.org Received: from dragon.nuxi.com (trang.nuxi.com [66.92.13.169]) by hub.freebsd.org (Postfix) with ESMTP id 3482E37B403; Sat, 8 Jun 2002 12:56:07 -0700 (PDT) Received: from dragon.nuxi.com (obrien@localhost [127.0.0.1]) by dragon.nuxi.com (8.12.3/8.12.2) with ESMTP id g58Ju6Jn028576; Sat, 8 Jun 2002 12:56:06 -0700 (PDT) (envelope-from obrien@dragon.nuxi.com) Received: (from obrien@localhost) by dragon.nuxi.com (8.12.3/8.12.3/Submit) id g58Ju6qU028575; Sat, 8 Jun 2002 12:56:06 -0700 (PDT) Date: Sat, 8 Jun 2002 12:56:06 -0700 From: "David O'Brien" To: kargl@troutmask.apl.washington.edu, freebsd-bugs@FreeBSD.org Cc: FreeBSD-gnats-submit@FreeBSD.org Subject: Re: gnu/38594: Fortan program don't link post gcc-3.1 Message-ID: <20020608125606.A28519@dragon.nuxi.com> Reply-To: obrien@FreeBSD.org References: <200206081954.g58JsLQ44699@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200206081954.g58JsLQ44699@freefall.freebsd.org>; from obrien@FreeBSD.org on Sat, Jun 08, 2002 at 12:54:21PM -0700 X-Operating-System: FreeBSD 5.0-CURRENT Organization: The NUXI BSD group X-Pgp-Rsa-Fingerprint: B7 4D 3E E9 11 39 5F A3 90 76 5D 69 58 D9 98 7A X-Pgp-Rsa-Keyid: 1024/34F9F9D5 Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org My commited "fix" is a hack. This diff would be the true fix if we wanted to go to all this trouble. Index: contrib/gcc/f/g77spec.c =================================================================== RCS file: /home/ncvs/src/contrib/gcc/f/g77spec.c,v retrieving revision 1.1.1.4 diff -u -r1.1.1.4 g77spec.c --- contrib/gcc/f/g77spec.c 1 Feb 2002 18:15:47 -0000 1.1.1.4 +++ contrib/gcc/f/g77spec.c 8 Jun 2002 19:43:59 -0000 @@ -52,14 +52,23 @@ #ifndef MATH_LIBRARY #define MATH_LIBRARY "-lm" #endif +#ifndef MATH_LIBRARY_PROFILE +#define MATH_LIBRARY_PROFILE "-lm" +#endif #ifndef FORTRAN_INIT #define FORTRAN_INIT "-lfrtbegin" #endif +#ifndef FORTRAN_INIT_PROFILE +#define FORTRAN_INIT_PROFILE "-lfrtbegin" +#endif #ifndef FORTRAN_LIBRARY #define FORTRAN_LIBRARY "-lg2c" #endif +#ifndef FORTRAN_LIBRARY_PROFILE +#define FORTRAN_LIBRARY_PROFILE "-lg2c" +#endif /* Options this driver needs to recognize, not just know how to skip over. */ @@ -79,6 +88,7 @@ OPTION_nostdlib, /* Aka --no-standard-libraries, or -nodefaultlibs. */ OPTION_o, /* Aka --output. */ + OPTION_p, /* Aka --profile. */ OPTION_S, /* Aka --assemble. */ OPTION_syntax_only, /* -fsyntax-only. */ OPTION_v, /* Aka --verbose. */ @@ -167,6 +177,9 @@ opt = OPTION_L, arg = text + 2; else if (text[1] == 'o') opt = OPTION_o; + else if ((text[1] == 'p') && (text[2] == '\0') + || (text[1] == 'p') && (text[2] == 'g') && (text[3] == '\0')) + opt = OPTION_p; else if ((text[1] == 'S') && (text[2] == '\0')) opt = OPTION_S, skip = 0; else if (text[1] == 'V') @@ -291,6 +304,9 @@ /* By default, we throw on the math library if we have one. */ int need_math = (MATH_LIBRARY[0] != '\0'); + /* If non-zero, the user gave us the `-p' or `-pg' flag. */ + int saw_profile_flag = 0; + /* The number of input and output files in the incoming arg list. */ int n_infiles = 0; int n_outfiles = 0; @@ -359,6 +375,11 @@ ++n_outfiles; break; + case OPTION_p: + saw_profile_flag = 1; + library = FORTRAN_LIBRARY_PROFILE; + break; + case OPTION_v: verbose = 1; break; @@ -432,7 +453,7 @@ /* Not a filename or library. */ if (saw_library == 1 && need_math) /* -l. */ - append_arg (MATH_LIBRARY); + append_arg (saw_profile_flag ? MATH_LIBRARY_PROFILE : MATH_LIBRARY); saw_library = 0; @@ -483,10 +504,12 @@ { if (0 == use_init) { - append_arg (FORTRAN_INIT); + append_arg (saw_profile_flag ? FORTRAN_INIT_PROFILE + : FORTRAN_INIT); use_init = 1; } - append_arg (FORTRAN_LIBRARY); + append_arg (saw_profile_flag ? FORTRAN_LIBRARY_PROFILE + : FORTRAN_LIBRARY); } } else if (strcmp (argv[i], FORTRAN_LIBRARY) == 0) @@ -494,7 +517,8 @@ else { /* Other library, or filename. */ if (saw_library == 1 && need_math) - append_arg (MATH_LIBRARY); + append_arg (saw_profile_flag ? MATH_LIBRARY_PROFILE + : MATH_LIBRARY); saw_library = 0; } } @@ -513,13 +537,14 @@ case 0: if (0 == use_init) { - append_arg (FORTRAN_INIT); + append_arg (saw_profile_flag ? FORTRAN_INIT_PROFILE + : FORTRAN_INIT); use_init = 1; } append_arg (library); case 1: if (need_math) - append_arg (MATH_LIBRARY); + append_arg (saw_profile_flag ? MATH_LIBRARY_PROFILE : MATH_LIBRARY); default: break; } Index: gnu/lib/Makefile =================================================================== RCS file: /home/ncvs/src/gnu/lib/Makefile,v retrieving revision 1.38 diff -u -r1.38 Makefile --- gnu/lib/Makefile 29 May 2002 00:45:50 -0000 1.38 +++ gnu/lib/Makefile 8 Jun 2002 19:44:01 -0000 @@ -19,7 +19,7 @@ .endif .if !defined(NO_FORTRAN) -SUBDIR+= libg2c +SUBDIR+= libfrtbegin libg2c .endif .include Index: gnu/lib/libfrtbegin/Makefile =================================================================== RCS file: gnu/lib/libfrtbegin/Makefile diff -N gnu/lib/libfrtbegin/Makefile --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/lib/libfrtbegin/Makefile 8 Jun 2002 19:46:34 -0000 @@ -0,0 +1,9 @@ +# $FreeBSD$ + +SRCDIR= ${.CURDIR}/../../../contrib/libf2c +.PATH: ${SRCDIR}/libF77 + +LIB= frtbegin +SRCS= main.c + +.include Index: gnu/lib/libg2c/Makefile =================================================================== RCS file: /home/ncvs/src/gnu/lib/libg2c/Makefile,v retrieving revision 1.9 diff -u -r1.9 Makefile --- gnu/lib/libg2c/Makefile 12 May 2002 16:00:46 -0000 1.9 +++ gnu/lib/libg2c/Makefile 8 Jun 2002 19:44:01 -0000 @@ -10,7 +11,7 @@ # Traditional FORTRAN Library members defined in libF77 -F77MISC= F77_aloc.c main.c s_rnge.c abort_.c getarg_.c \ +F77MISC= F77_aloc.c s_rnge.c abort_.c getarg_.c \ iargc_.c getenv_.c signal_.c s_stop.c s_paus.c system_.c \ cabs.c derf_.c derfc_.c erf_.c erfc_.c sig_die.c exit_.c \ setarg.c setsig.c Index: gnu/usr.bin/cc/cc_tools/freebsd-native.h =================================================================== RCS file: /home/ncvs/src/gnu/usr.bin/cc/cc_tools/freebsd-native.h,v retrieving revision 1.19 diff -u -r1.19 freebsd-native.h --- gnu/usr.bin/cc/cc_tools/freebsd-native.h 6 Jun 2002 03:47:02 -0000 1.19 +++ gnu/usr.bin/cc/cc_tools/freebsd-native.h 8 Jun 2002 19:44:01 -0000 @@ -49,6 +49,10 @@ /* For the native system compiler, we actually build libgcc in a profiled version. So we should use it with -pg. */ #define LIBGCC_SPEC "%{!pg: -lgcc} %{pg: -lgcc_p}" +#define LIBSTDCXX_PROFILE "-lstdc++_p" +#define MATH_LIBRARY_PROFILE "-lm_p" +#define FORTRAN_INIT_PROFILE "-lfrtbegin_p" +#define FORTRAN_LIBRARY_PROFILE "-lg2c_p" /* FreeBSD is 4.4BSD derived */ #define bsd4_4 Index: gnu/usr.bin/cc/f77/Makefile =================================================================== RCS file: /home/ncvs/src/gnu/usr.bin/cc/f77/Makefile,v retrieving revision 1.18 diff -u -r1.18 Makefile --- gnu/usr.bin/cc/f77/Makefile 8 Jun 2002 18:48:40 -0000 1.18 +++ gnu/usr.bin/cc/f77/Makefile 8 Jun 2002 19:44:01 -0000 @@ -10,7 +10,6 @@ CFLAGS+= -DDEFAULT_TARGET_VERSION=\"$(version)\" CFLAGS+= -DDEFAULT_TARGET_MACHINE=\"$(target)\" -CFLAGS+= -DFORTRAN_INIT=\"-lg2c\" DPADD= ${LIBCC_INT} LDADD= ${LIBCC_INT} To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message