Hi Experts,
We are using address which is more than 32 bits with for example : 0x1000000000
when comes to adrp instruction it is giving following error.:
relocation truncated to fit: R_AARCH64_ADR_PREL_PG_HI21 against symbol `__BSS_START__' defined in .bss section in
ADRP Usage:
adrp x0, __BSS_START__add x0, x0, :lo12:__BSS_START__
what could be possible solution for this?
When I tried to replace adrp and add with ldr instruction it works fine but is there any way that we can continue with adrp instruction?
LDR Usage:
ldr x0, = __BSS_START__
We are using aarch64-linux-gnu-gcc (Linaro GCC 6.2-2016.11) 6.2.1 20161016 toolchain.
we also tried with latest tool chain (aarch64-linux-gnu-gcc (Linaro GCC 7.5-2019.12) 7.5.0) but no luck.
Please help.
Regards,
Kishan Patel
Are you sure that you aren't overshooting the supported range of adrp?
Hi,
Based on https://developer.arm.com/documentation/dui0802/a/a64-general-instructions/adrp and http://shell-storm.org/armv8-a/ISA_v85A_A64_xml_00bet8_OPT/xhtml/adrp.html it supports in the range +/-4GB. The address which is I mentioned is greater than 4GB range and it should support. But It is not clear that what could be it's exact range. Can you please guild here.
Kishan
The +/- 4GB range is relative to the address of the page containing the adrp instruction. Thus, the instruction can reach 4GB above and below its own address (roughly).
Does that mean that adrp range is maximum upto 8GB? If anything higher than that will throw error.
+-----------------+ <--- page boundary | | ~ ~ 4GB area | | | | +-----------------+ <--- page boundary | | |adrp | ~ ~ 4GB area | | +-----------------+ <--- page boundary
Thank you for clarification