Rockbox Technical Forums

Rockbox Development => Starting Development and Compiling => Topic started by: cynric on February 28, 2007, 04:10:17 PM

Title: relocation truncated to fit -> error when compiling mod.c for IPodmini2g
Post by: cynric on February 28, 2007, 04:10:17 PM
Hi!
I used to build my own svn build for my ipod mini 2g (using the vmware image) with the greyscale ipod lcd fix and the .mod codec (http://www.rockbox.org/tracker/task/5241) (0.13). but since i had to update the vmware image i get the following errors at compiling mod.c:
Code: [Select]
CC mod.c
LD mod.elf
/home/user/rbx/RockboxSvn/rockbox_patched_svn/built/apps/codecs/mod.o: In function `codec_main':
mod.c:(.text+0xbc): relocation truncated to fit: R_ARM_PC24 against `.icode'
mod.c:(.text+0x1c0): relocation truncated to fit: R_ARM_PC24 against `.icode'
collect2: ld returned 1 exit status
make[2]: *** [/home/user/rbx/RockboxSvn/rockbox_patched_svn/built/apps/codecs/mod.elf] Error 1
rm /home/user/rbx/RockboxSvn/rockbox_patched_svn/built/apps/codecs/codec_crt0.o
make[1]: *** [build-codecs] Error 2
make: *** [all] Error 2
without the .mod codec everything works fine...
also for other platforms, compiling works (tested for h120).

how can i get this to work again?

thanks!
Title: Re: relocation truncated to fit -> error when compiling mod.c for IPodmini2g
Post by: bluebrother on February 28, 2007, 05:13:42 PM
this error message looks like an outdated compiler -- which version are you using?
(try arm-elf-gcc --version) You should at least have 4.0.3 (and IIRC the vmware image was outdated at some time, but I might be wrong at this).
Title: Re: relocation truncated to fit -> error when compiling mod.c for IPodmini2g
Post by: cynric on February 28, 2007, 05:29:36 PM
4.0.3. just trying a dist-upgrade, see if that helps...
Title: Re: relocation truncated to fit -> error when compiling mod.c for IPodmini2g
Post by: cynric on February 28, 2007, 06:06:11 PM
no luck, same error..
Title: Re: relocation truncated to fit -> error when compiling mod.c for IPodmini2g
Post by: Llorean on February 28, 2007, 06:32:06 PM
If it compiles fine without the patch, I would suggest asking the patch author.
Title: Re: relocation truncated to fit -> error when compiling mod.c for IPodmini2g
Post by: cynric on February 28, 2007, 08:28:14 PM
the strange thing is however, that from the same patched sources i can successfully compile a build for another system (h120)..
i just tried the previous patches, which downto 0.11 all result in the same error; 0.10 and below were before some larger changes in svn and cannot be used anymore. however i am sure to have built a mini2g version with v0.10 on 070204.
So either the patch is broken only for certain platforms or there must be some changes done for the compiler command (maybe certain optimzations?)...

i will take a look at the codechanges from v.10 to .11 tomorrow, maybe i can figure something out from that...
Title: Re: relocation truncated to fit -> error when compiling mod.c for IPodmini2g
Post by: Llorean on February 28, 2007, 08:38:42 PM
Yes, but H120 uses a different version of GCC entirely. Try a Gigabeat build, and I suspect you'll encounter the same trouble. Or any iPod Build.
Title: Re: relocation truncated to fit -> error when compiling mod.c for IPodmini2g
Post by: cynric on March 01, 2007, 05:08:57 AM
gigabeat works, ipods fail (tested photo, video, 4g, both minis).  is there a way to disable platform specific optimization for one .c file and compile in a kind of safe mode?
Title: Re: relocation truncated to fit -> error when compiling mod.c for IPodmini2g
Post by: nls on March 01, 2007, 09:53:41 AM
You must replace "static" before any functions in iram with "STATICIRAM" to make this work after some changes by amiconn on feb 17

Functions in iram are those followed by ICODE_ATTR in the declaration.

for example:
static void UpdateNote(void) ICODE_ATTR;
static void UpdateNote(void) {

would become:
STATICIRAM UpdateNote(void) ICODE_ATTR;
STATICIRAM void UpdateNote(void) {
Title: Re: relocation truncated to fit -> error when compiling mod.c for IPodmini2g
Post by: cynric on March 01, 2007, 10:20:39 AM
wow, thanks alot, nls. now it compiles and plays fine again!