This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ARM thumbmode architecture question


Hi,

I compiled and linked an application for ARM in thumbmode:

   -Werror  -Wall -Wmissing-prototypes -fstrict-aliasing -Wall
   -mthumb -mthumb-interwork -mlittle-endian -msoft-float -pipe
   -mcpu=arm920t -fshort-enums -mstructure-size-boundary=8 -ggdb
   -nostdlib .... [many libs] lib_gcc_gnu/libgcc.a

The application size increased, exeeded 4 MB (working) and
finally around 4 MB and I ended up with the linker error
"relocation truncated to fit: R_ARM_THM_PC22":

   relocation truncated to fit: R_ARM_THM_PC22
   against symbol `_call_via_r4' defined in .text section in
   /tmp/x/lib_gcc_gnu/libgcc.a(_call_via_rX.o)
   ../../../../../myfile.c:238: relocation truncated to fit: R_ARM_THM_PC22
   against symbol `_call_via_r3' defined in .text section in
   /tmp/x/lib_gcc_gnu/libgcc.a(_call_via_rX.o)
   [more similar errors, depending on my #defines/my code various
   symbols from various source files]

I tried using the GCC option `-mlong-calls' but it did not help,
I got similar errors (various `relocation truncated to fit').

It works when I compile in ARM instruction set mode (-marm):

   -Werror  -Wall -Wmissing-prototypes -fstrict-aliasing -Wall
   -marm -mthumb-interwork -mlong-calls -mapcs -mlittle-endian
   -msoft-float -pipe -mcpu=arm920t -fshort-enums
   -mstructure-size-boundary=8 -ggdb

but for the price of 20% more code (and people reported specific
strange problems remote debugging with gdb if -marm was used).

Someone told me that the maximum limit for code in ARM thumb mode
is 4 MB and there would be nothing someone could do against (and
thus, `-mlong-calls' cannot have any effect) and this would be an
ARM architecture limitation.

Is this correct?

I searched the internet and read about `trampolines' and the
general possibility to have small wrapper functions in ARM code
able to execute very long calls (gigabyte range).
Compilers/linkers could theoretically automatically use such
"wrappers". This information is in contrast to the previous one.

How is it correct? Where can I learn more?

I have to state that I tried a very old gcc version (3.4.3) but
since I was told that my problem would be a architectural
systematic limitation of ARM thumb mode, I did not try a newer
version.

Any help appreciated!


Best regards,
Steffen


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]