Monday, 24 August 2020

Re: [gccsdk] Relocation issues when trying to link larger executables

On 24/08/2020 19:58, Cameron Cawley wrote:
> Hi
>
> A long time issue with ScummVM on RISC OS is that it fails to link when
> building with too many engines enabled with errors like the ones below.
> Some of these are fixed when building ScummVM with -mlong-calls, however
> there are still relocation errors involving crt and UnixLib code. Is
> there any way of building GCCSDK as a whole using -mlong-calls or
> something similar?
>
> Regards
> Cameron
>
> /home/cameron/gccsdk/cross/lib/gcc/arm-unknown-riscos/4.7.4/crtbegin.o:
> In function `deregister_tm_clones':
> crtstuff.c:(.text+0x2c): relocation truncated to fit: R_ARM_PC24 against
> symbol `__rt_stkovf_split_small' defined in .text section in

I had the same problem with the WebKit shared library. It was so big
that the branches for the stack overflow were too far away from their
target. That was one of the reasons why when I ported GCC 8 and now GCC
10 I didn't use the chunked stack. Instead, they use page faults to
detect when to extend the stack, much like Linux does. GCC 10 is at
autobuilder/develop/gcc if you want to give that a try.

Alternatively, you could try dynamically linking it to divide it up
and reduce the executable size.

Also, if the main program code is C++, you may want to try compiling
without embedded function names as they can take up a lot of space.
Compiling without may reduce the executable size below the relocation
overflow threshold.

I don't think compiling with -mlong-calls will have much effect on
the stack overflow code as I believe the relevant instructions are
injected into the instruction stream without taking this option in
to account. I think the most the compiler can do is move them about
for optimising purposes, but it can't change them.

Lee.

_______________________________________________
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK

No comments:

Post a Comment