egcs/fortran and m68k-motorola-sysv

Philippe De Muyter phdm@mail.macqel.be
Sat Sep 27 14:44:00 GMT 1997


Here are some patches I needed to apply to egcs-970922 in order to get it
to bootstrap on m68k-motorola-sysv.  I amongst other changes needed to
rename a file with a > 14 characters name.  The patch below does not remove
the file with the old name, but provides the file with the new name because
it also includes some changes.  Please consider this for inclusion in the next
snapshot of egcs.

For gcc/ChangeLog :

Sat Sep 27 23:06:37 1997  Philippe De Muyter  <phdm@info.ucl.ac.be>

	* config/m68k/x-mot3300 (XCFLAGS): Disable as's long/short jump
	optimisation for f/expr.o and f/stb.o.

For gcc/f/ChangeLog :

Sat Sep 27 23:06:37 1997  Philippe De Muyter  <phdm@info.ucl.ac.be>

	* g77.c (pexecute, main): Use unlink, not remove.

For gcc/f/runtime/ChangeLog :

Sat Sep 27 23:06:37 1997  Philippe De Muyter  <phdm@info.ucl.ac.be>

	* libU77/sys_clock_.c: File renamed from system_clock_.c.
	libU77/Makefile.in, Makefile.in : Reference sys_clock_.*, not
	system_clock_.*.
	* libU77/dtime_.c (clk_tck): Try also HZ macro.
	* libU77/access.c (G77_access_0): Check malloc return value against 0,
	not NULL.
	libU77/getlog_.c, libU77/ttynam_.c, libU77/chdir_.c: Ditto.
	libU77/chmod_.c, libU77/rename_.c: Ditto.
	
--- /tmp/dm6546	Sat Sep 27 23:04:47 1997
+++ ./gcc/config/m68k/x-mot3300	Wed Sep 24 23:10:23 1997
@@ -11,4 +11,5 @@
 # Another possible fix would be to split combine.c.
 # Since ss-961013, the same happens for expr.c compiled by gcc, but not by cc;
 # and for cp/decl.c; aren't those files too big ?
-XCFLAGS=`case $@ in combine.o|expr.o|decl.o) echo -Wa,-j;;esac`
+# With egcs-970910, this also happens for f/expr.o and f/stb.o
+XCFLAGS=`case $@ in combine.o|expr.o|decl.o|f/expr.o|f/stb.o) echo -Wa,-j;;esac`
--- /tmp/dm6546	Sat Sep 27 23:04:48 1997
+++ ./gcc/f/runtime/libU77/etime_.c	Thu Sep 25 11:45:32 1997
@@ -66,6 +66,8 @@ double G77_etime_0 (tarray)
   if (! clk_tck) clk_tck = CLOCKS_PER_SECOND;
 #  elif defined CLK_TCK
   if (! clk_tck) clk_tck = CLK_TCK;
+#  elif defined HZ
+  if (! clk_tck) clk_tck = HZ;
 #  elif defined HAVE_GETRUSAGE
 #  else
   #error Dont know clock tick length
--- /tmp/dm6546	Sat Sep 27 23:04:48 1997
+++ ./gcc/f/runtime/libU77/dtime_.c	Thu Sep 25 12:20:39 1997
@@ -22,7 +22,9 @@
 #if HAVE_UNISTD_H
 #  include <unistd.h>
 #endif
+#include <sys/types.h>
 #include <sys/times.h>
+#include <sys/param.h>
 #if HAVE_GETRUSAGE
 #  include <sys/time.h>
 #  include <sys/resource.h>
@@ -68,6 +70,8 @@ double G77_dtime_0 (tarray)
   if (! clk_tck) clk_tck = CLOCKS_PER_SECOND;
 #  elif defined CLK_TCK
   if (! clk_tck) clk_tck = CLK_TCK;
+#  elif defined HZ
+  if (! clk_tck) clk_tck = HZ;
 #  elif defined HAVE_GETRUSAGE
 #  else
   #error Dont know clock tick length
