[comp.os.minix] Compiling under MSC

brianc@cognos.uucp (Brian Campbell) (07/20/87)

     Has anyone gotten any further with using Microsoft C as a
cross-compiler for Minix?  [Are you there mmason?]  I've gotten as far
as converting all of the PCIX assembly files to a format MASM can
handle; everything else compiled without a hitch.  The problem occurs in
the linking.
     I'm working under 286 Xenix 2.1.3 with the DOS development package
(although I'm not using that -- it looks easier to convert a xenix x.out
format file to a minix a.out format than to convert from a dos
executable).
     While I can get each of fs, kernel and mm to compile and link,
there are problems.  One simple problem was the resolution of a global
variable 'M'.  There is a file 'message.c' that does nothing except
define and export this variable.  The linker I'm using doesn't resolve
references to data properly and doesn't pick up this file.  Is there any
reason why M can't be (or isn't) defined in call.c?  [In the interim I'm
specifically linking in the message.o object file].
     Another problem is with the way the linker combines segments.  I've
got all the segment names right (I think), but the linker always gets
the locations for endtext, enddata and endbss wrong -- they get stuck
somewhere near the end of their segments but not quite at the end.  The
long arithmetic routines seem to get pulled in after the _etext symbol.

     Oh ya, there was some talk about scrolling problems with Hercules
cards somewhere in the distant past.  The only fix I saw for this
problem was to change M_VID_MASK from 0FFF to 1FFF.  I tried this, and
it didn't do the trick (although it did help a little).  I'm using an
Everex Edge (HGA + CGA) that has 64k of RAM.  I tried using masks of
16k, 32k and 64k as well, but none made the problem go away.
-- 
Brian Campbell          uucp: decvax!utzoo!dciem!nrcaer!cognos!brianc
Cognos Incorporated     mail: 3755 Riverside Drive, Ottawa, Ontario, K1G 3N3
(613) 738-1440          fido: sysop@163/8

mmason@psu-cs.UUCP (Mark C. Mason) (07/30/87)

In article <1139@cognos.UUCP> brianc@cognos.uucp (Brian Campbell) writes:
>
>     Has anyone gotten any further with using Microsoft C as a
>cross-compiler for Minix?  [Are you there mmason?]  I've gotten as far

My apologies.
I'm currently swamped at both work and home, and haven't had time
to work on the cross compiler.  There appear to be several others
who have succeeded in the past 2-3 weeks, and have posted their findings.

>there are problems.  One simple problem was the resolution of a global
>variable 'M'.  There is a file 'message.c' that does nothing except
>define and export this variable.  The linker I'm using doesn't resolve
>references to data properly and doesn't pick up this file.  Is there any
>reason why M can't be (or isn't) defined in call.c?  [In the interim I'm

In most versions of MSC (including the XENIX C compiler/linker) there is
a bug whereby if a file contains nothing but an *UNINITIALIZED* declaration,
and the object file is in a library (xenix or dos), the variable won't
be visible to the linker.  The work-around is to initialize the variable
(M in this case) to something in the declaration.

>     Another problem is with the way the linker combines segments.  I've
>got all the segment names right (I think), but the linker always gets
>the locations for endtext, enddata and endbss wrong -- they get stuck

Most of my time was spent resolving this.  Someone recently posted
a description of how this should be done (but I've lost the article).

>Brian Campbell          uucp: decvax!utzoo!dciem!nrcaer!cognos!brianc
>Cognos Incorporated     mail: 3755 Riverside Drive, Ottawa, Ontario, K1G 3N3
>(613) 738-1440          fido: sysop@163/8

Mark C. Mason
...!tektronix!psu-cs!mmason
    mmason@cs.pdx.edu