[comp.unix.xenix] SCO flags

root@ozdaltx.UUCP (root) (09/05/87)

In article <1987Sep3.213949.13909@gpu.utcs.toronto.edu>, onn@gpu.utcs.toronto.edu (Brian Onn) writes:
-
-OK.  I am compiling a program under SCO XENIX 2.1.3.   The program consists
-of 38 object files.  All sources compile *clean* with 'cc -M2l -O -c ?????.c'.
-When I link them with 'cc -Ml -o file *.o -lcurses -ltermlib', what do I
-get???
-
-/bin/ld: Segment size exceeds 64K
-Input File: /lib/Llibc.a(errlst.o.c) pos: a955 Record type: 98
-
-Now I *know* that the segments exceed 64K! That is the reason why I chose
-the LARGE memory model (-Ml) in the first place!
-
-What is ld *really* trying to say here?

Try the line:
     cc -Mlt5 -LARGE -O -c xxx.c
	then
     cc -Mlt5 -LARGE -o file -l(libs)

Worked on the news programs with the addition of the flag,
-F 8000.


-- 
============================================================
| Scotty                     |  Adapt - Enjoy - Survive    |
| ihnp4!killer!ozdaltx!sysop |  "Ad Venerem Securiorem"    |
============================================================

dyer@spdcc.COM (Steve Dyer) (09/05/87)

>-What is ld *really* trying to say here?
>
>Try the line:
>     cc -Mlt5 -LARGE -O -c xxx.c
>	then
>     cc -Mlt5 -LARGE -o file -l(libs)
>
>Worked on the news programs with the addition of the flag,
>-F 8000.

I am not familiar with the 't5' part of the flags mentioned above, but
"-LARGE" simply invokes versions of the C compiler passes which are
themselves compiled in large model, for the occasional times when a
program is too big for the faster small model compiler to process.
It has no effect on the generated code.  It would have made more sense
for the compiler pass to exit with a unique exit status if this were
the case so that "cc" could invisibly invoke the large model pass, instead
of making the poor user have to choose.

The problem in a nutshell is that by default, the stack and initialized data
(your strings, other initialized variables) reside in the same segment.
If initialzed data gets too large to accomodate the stack size (either
specified or the default), you get the error from "ld" which you mentioned.
Here "errlist.o" in libc.a is an excellent example: it's all the messages
produced by "perror", and it's trying to be squeezed in.

Some folks were very helpful in describing how to get around this more
methodically a few months ago, using "xstr" and "strings" to extract
your literal strings from the code, compiling them with their own named
segment, and then linking things together.  I was never particularly
successful in this regard, perhaps because I began to run into large model
bugs/interactions in the compiled code and with some squeezing, I managed to
get my application (MH6.5) all to fit in small model.

Now I have a 386 with XENIX 386 which doesn't have ANY of these problems.
I highly recommend it if you're sick of things like this on the 286.
On the other hand, I don't know why Microsoft/SCO couldn't use a better
default on the 286 when linking programs together, so that the choices
of which segments to place data and stack (which are almost always unimportant
to the programmer) could be handled automatically.
-- 
Steve Dyer
dyer@harvard.harvard.edu
dyer@spdcc.COM aka {ihnp4,harvard,linus,ima,bbn,m2c}!spdcc!dyer