Thank you very much, I moved more functions to another code section and now my app is working again. I haven't had any problem with the linker that I can't solve adding code sections (or moving functions from one to another code section) but if I ever face this problem I will use the filter you're providing.

Thanks for your time
Miguel

Vince Lee wrote:

If the code in question actually is generating a bsr, then it's trying to do a relative jump and maybe the error is accurate. Try moving a few more functions to the new code section, as the extra overhead of calling those sections may have pushed your main code section over the edge.

The linker error I saw involved jsr calls that were correct long jumps that the 
linker was complaining about anyway.  If you run into these, try the filter 
below on the assembly files.  It changes all the calls that look like:

 jsr  OFFSET(Reg)

to:

 add  OFFSET,Reg
 jsr  (Reg)
 sub  OFFSET,Reg

Code below:

#include "stdio.h"

main( int argc, char **argv )
{
        FILE *in_fp, *out_fp;
        int c,count;
        char foo[3];
        char line[255];
        char *p1,*p2;

        if (argc==3) {

                if (in_fp=fopen(argv[1],"rb")) {
                        if (out_fp=fopen(argv[2],"wb")) {

                                while (fgets( line, 255, in_fp )) {

//
// Look for jsr label(
//
if ( line[1]=='j' && line[2]=='s' && line[3]=='r' && line[4]==' ' && ((line[5]>='a' && line[5]<='z') ||
(line[5]>='A' && line[5]<='Z') || line[5]=='_' ) &&
(p1 = strchr( line, '(' )) && (p2 = strchr( line, ')' )) ) {


                                                fprintf( out_fp, " /*\015\012  * 
Fixjump %s  */\015\012", line );

                                                *p1 = 0;
                                                *p2 = 0;

                                                fprintf( out_fp, " add.l 
#%s,%s\015\012", line+5,p1+1, line );
                                                fprintf( out_fp, " jsr 
(%s)\015\012", p1+1 );
                                                fprintf( out_fp, " sub.l 
#%s,%s\015\012", line+5,p1+1 );
                                        }
                                        else fprintf( out_fp, "%s", line );
                                }
                        }
                }

        } else {
                printf("Usage %s <infile> <outfile>");
        }
}





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

Reply via email to