On Mon, Dec 17, 2001 at 06:24:20PM +1100, Michael Glickman wrote:
> Yesterday I spent an hour with "multiapp" in attempt to understand what
> makes John Marshal so certain that you can't postpone section definitions to
> the linkage stage.

Who is this John Marshal [sic] of whom you speak?

In short, I am so certain because I wrote the code in GCC that does the
inter-section jumps on m68k-palmos.  If you want to be certain too, you
could study that code.

> So far, so good. Later I might see, that sections "bart" and "lisa"
> are small enough to fit into a single memory section. In this case
> a normal logic suggests that I simply change the script in
> the following way:
[...]
> Is this accepted by the linker ? Yes. 
> Is this accepted by build-prc ?  No!

Will this run correctly on Palm OS?  *NO*!  Therefore it is a *feature*
if it is not accepted by build-prc.

Here is the sentence from the documentation that I keep asking you to
read.  Please read it now.

        These [function section attributes] are used quite early in
        the compiler, so other ways of putting functions into different
        sections, such as '-ffunction-sections' and rearrangements at
        link time, don't work.

As explained several times in the documentation, in the current
implementation on Palm OS, when there is a call from a function foo() to
another function bar() the code emitted by the compiler is simple when
foo() and bar() are in the same section but more complex and *different*
when they are in different sections.  (Unfortunately there is currently
no support in the linker for converting between the two code sequences.)
Therefore in order to compile function calls correctly, the compiler
needs to know precisely which section bar() is in *while it is compiling
foo()*.

If you prevent the compiler from knowing this, for example by
rearranging sections behind its back, your code will crash at runtime
as soon as it calls a function in a section which you have rearranged
-- because it will jump to the wrong place.

I have explained this in the documentation, during several PalmSource
presentations (one allegedly still available on video), and in numerous
postings to this and other fora.  I'm sorry you don't like it.  But it's
a fundamental consequence of m68k-palmos GCC's current implementation of
multiple code resources.

    John

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to