On Tue, 22 Feb 2000, John Marshall wrote:
> 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...
I just got hit by this too! (and naturally assumed it was a prc-tools 2
problem). My immediate work around (if you're not a double-E, then you
better not read any further :):
Within the file needing the external constant declarations add this
include:
#include "file_returning_const.c"
(note the .c)
and remove the "file_returning_const.c" from the Makefile.
Yuck!!! (plus it fails if there's more than one file needing to call the
external functions - in my case there's only one file).
Scott
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html