ADC Home > Reference Library > Technical Q&As > Legacy Documents > Mac OS 9 & Earlier >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

NOTE: This Technical Q&A has been retired. Please see the Technical Q&As page for current documentation.

Code Resources Larger Than 32K


Q: I'm trying to write a 4D external (stand-alone code) which will be larger than 32K. When I compile my C code with model -far, the linker tells me:

### Link: Error: Linker does not edit 32-bit instructions. (Error 29)

Q: Is there an example showing a MPW generated >32K standalone code resource?

A: Model far works by patching parts of the segment loading mechanism, changing the structure of jump table entries, and storing segment relocation information for the generation of absolute addresses. This only applies to applications, however, which is why the Linker is generating an error.

The restriction in creating >32K CODE resources is only because of limitations with intra-segment branching. Depending on the compiler options you use, this can be worked around. For example, the MPW C compiler has the -bigseg option, which creates one big CODE resource with all function calls within the same segment to be BSR.L instruction. Since BSR.L is a PC-relative instruction with a 32-bit offset, the 32K restriction is eliminated. (However, these code resources will only work on Macintoshes with 68020s or later).

Another option you can use with the MPW Linker is -br on. This creates branch islands that are less than 32K apart for overall jumps within a CODE resource that are greater than 32K. This method has the advantage of being able to work on 68000 Macintoshes, but it can make your code larger and slower.

To find out more about both options, we suggest looking through the MPW Command Reference under C and Linker. In addition, check out the Runtime Architecture chapter in "Building Programs with MPW," available with MPW.

Unfortunately, there aren't any samples showing how these samples are used, but it should be just a matter of adding options to your MakeFile.

[May 01 1995]


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.