Friday, January 3, 2014

Link Error with PPP

I realize that posts about porting code must horribly boring to read. However, the boring details will hopefully help someone who attempts some similar feat of folly. As a result, I will try to post a picture or two of a Macintosh or Mac GUI element that summarizes my progress. The details of which can be read by clicking the "Read more >>" link at the bottom of the post. First installment:
16-bit addressing can only reach 32K of code.

32-bit addressing can access many more K of code!

I have enough code together to at least start compiling and testing the main parts of the lwip stack. Unfortunately, when I include the PPP module, I get an error at link time:
# Reference to "___MAIN" out of range # Segment 'CODE'(1), module "%__MAIN"… # Error: PC-relative offset of reference from code does not fit into 16 bits # Error 3011 while writing output file # Error: PC-relative offset of reference from code does not fit into 16 bits # ILink - Execution terminated!
-model far LoadSeg
32-bit address in -model far
(diagram from Apple's Mac OS Runtime Architectures)

The error is apparently because the addition of PPP puts the code segment size over 32K. The classic 68K runtime architecture uses 16-bit addressing for code and data which maxes out at 32K. MPW has a few options to overcome this, including code segment management and different jump table options.
For now, I will be using the -model far option which allows for 32-bit addressing. Not sure how compatible this will be with older Mac Systems, but it seems like the easiest solution until I can segment the code.
The result is that it builds. However, I can't test it on the G4 because I have used the oldest serial port code I could find and the G4 doesn't have serial ports that the Classic Environment can recognize. Testing on Mac SE to come!

No comments:

Post a Comment