Ken Krugler <[EMAIL PROTECTED]> wrote:
> Hmm, maybe GCC doesn't support PC-relative data; I know that
> functionality was only recently added to CodeWarrior.
Just because CW was horribly broken until recently doesn't mean that
other compilers are too :-). GCC has always supported PC-relative data.
>> lea.l $4efc(a5), a0 ;base of table must be a5 + $4efc
[...]
> It also looks like the GCC build isn't using PC-relative data
> (different setting than PC-relative strings), and thus it's assuming
> that the character attribute data table is in the app's global space.
True, it is indeed accessing it via A5, as if it's in the data section.
> But in that
> case it should have added the 512 bytes to your apps global space &
> initialized it at launch time. Odd.
But it's not. The data table is in fact in the text section:
$ m68k-palmos-size libPalmOSGlue.a
text data bss dec hex filename
3636 0 0 3636 e34 TextMgr.o (ex libPalmOSGlue.a)
Very odd...
It boils down to a bug in the Palm OS GCC patches involving const data
and separate compilation. Consider the following two source files:
/* ctbl1.c */
const int t[2] = {28, 37};
int f1(int i) { return t[i]; }
/* ctbl2.c */
extern const int t[2];
int f2(int i) { return t[i]; }
Function f1 will be compiled correctly. Unfortunately, the extern const
declaration isn't enough to make the compiler realise t is in the text
section when it's compiling f2. This is a bug. I suspect it has the
same cause as the similar one Peter Eisenlohr ran into over on
pilot.programmer.gcc and will have the same fix (namely merging up to
the current mainline GCC pc-relative support). In the meantime, I fear
the only workaround is not to access const data from other compilation
units.
Prc-tools 0.5.0 also had this bug. It's amazing how noone ran into it
over the course of two or three years...
> Regardless, what I think this means is that the TxtGlueCharAttr,
> TxtGlueFindString, and TxtGlueWordBounds routines in the GCC version
> of the PalmOSGlue library are currently busted.
Yep. :-(
The good news is that Ken has found the fix for it, and with this fix
TextMgr longer exercises this bug.
John
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html