I have a project that compiles to about 30KB, so it takes a while to load to my 8051. I'm trying to fix a small part, so I commented-out most of my main() routine. The linker now warns me and says it won't include the uncalled segments, (good,) but then it says I've run out of PDATA space for many of the functions that remain, (bad.) I'm using the Compact memory model. When I don't comment-out these function calls, the whole project links correctly. Is this strange behavior, or am I missing something obvious? Thanks.
Overlaying considers all the segments in the call tree. When you don't comment out any code, the linker can build a complete call tree for your program. And, overlay analysis includes all the segments (function data). When you comment out the code, the linker warns you about uncalled segments and tells you that they will not be considered for overlay analysis. Since the linker doesn't know who calls these functions it assumes that their data segments cannot be overlayed. And, you run out of memory faster. My suggestion would be to use #IFDEF to ifdef out the functions and the calls to them. This avoids this kind of problem. Note that there are LOTS of threads about this issue. Search by the error message in the forum and in the knowledgebase for other suggestions and tips. Jon