new@udel.edu (Darren New) (02/27/90)
Thanks to Dan Riley, I've gotten my program to be residentable under
the Lattice C compiler. Portions of the makefile are below. Note that
if you compile everything with the -d switch, BLINK will tell you
what line of your code has absolute references to writable data.
In my case, an automatic array initialized as
{
auto char buf[2] = " ";
}
was the culprit. LC didn't complain, but looking twice, this looks illegal
to me. I just changed it to buf[0] = ' '; buf[1] = 0;.
Anyway, the glue file needed
csect text,0,1,2,2
to make references to globals be A4 relative. Now when I compile
and link I get pure files which are residentable. I havn't tried
actually running it, but it should work.
-- Darren
INC=INCLUDE: #possibly compressed compiler headers
DELETE=delete #use rm for unix
AUXCFLG=-d5 #auxiliary compile flags (-d5 or -O usually)
#don't use -d4 or -d2;compiler bugs
SYMCHOICE=ADDSYM #NODEBUG or ADDSYM
# You should uncomment one of the next three lines.
# You might want CBACK for FAM and CATCHRESNR or CRES for DIO
#STARTUP=CBACK
#STARTUP=C
STARTUP=CATCHRESNR
#STARTUP=CRES
# If you use -w -rr, make this LIB:lcsr.lib
# If you use only -rr, make this LIB:lcr.lib
# If you use only -w, make this LIB:lcs.lib
# If you use neither -w nor -rr, make this LIB:lc.lib
SUPLIB=LIB:lcr.lib
CFLAGS= -i$(INC) -v -b1 -mat -rr1 -cafkrsu -q1w1e -d$(STARTUP) $(AUXCFLG)
#note that FAMgrep should always be compiled w/o stack checking (-v)
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
FAM : FAM.o memX.o MinRexx.o RexxGlue.o
-BLink <WITH <
FROM LIB:$(STARTUP).o+FAM.o+memX.o+MinRexx.o+RexxGlue.o
TO FAM
LIB $(SUPLIB)+LIB:amiga.lib
SMALLCODE SMALLDATA
# MAP t:map PLAIN
$(SYMCHOICE)
<
FAM.o : FAM.c FAM.h memX.h MinRexx.h low-mem.h
LC $(CFLAGS) -dLMS FAM.c
MinRexx.o : MinRexx.c MinRexx.h
LC -i$(INC) -b1 -mat -rr1 -cafkrsu -q1w1e $(AUXCFLG) MinRexx.c
memX.o : memX.c memX.h
LC $(CFLAGS) memX.c
RexxGlue.o : RexxGlue.a
asm -i$(INC) -d RexxGlue.a