--- /tmp/dm6546	Sat Sep 27 23:04:49 1997
+++ ./gcc/f/runtime/libU77/access_.c	Thu Sep 25 13:27:58 1997
@@ -25,7 +25,7 @@
 #if HAVE_STDLIB_H
 #  include <stdlib.h>
 #else
-#  include <stdio.h>		/* for NULL */
+#  include <stdio.h>
 #endif
 
 #include <errno.h>
@@ -62,7 +62,7 @@ integer G77_access_0 (const char *name, 
   int amode, i;
 
   buff = malloc (Lname+1);
-  if (buff == NULL) return -1;
+  if (!buff) return -1;
   g_char (name, Lname, buff);
   amode = 0;
   for (i=0;i<Lmode;i++) {
--- /tmp/dm6546	Sat Sep 27 23:04:49 1997
+++ ./gcc/f/runtime/libU77/getlog_.c	Thu Sep 25 13:17:06 1997
@@ -19,6 +19,7 @@
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
+#include <sys/types.h>
 #if HAVE_STDLIB_H
 #  include <stdlib.h>
 #else
--- /tmp/dm6546	Sat Sep 27 23:04:50 1997
+++ ./gcc/f/runtime/libU77/ttynam_.c	Thu Sep 25 13:19:35 1997
@@ -19,6 +19,7 @@
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
+#include <sys/types.h>
 #if STDC_HEADERS
 #  include <stdlib.h>
 #endif
--- /tmp/dm6546	Sat Sep 27 23:04:50 1997
+++ ./gcc/f/runtime/libU77/chdir_.c	Thu Sep 25 13:27:17 1997
@@ -49,7 +49,7 @@ integer G77_chdir_0 (const char *name, c
   int i;
 
   buff = malloc (Lname+1);
-  if (buff == NULL) return -1;
+  if (!buff) return -1;
   g_char (name, Lname, buff);
   i = chdir (buff);
   free (buff);
--- /tmp/dm6546	Sat Sep 27 23:04:51 1997
+++ ./gcc/f/runtime/libU77/chmod_.c	Thu Sep 25 13:33:51 1997
@@ -29,7 +29,7 @@
 #if HAVE_STDLIB_H
 #  include <stdlib.h>
 #else
-#  include <stdio.h>		/* for NULL */
+#  include <stdio.h>
 #endif
 
 #include "f2c.h"
@@ -62,7 +62,7 @@ integer G77_chmod_0 (name, mode, Lname, 
   char chmod_path [] = CHMOD_PATH;
   l = strlen (chmod_path);
   buff = malloc (Lname+Lmode+l+3+13+1);
-  if (buff == NULL) return -1;
+  if (!buff) return -1;
   ii[0] = l; a[0] = chmod_path;
   ii[1] = 1; a[1] = " ";
   ii[2] = Lmode; a[2] = mode;
--- /tmp/dm6546	Sat Sep 27 23:04:51 1997
+++ ./gcc/f/runtime/libU77/rename_.c	Thu Sep 25 13:40:55 1997
@@ -19,6 +19,9 @@
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
+#if HAVE_UNISTD_H
+#  include <unistd.h>
+#endif
 #if HAVE_STDLIB_H
 #  include <stdlib.h>
 #endif
--- /tmp/dm6546	Sat Sep 27 23:04:52 1997
+++ ./gcc/f/runtime/libU77/sys_clock_.c	Thu Sep 25 14:55:54 1997
@@ -0,0 +1,66 @@
+/* Copyright (C) 1996 Free Software Foundation, Inc.
+This file is part of GNU Fortran libU77 library.
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Library General Public License as published
+by the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+GNU Fortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with GNU Fortran; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#include <sys/times.h>
+#include <limits.h>
+#if HAVE_UNISTD_H
+#  include <unistd.h>
+#endif
+#include "f2c.h"
+
+#ifdef KR_headers
+int G77_system_clock_0 (count, count_rate, count_max)
+     integer *count, *count_rate, *count_max;
+#else
+int G77_system_clock_0 (integer *count, integer *count_rate, integer *count_max)
+#endif
+{
+  struct tms buffer;
+  unsigned long cnt;
+#ifdef _SC_CLK_TCK
+  *count_rate = sysconf(_SC_CLK_TCK);
+#elif defined CLOCKS_PER_SECOND
+  *count_rate = CLOCKS_PER_SECOND;
+#elif defined CLK_TCK
+  *count_rate = CLK_TCK;
+#elif defined HZ
+  *count_rate = HZ;
+#else
+  #error Dont know clock tick length
+#endif
+  *count_max = INT_MAX;		/* dubious */
+  cnt = times (&buffer);
+  if (cnt > (unsigned long) (*count_max))
+    *count = *count_max;	/* also dubious */
+  else
+    *count = cnt;
+  return 0;
+}
--- /tmp/dm6546	Sat Sep 27 23:04:53 1997
+++ ./gcc/f/runtime/libU77/Makefile.in	Thu Sep 25 14:56:53 1997
@@ -58,7 +58,7 @@
         vxttime_.o vxtidate_.o gmtime_.o fdate_.o secnds_.o \
 	bes.o dbes.o \
 	chdir_.o chmod_.o lnblnk_.o hostnm_.o rename_.o fgetc_.o fputc_.o \
-        umask_.o system_clock_.o date_.o second_.o flush1_.o mclock_.o \
+        umask_.o sys_clock_.o date_.o second_.o flush1_.o mclock_.o \
 	alarm_.o
 SRCS =  Version.c gerror_.c perror_.c ierrno_.c itime_.c time_.c \
 	unlink_.c fnum_.c getpid_.c getuid_.c getgid_.c kill_.c rand_.c \
@@ -68,7 +68,7 @@
         vxttime_.c vxtidate_.c gmtime_.c fdate_.c secnds_.c \
 	bes.c dbes.c \
 	chdir_.c chmod_.c lnblnk_.c hostnm_.c rename_.c fgetc_.c fputc_.c \
-	umask_.c system_clock_.c date_.c second_.c flush1_.c mclock_.c \
+	umask_.c sys_clock_.c date_.c second_.c flush1_.c mclock_.c \
 	alarm_.c
 
 F2C_H = ../../../include/f2c.h
@@ -146,7 +146,7 @@
 rename_.o: rename_.c
 fputc_.o: fputc_.c
 fgetc_.o: fgetc_.c
-system_clock_.o: system_clock_.c
+sys_clock_.o: sys_clock_.c
 umask_.o: umask_.c
 flush1_.o: flush1_.c
 mclock_.o: mclock_.c
--- /tmp/dm6546	Sat Sep 27 23:04:54 1997
+++ ./gcc/f/runtime/Makefile.in	Thu Sep 25 18:02:24 1997
@@ -131,7 +131,7 @@
 	libU77/vxtidate_.o libU77/gmtime_.o libU77/fdate_.o libU77/secnds_.o \
 	libU77/bes.o libU77/dbes.o libU77/chdir_.o libU77/chmod_.o \
 	libU77/lnblnk_.o libU77/hostnm_.o libU77/rename_.o libU77/fgetc_.o \
-	libU77/fputc_.o libU77/umask_.o libU77/system_clock_.o libU77/date_.o \
+	libU77/fputc_.o libU77/umask_.o libU77/sys_clock_.o libU77/date_.o \
 	libU77/second_.o libU77/flush1_.o libU77/alarm_.o libU77/mclock_.o \
 	libU77/symlnk_.o
 
--- /tmp/dm6546	Sat Sep 27 23:04:54 1997
+++ ./gcc/f/g77.c	Thu Sep 25 00:44:52 1997
@@ -966,7 +966,7 @@ pexecute (search_flag, program, argv, no
 
   i = system (scmd);
 
-  remove (rf);
+  unlink (rf);
 #endif
   
   if (i == -1)
@@ -1545,8 +1545,8 @@ main (argc, argv)
       if (doit (temp_filename, outargv) < 0)
 	++error_count;
 
-      remove (temp_filename);
-      remove (temp_filename_f);
+      unlink (temp_filename);
+      unlink (temp_filename_f);
     }
 
   exit (error_count > 0 ? (signal_count ? 2 : 1) : 0);



More information about the Gcc mailing list