🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.f77
Article #397

Startup routines for f77 and C

#397
From: map
Date: Thu, 17 Jul 1986 10:12
50 lines
2407 bytes
Hello, is there anyone who knows, and is willing to explain what is
meant by the following, taken from 'A Portable Fortran 77 Compiler', 
S.I.Feldman and P.J.Weinberger.

	'......the f77 and cc commands cause slightly different loading
sequences to be generated, since Fortran programs need a few extra libraries
and a different startup routine than do C programs'

I am using a VAX with 4.2BSD and have been scratching my head as to what all
this means. So far I have found that ld(1) says 'the entry point of the
output is the beginning of the first routine' Fine, using 'nm -p' this implies
that I am starting off with crt0.o (taken from /lib) for both C and f77.
However, documentation for crt0.c says that it is machine dependent for C
and from what I know it looks as if (for C at least) 'when the kernal starts
it jumps to location 2' 

	What I am after is a simple but *complete* explanation of how the
different environments are set up so that I may in turn explain it to some
very curious users (yes mom, I know it looks complicated but listen...)
One thing that I would like explained is when I have compiled and loaded
an f77 program and I use nm(1) there is a reference to main.o. I take this
to be the one found in /usr/lib/libF77.a and looks like:

			main.o:
			         U _MAIN_
			         U __cleanup
			         U __flsbuf
			         U _abort
			00000218 D _act_fpe
			00000268 D _act_ill
			         U _exit
			         U _f_exit
			         U _f_init
			         U _fprintf
			00000180 D _id_libF77
			00000000 T _main
			00000198 D _sig_act
			00000058 T _sigdie
			         U _signal
			         U _sigsetmask
			         U _units
			00000004 C _xargc
			00000004 C _xargv
			
is this where the *major* difference lies? i.e. by calling this the
environment is initialized in a manner suited to f77.

	Any comments and further insight would be most welcome.

Mark
Technical Details
Message-ID: <1709@eagle.ukc.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!utcs!mnetor!seismo!mcvax!ukc!map

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!utcs!mnetor!seismo!mcvax!ukc!map
From: map@ukc.UUCP
Newsgroups: net.lang.f77
Subject: Startup routines for f77 and C
Message-ID: <1709@eagle.ukc.ac.uk>
Date: Thu, 17-Jul-86 06:12:39 EDT
Article-I.D.: eagle.1709
Posted: Thu Jul 17 06:12:39 1986
Date-Received: Fri, 18-Jul-86 23:59:35 EDT
Reply-To: map@ukc.ac.uk (M.A.Pralat)
Organization: U of Kent at Canterbury, Canterbury, UK
Lines: 50