I’m working on the getting the next release of C-Kermit:
http://www.columbia.edu/kermit/ckermit.html
ready for release and am running into major roadblocks in QNX. Briefly:
The previous release, 7.0, worked fine. The new release has some new
features (e.g. a built-in scriptable FTP client) that make the program
considerably larger:
$ ls -l kermit
-rwxrwxr-x 1 fdc users 1768025 Nov 30 13:34 kermit
$ size kermit
text data bss decimal hex
1525104 242163 650781 2418048 24e580 kermit
$
The new version builds successfully and works fine on most platforms –
Linux, FreeBSD, Solaris, SunOS, HP-UX, AIX, IRIS, Tru64, SCO, VMS, etc.
In QNX 4.24 and 4.25 it compiles and links without complaint, but
totally misbehaves at runtime. Many of Kermit’s commands result in:
C-Kermit> type foo.txt
5/home/fdc/kermit/kermit terminated (SIGSEGV) at 0007:00095184.
%1 17074 Memory fault ./kermit
$
This generally occurs at the point at which a function is being called.
It is the very call itself that causes the memory fault, not any code
inside the function.
Since the same code works as expected on other platforms, and the
previous release worked on QNX, the most likely explanation is that the
growth in size has exceeded some assumptions that are made by the
compiler and/or linker, and/or the options that are used in the build.
The QNX makefile target was contributed by somebody long ago and it
“just worked” – I never bothered to try to decipher it:
qnx32:
$(MAKE) xermit “LNKFLAGS = -3r” “CFLAGS = -ms -3r … -Oatx …”
“LIBS= -lsocket -lncurses -ltermcap”
As soon as I took a look, I was shocked to find “-ms” (small – i.e. 64K
– memory model). Well, that would explain it! I changed it to -mf
and, surprisingly, it made no difference. Ditto for -ml.
OK, what else? Another option was “-3r”. Changing this to “-3s” made
no difference either. Nor did adding “-r” or “-sg”. The only other
option I could imagine that might have anything to do with all this was
“-zt” (data threshold), but trying different values had no effect either.
I’m stumped. The compiler is Watcom 10.6. Can anybody offer a clue?
- Frank