Michael Sokolov writes:
> Let me guess, you are using PalmOS gcc / prc-tools-0.5.0, right? There is an
> oversight in its crt0 module that looks for globals by checking for
> sysAppLaunchFlagNewGlobals but forgets about sysAppLaunchFlagSubCall, so when
> you are launched with the latter, prc-tools-0.5.0's crt0 thinks that you have
> no globals and sets A4 to 0 to indicate this.
This isn't an oversight. You wouldn't want the startup code to reinitialise
your globals for you, would you? (To be sure, there should be separate tests
for loading A4 and calling GccRelocateData(). I presume you've done this.)
Mike McCollister writes:
> Yes I am using PalmOS gcc / prc-tools-0.5.0 (Win32). Can this be fixed with
> my current version of the compiler? Is this something that can be fixed with
> the CALLBACK_PROLOGUE and CALLBACK_EPILOGUE that I have seen in some source
> code?
Yes, this is precisely the situation in which you want to use the macros in
prc-tools 0.5.0.
Michael Sokolov again:
> John Marshall's version of PalmOS gcc obtusely dodges the issue by not using A4
> at all and using A5 instead,
Actually, this problem wouldn't arise with this new version of prc-tools
at all! The OS reserves A5 for app globals and ensures that it is set
appropriately on entry to Mike's AlarmTriggered routine. To suggest that
using the register the OS gives us is an "obtuse dodge" is disingenuous.
Rather, the obtuseness is in having apps access their globals via A4,
and *requiring* the developer to manage access explicitly.
> which of course means good-bye to all the
> wonderful gcc-only features which are possible only with A4 and the reason why
> gcc developers invented A4 in the first place.
The prc-tools developers invented this use of A4 as a hack to get around
the fact that the GNU linker couldn't handle the way Palm OS arranges
globals and A5. Now it can.
But sometimes it can be useful to manage access to globals manually. Hence
the new version I have been working on includes an option `-mown-gp' to make
compiled code access globals via A4 as in the old tools.
> My code is
> almost ready to see the light of day now, I'm shooting for this weekend as the
> beta release (not a promise or a guarantee, though).
That's great. I'll be very interested to see your changes, and I'm sure we
can work together to get the facilities of both versions.
Meanwhile, for those who are interested, my code has been available for
eighteen months now at this web site:
http://homepages.enterprise.net/jmarshall/palmos/
It will be moving to somewhere at http://www.palm.com/devzone/ soon,
and will be joined by binaries for Windows and Linux and whatever else
I can get my hands on and people need. This will be happening sometime
next week.
John "simple things should be simple, and difficult things possible"