Question about AArch64 mcmodel=large

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,


May I ask why aarch64 do not implement fPIC on large/medium code model?


Comparing with x86, where large code model PIC is implemented by "lea + movabs + add" instructions, aarch64 seems also has these instructions in its ABI (adr + add). However, under the large code model, aarch64 use LDR instruction to do the absolute relocation, which makes it not able to be dynamic linked.


I hit this problem when I am recently working on a open source project CESM, which can be compiled successfully on x86 with gcc -mcmodel=medium. When I recompile it on a aarch64 machine, I hit following error:


gptl.c:(.text+0x14): relocation truncated to fit: R_AARCH64_ADR_PREL_PG_HI21 against `.bss'
gptl.c:(.text+0x5c): relocation truncated to fit: R_AARCH64_ADR_PREL_PG_HI21 against `.bss'
gptl.c:(.text+0x1ac): relocation truncated to fit: R_AARCH64_ADR_PREL_PG_HI21 against `.bss'
...


The program can be compiled successfully with mcmodel=large. But the compiled executables cannot run because all the other depends in the open source project are PIC executables.


Thanks,
Bruce




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux