From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 608703AAB00E; Thu, 15 Jul 2021 09:42:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 608703AAB00E From: "xinliang.liu at linaro dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/101448] Use GCC 9.3.0 to build Ceph crimson-osd on Arm64, linker failed for relocation truncated to fit: R_AARCH64_CALL26 against symbol Date: Thu, 15 Jul 2021 09:42:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 9.3.0 X-Bugzilla-Keywords: link-failure X-Bugzilla-Severity: normal X-Bugzilla-Who: xinliang.liu at linaro dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 09:42:37 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101448 --- Comment #4 from Xinliang --- Looking into the relocation code[1] of ld. I'm very curious why ld can't handle long call here. [1]: ``` 2976 static enum elf_aarch64_stub_type 2977 aarch64_type_of_stub (asection *input_sec, 2978 const Elf_Internal_Rela *rel, 2979 asection *sym_sec, 2980 unsigned char st_type, 2981 bfd_vma destination) 2982 { 2983 bfd_vma location; 2984 bfd_signed_vma branch_offset; 2985 unsigned int r_type; 2986 enum elf_aarch64_stub_type stub_type =3D aarch64_stub_none; 2987 2988 if (st_type !=3D STT_FUNC 2989 && (sym_sec =3D=3D input_sec)) 2990 return stub_type; 2991 2992 /* Determine where the call point is. */ 2993 location =3D (input_sec->output_offset 2994 + input_sec->output_section->vma + rel->r_offset); 2995 2996 branch_offset =3D (bfd_signed_vma) (destination - location); 2997 2998 r_type =3D ELFNN_R_TYPE (rel->r_info); 2999 3000 /* We don't want to redirect any old unconditional jump in this way, 3001 only one which is being used for a sibcall, where it is 3002 acceptable for the IP0 and IP1 registers to be clobbered. */ 3003 if ((r_type =3D=3D AARCH64_R (CALL26) || r_type =3D=3D AARCH64_R (J= UMP26)) 3004 && (branch_offset > AARCH64_MAX_FWD_BRANCH_OFFSET 3005 || branch_offset < AARCH64_MAX_BWD_BRANCH_OFFSET)) 3006 { 3007 stub_type =3D aarch64_stub_long_branch; 3008 } 3009 3010 return stub_type; 3011 } ``` https://sourceware.org/git/?p=3Dbinutils-gdb.git;a=3Dblob;f=3Dbfd/elfnn-aar= ch64.c;h=3D097a275990f1d350be8f68943093926a5c66157a;hb=3D07f9ddfeba5b572451= 471f905473f7ddbba1d472#l2316 FYI, there is a similar bug with the same error msg: https://sourceware.org/bugzilla/show_bug.cgi?id=3D18668=