/bin/ld problem (too many segments)

Barry S. Berg barry at n0atp.UUCP
Thu Jun 9 14:01:42 AEST 1988


In article <304 at marob.MASA.COM> daveh at marob.UUCP (Dave Hammond) writes:
>
>In compiling a large program I am getting a /bin/ld error "too many segments".
>The problem seemed to go away when I combined several library archives into
>a single large archive, only to return later on. The problem can obviously
>be fixed with the CC flag -SEG nn, however I feel that this may be a kludge
                                                                      ^^^^^^^
>covering up a deeper-seated problem. So:
  SEG is a compiler kludge created by the fact that 8086/8 80286 etc have 
  limited (64K) segments for data/stack/code portions.  Rather than implement
  a simulated 32 bit work space Lattice determined to create lots of little
  (64K) segments when they developed their C compiler.  Microsoft used the
  Lattice compiler, until I believe it was their 3.0 release.  Thus they
  have carried this kludge with them.

>    2. Is there some way I can tell how many segments are being used by
>       /bin/ld in composing my program? Does /bin/ld leave segements
>       partially filled (or start new segments) based upon certain conditions ?

  Use the option to create a map file.  That map will show the segments.

>    3. The CC man page states that -SEG will take arguments from 1 to 1024.
>       What is the default which was exceed here ("too many segments") ?

  128 or 256 Segments  (Brain fade is getting very acute here :-) )

>    4. Is use of the -SEG flag common in large programs which are composed
>       of many small object files? If not, should modularity be sacrificed in
>       this case?
  That is a programmer's decision.  Each case should be considered on its
  own merits.  However, think of the person who has to maintain the code.
  After all it might be me, or worse yet -- you :-) 
----
Barry S. Berg                  	  DOMAIN: barry at n0atp.N0ATP.MN.ORG
N0ATP Packet Radio Gateway        UUCP: {...}amdahl!bungia!n0atp!barry
"Speech is civilization itself--it is silence which isolates." --Thomas Mann
"Moderation in all things, most especially moderation." --Author as yet unknown.
-- 
Barry S. Berg                  	  DOMAIN: barry at n0atp.N0ATP.MN.ORG
N0ATP Packet Radio Gateway        UUCP: {...}amdahl!bungia!n0atp!barry
"Speech is civilization itself--it is silence which isolates." --Thomas Mann
"Moderation in all things, most especially moderation." --Author as yet unknown.



More information about the Comp.unix.xenix mailing list