Here's a bug report I just sent to Palm about a CodeWarrior linker bug - I'm
posting it here in case anyone else runs into the same problem.
-adam
----- Original Message -----
From: Adam Dingle
To: CodeWarrior Support
Sent: Monday, August 30, 1999 3:30 PM
Subject: CodeWarrior linker bug
I'm using CodeWarrior release 5 for PalmOS on Windows NT.
I found a bug in the CodeWarrior linker. When generating a multi-segment
executable, if a segment has at least one .c file assigned to it but has no code
or data, any jump to code in a following segment will fail at run time. I found
this bug because I had a single C file in a segment and all its code was
ifdef-ed out in my build.
To see the bug, create a new multi-segment project and add the following files
"main.c", "sub.c", "sub.h" and an empty file "nocode.c". Create two new
segments called "Segment 2" and "Segment 3". Assign nocode.c to Segment 2 and
sub.c to Segment 3. Now build the project. If you drop the resulting .prc into
the PalmOS Emulator, you'll see that it has code segments numbered 0, 1 and 3
but no code segment #2. If you try to run the program, the call from
PilotMain() to sub() will crash. The problem is that the function
__LoadAndRelocate__() in the MSL Runtime startup code never finds the code #3
segment because there is no code #2, so code #3's jump table entries in the A5
world never get relocated to point to the actual functions in code #3.
It would nice if this bug could be fixed for the upcoming release 6. Thanks!
-adam
[EMAIL PROTECTED]
=== main.c ===
#include <Pilot.h>
#include "sub.h"
DWord PilotMain(Word cmd, Ptr params, Word launchFlags)
{
int x = sub(4, 5);
return x;
}
=== sub.c ===
#include "sub.h"
int sub(int a, int b)
{
return a + b;
}
=== sub.h ===
int sub(int a, int b);
=== end ===