home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!wupost!spool.mu.edu!agate!stanford.edu!apple!goofy!mumbo.apple.com!gallant.apple.com!seuss.apple.com!user
- From: absurd@apple.apple.com (Tim Dierks, software saboteur)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: Best method of avoiding code/data segment issues
- Message-ID: <absurd-100193205931@seuss.apple.com>
- Date: 11 Jan 93 05:09:13 GMT
- References: <1993Jan9.044328.19069@gn.ecn.purdue.edu>
- Sender: news@gallant.apple.com
- Followup-To: comp.sys.mac.programmer
- Organization: MacDTS Marauders
- Lines: 55
-
- In article <1993Jan9.044328.19069@gn.ecn.purdue.edu>,
- jess@gn.ecn.purdue.edu (Jess M Holle) wrote:
- >
- > I am in the process of getting a large chunk of C++ code from a
- > UNIX workstation (SGI) to compile on the Mac. Although I have
- > not gotten everything to compile, I am getting relatively close.
- > My problem is that I want to avoid messing with code/data
- > segmentation issues as much as possible.
- >
- > What is the best way to do this? -model far? -br? -bigseg? How
- > much do any of these affect code-size/performance (not too
- > important)? Any bugs/incompatibilities to watch for?
- >
- > If it matters any, the final link will be based on a half dozen
- > libraries. Some of these have been placed in named segments, but
- > most haven't and I'd rather not bother if I don't have to.
- >
- > Thanks a lot (this newsgroup is a BIG help, thanks to all of you).
- >
- >
- > Jess Holle
-
- -model far will remove almost all 16-based limitations from your
- MPW code. I believe structures larger than 32K and local variables
- larger than 32K are not allowed, but I may be incorrect. If you
- want everything to go into one segment, you can do so by adding
- "-sg Main" to your link command; this merges all segments into
- the Main segment; if your code doesn't actually ever unload a
- segment, this is probably better than loading a number of
- segments and leaving them loaded.
-
- 32-bit everything degrades performance to a certain degree, although
- this can be reduced somewhat by restricting your code to running
- on 68020s or better; the 68000 doesn't have some useful 32-bit
- offset addressing modes, so some 32-bit addressing has to be done
- manually on the 68000; removing it as a destination makes more
- efficient constructs possible.
-
- If you're only going to run on >= 68020, then -bigseg can help create
- large code segments, but all your external entry points must be in
- the first 32K because the jump table is still just 16-bit. There
- should be little if any performance impact, because this is done
- entirely with a processor addressing mode.
-
- -br will allow you large code resources on any processor; once again,
- all external references must be in the first 32K. Jump islands
- make long jumps slightly slower, but not greatly so.
-
- In summary, -model far is the only complete solution, but -br or
- -bigseg impact your code a little less and can be useful. I don't
- know of any significant show-stopping problems with any of these
- options.
-
- Tim Dierks
- MacDTS, but I speak for myself
-