[comp.os.minix] Cross Compilation

kent@ncoast.UUCP (Kent Williams) (07/29/87)

Status Report on Cross Compilation:

Well I gave up on the Datalight Compiler for the moment, and moved on
to the Aztec C Compiler.  I now have 1.2 working on an AT with a
kernel compiled and linked with the Aztec Compiler and the Microsoft
Linker.

The conversion was eased by the fact that Aztec's Dos Linker support
is implemented by 'faithfully duplicating' ;-) the C86 runtime
orginization, down to segment and group names.

Problems:

1. Truncated names, and inconsistent capitalization:
The C86, Minix and PC/IX compilers all truncate at 8 characters.
Several of the publics in the assembly source files are truncated,
which is a problem if the compiler and linker you're using support
long names (which is the case for Aztec and MS-Link).  In addition,
the C86 generates all upper-case symbol names, whereas I like to use
/NOIGNORECASE on my links -- makes it so the maps don't appear to be
shouting at me!
Solution:
Link, Edit, Link, Edit.  A particular boner was in at_wini.c where
init_params() is called from main() as 'init_param(),' which I suppose
slid right by MINIX, PC-IX, et al.

2. Munged labels in klib88.asm:
Down in the TTY output routines, there are some screwed up labels, and
vid6: is missing entirely.
Solution:
Look it up in the book and DWIM, instead of what's written there.  I
also took out the LOCK NOP business -- it isn't needed unless you're
running on a VAX.

3. Missing portw_in and portw_out in klib88.asm:
Solution: Put them there.

4. Missing wini functions in mpx88.asm:
Solution: Put them there. 

5. Broken Winchester Driver:
All calls for access to the wini were returning EOF.
Solution:
A curious usage in at_wini.c brought out a latent bug in the compiler:
It seems that the Aztec Compiler pukes when confronted with 'register
structs.' and doesn't do the proper thing.
Solution:

swap(first, second)
register struct wini *first, *second;
{
#ifdef ORIGINAL
	register struct wini tmp;
	tmp = *first;
	*first = *second;
	*second = tmp;
#else /* ORIGINAL */
	struct wini tmp;
	memcpy(&tmp,first,sizeof(struct wini));
	memcpy(first,second,sizeof(struct wini));
	memcpy(second,&tmp,sizeof(struct wini));
#endif /* ORIGINAL */
}

The kernel size dropped > 6K when compiled with the Aztec Compiler,
which, despite its shortcomings, still generates some of the most
compact code around.

-- 
Kent Williams
  {{harvard,mit-eddie}!necntc,well!hoptoad,sun!cwruecmp!hal}!ncoast!kent
ARPA: necntc!ncoas!kent@harvard.harvard.e