https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106270
Bug ID: 106270
Summary: [Aarch64] -mlong-calls should be provided on aarch64
for users with large applications
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: qinzhao at gcc dot gnu.org
Target Milestone: ---
Created attachment 53291
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53291&action=edit
tar ball for the small testing case
In aarch64 backend, aarch64_is_long_call_p always return FALSE by default, as a
result, direct calls (bl) are generated for all the calls.
For smaller applications, generating direct calls by default for all the calls
will have good run-time performance. However, for larger applications, When the
size of the .text section exceed some limitation, linker will fail with the
following error:
relocation truncated to fit: R_AARCH64_CALL26 against symbol
This can be showed by the attached tar ball for a small testing case:
1. download the tar ball, and untar it;
2. cd aarch64_long_call
3. update the "GCC" in "build.sh", "assemble.sh" to your own gcc (gcc 8 and
above all have the same issue).
4. sh do_all.sh
gcc -S bar.c foo.c
patching file bar.s
Hunk #1 succeeded at 21 (offset -2 lines).
gcc -c bar.s foo.s
ld: warning: cannot find entry symbol _start; defaulting to 0000000010000000
bar.o: In function `bar':
bar.c:(.text+0x10): relocation truncated to fit: R_AARCH64_CALL26 against
symbol `foo' defined in .text section in foo.o