summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorespie <espie@openbsd.org>2002-05-30 20:46:04 +0000
committerespie <espie@openbsd.org>2002-05-30 20:46:04 +0000
commitbf25271e66d119e93781f140ac5257706d3c601e (patch)
tree53a060e2ea1c19f11ab33dbfcb3831e82f71afaa
parenta grammar knit; from Aidan Kehoe <kehoea@parhasard.net> (diff)
downloadwireguard-openbsd-bf25271e66d119e93781f140ac5257706d3c601e.tar.xz
wireguard-openbsd-bf25271e66d119e93781f140ac5257706d3c601e.zip
separate main.c into a separate libfrtbegin.a.
Handle that in g77spec. Taken from gcc 3.1 (apart from the Makefile.bsd-wrapper changes). This allows one to link fortran code with other languages on ELF platforms: putting main.c in libg2c.so would make libg2c insist it got a MAIN__ symbol. Okay fgs@, pval@.
-rw-r--r--gnu/egcs/gcc/f/g77spec.c22
-rw-r--r--gnu/egcs/libf2c/Makefile.bsd-wrapper6
-rw-r--r--gnu/egcs/libf2c/libF77/Makefile.bsd-wrapper8
-rw-r--r--gnu/egcs/libf2c/shlib_version4
4 files changed, 35 insertions, 5 deletions
diff --git a/gnu/egcs/gcc/f/g77spec.c b/gnu/egcs/gcc/f/g77spec.c
index 93a363cddb8..4afbca85b85 100644
--- a/gnu/egcs/gcc/f/g77spec.c
+++ b/gnu/egcs/gcc/f/g77spec.c
@@ -52,6 +52,10 @@ Boston, MA 02111-1307, USA. */
#define MATH_LIBRARY "-lm"
#endif
+#ifndef FORTRAN_INIT
+#define FORTRAN_INIT "-lfrtbegin"
+#endif
+
#ifndef FORTRAN_LIBRARY
#define FORTRAN_LIBRARY "-lg2c"
#endif
@@ -286,6 +290,10 @@ lang_specific_driver (fn, in_argc, in_argv, in_added_libraries)
2 => last two args were -l<library> -lm. */
int saw_library = 0;
+ /* 0 => initial/reset state
+ 1 => FORTRAN_INIT linked in */
+ int use_init = 0;
+
/* By default, we throw on the math library if we have one. */
int need_math = (MATH_LIBRARY[0] != '\0');
@@ -519,7 +527,14 @@ For bug reporting instructions, please see:\n\
if (saw_library == 1)
saw_library = 2; /* -l<library> -lm. */
else
- append_arg (FORTRAN_LIBRARY);
+ {
+ if (0 == use_init)
+ {
+ append_arg (FORTRAN_INIT);
+ use_init = 1;
+ }
+ append_arg (FORTRAN_LIBRARY);
+ }
}
else if (strcmp (argv[i], FORTRAN_LIBRARY) == 0)
saw_library = 1; /* -l<library>. */
@@ -543,6 +558,11 @@ For bug reporting instructions, please see:\n\
switch (saw_library)
{
case 0:
+ if (0 == use_init)
+ {
+ append_arg (FORTRAN_INIT);
+ use_init = 1;
+ }
append_arg (library);
case 1:
if (need_math)
diff --git a/gnu/egcs/libf2c/Makefile.bsd-wrapper b/gnu/egcs/libf2c/Makefile.bsd-wrapper
index 8c170f6acbe..20c955e88eb 100644
--- a/gnu/egcs/libf2c/Makefile.bsd-wrapper
+++ b/gnu/egcs/libf2c/Makefile.bsd-wrapper
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.bsd-wrapper,v 1.4 2000/05/15 06:10:20 niklas Exp $
+# $OpenBSD: Makefile.bsd-wrapper,v 1.5 2002/05/30 20:46:04 espie Exp $
EGCS_DIR= $(.CURDIR)/..
.if defined(OBJMACHINE)
@@ -12,6 +12,8 @@ EGCS_OBJDIR!= if [ -d $(EGCS_DIR)/$(OBJDIR) ]; then \
echo $(EGCS_DIR); \
fi
+# for libfrtbegin
+SUBDIR=libF77
#SUBDIR=libF77 libI77 libU77
LIB=g2c
@@ -37,7 +39,7 @@ DEFS=-DAllow_TYQUAD -DSTDC_HEADERS=1 -D_POSIX_SOURCE=1 -DHAVE_TEMPNAM=1 \
-DRETSIGTYPE=void -DIEEE_drem=1 -DHAVE_CONFIG_H \
-IlibU77 -I${.CURDIR}/libI77 -I${.OBJDIR} -I${.CURDIR}
-MISC = F77_aloc.c main.c s_rnge.c abort_.c getarg_.c iargc_.c\
+MISC = 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
POW = pow_ci.c pow_dd.c pow_di.c pow_hh.c pow_ii.c pow_ri.c pow_zi.c pow_zz.c \
diff --git a/gnu/egcs/libf2c/libF77/Makefile.bsd-wrapper b/gnu/egcs/libf2c/libF77/Makefile.bsd-wrapper
new file mode 100644
index 00000000000..daae8d76b62
--- /dev/null
+++ b/gnu/egcs/libf2c/libF77/Makefile.bsd-wrapper
@@ -0,0 +1,8 @@
+# $OpenBSD: Makefile.bsd-wrapper,v 1.1 2002/05/30 20:46:05 espie Exp $
+
+# This needs to be separate from libg2c to allow for mixed
+# Fortran/other language programs.
+LIB=frtbegin
+SRCS=main.c
+
+.include <bsd.lib.mk>
diff --git a/gnu/egcs/libf2c/shlib_version b/gnu/egcs/libf2c/shlib_version
index da0e54acf07..9c1551636c5 100644
--- a/gnu/egcs/libf2c/shlib_version
+++ b/gnu/egcs/libf2c/shlib_version
@@ -1,2 +1,2 @@
-major=5
-minor=24
+major=6
+minor=0