https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94236
Bug ID: 94236 Summary: -mcmodel=large does not work on aarch64 Product: gcc Version: 9.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: baratharon at caesar dot elte.hu Target Milestone: --- Hello, If I compile an object file with -mcmodel=large, then the compiler produces short jumps to the function. I see R_AARCH64_CALL26 relocation in the object file (via readelf), but I'd expect R_AARCH64_ABS64 or something equivalent like R_AARCH64_MOVW_UABS_G0 (and their friends). The CALL26 is not the right relocation in there. For example, on x86_64, I get R_X86_64_64 relocation there, which is correct. On armv7, I get R_ARM_MOVT_ABS and R_ARM_MOVW_ABS_NC, which is also correct. See resources below. TIA, Aron $ cat a.c int func(void); int main() { return func(); } $ aarch64-linux-gnu-gcc -static -fno-pie -fno-pic -mcmodel=large -c a.c $ aarch64-linux-gnu-objdump -D a.o | grep func 8: 94000000 bl 0 <func> $ aarch64-linux-gnu-readelf -a a.o | grep func 000000000008 000b0000011b R_AARCH64_CALL26 0000000000000000 func + 0 11: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND func $ aarch64-linux-gnu-gcc -v Using built-in specs. COLLECT_GCC=aarch64-linux-gnu-gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/9.2.0/lto-wrapper Target: aarch64-linux-gnu Configured with: /build/aarch64-linux-gnu-gcc/src/gcc-9.2.0/configure --prefix=/usr --program-prefix=aarch64-linux-gnu- --with-local-prefix=/usr/aarch64-linux-gnu --with-sysroot=/usr/aarch64-linux-gnu --with-build-sysroot=/usr/aarch64-linux-gnu --with-native-system-header-dir=/include --libdir=/usr/lib --libexecdir=/usr/lib --target=aarch64-linux-gnu --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-nls --enable-languages=c,c++,fortran --enable-shared --enable-threads=posix --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib --disable-werror --enable-checking=release Thread model: posix gcc version 9.2.0 (GCC) $ uname -a Linux ****** 4.18.14-arch1-1-ARCH #1 SMP PREEMPT Sat Oct 13 13:42:37 UTC 2018 x86_64 GNU/Linux