mips - Using GNU ld, how can I force the address of a specific (external) symbol without getting a "relocation truncated" error? -


i have 2 functions, a() , b(), both have specific, fixed load/run-time addresses. compiling a() myself, while b() provided (e.g. in rom).

the file a.c follows:

extern void b(void);  void a(void) {     b(); } 

this generates following assembly code:

00000000 <a>:    0:   08000000       j 0 <a>                        0: r_mips_26 b    4:   00000000       nop 

so it's putting 26-bit relocation b() there (the target of call 26-bit offset address of call instruction itself). let's specific addresses of a , b 0x80001000 , 0x80002000, respectively. should fine; b within reach of a.

so in linker script, have this:

sections {     = 0x80001000;     b = 0x80002000;      .text : at(0x80000000) {         *(.text)     } } 

however, linking a.o script gives me following error:

a.o: in function 'a': (.text+0x0): relocation truncated fit: r_mips_26 against `b` 

presumably, because linker trying fit full 32-bit value (0x80002000) 26-bit space target of jump. what's wrong linker script?


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -