VBRANDT@DBNUAMA1.BITNET (09/03/88)
Hello all, ... while rereading the last few digests I came across the discussion on program loading and relocating. Please tell me if I understood correctly: When I have a program that does not use absolute addresses (ie. the relocate flag in the program header is turned off), the following things happen: - The program file is left open, the handle is 'used up'. - The BSS is not cleared (what could there be in it?) Do these problem remain in the current 'blitter' TOS ? What side effects do they have (aside from GEMDOS possibly running out of file handles or the BSS containing garbage) ? I'm interested in this since I usually take care to keep all my assembler programs position-independent. Any and all info is welcome. Bitnet: VBRANDT@DBNUAMA1 Volker A. Brandt UUCP: ...!unido!DBNUAMA1.bitnet!vbrandt Angewandte Mathematik ARPAnet: VBRANDT%DBNUAMA1.BITNET@CUNYVM.CUNY.EDU (Bonn, West Germany)
t68@nikhefh.hep.nl (Jos Vermaseren) (09/05/88)
What you have been doing is setting the 'no-relocation' word in the program header (bytes 26 and 27 in the program file). When this word is nonzero closing the file and clearing the bss are skipped. The old program relmod.ttp (or relmod.prg) messed things up, because it didn't recognize fully relocatable programs. The first entry in the relocation table should be a long and if there is no more relocation the relocator expects a zero (byte). Your problem is solved if you zero the relocation word in the job header and make sure that the relocation table at the end of your program is a long zero. As far as I understand from earlier postings of Allan Pratt he has fixed things. He mentioned the problem specifically. By the way: it is not only relmod that made this mistake, there are other, even brand new programs that have the same mistake. So it seems to me that the most intelligent response of the loader to a relocation table with only one byte would be to skip relocation if this byte is zero, but don't give an error message. There is a Pascal compiler (Kettler TeX was done with it) that even forgets the zero at the end of the relocation table. Amazingly enough the loader doesn't crash on it, it thinks that everything is fine. I guess that Allan Pratt knows about this though. Jos Vermaseren T68@nikhefh.hep.nl