https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118844
--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by LuluCheng <chengl...@gcc.gnu.org>: https://gcc.gnu.org/g:ae14d7d04da8c6cb542269722638071f999f94d8 commit r15-7581-gae14d7d04da8c6cb542269722638071f999f94d8 Author: Lulu Cheng <chengl...@loongson.cn> Date: Wed Feb 12 14:29:58 2025 +0800 LoongArch: Fix the issue of function jump out of range caused by crtbeginS.o [PR118844]. Due to the presence of R_LARCH_B26 in /usr/lib/gcc/loongarch64-linux-gnu/14/crtbeginS.o, its addressing range is [PC-128MiB, PC+128MiB-4]. This means that when the code segment size exceeds 128MB, linking with lld will definitely fail (ld will not fail because the order of the two is different). The linking order: lld: crtbeginS.o + .text + .plt ld : .plt + crtbeginS.o + .text To solve this issue, add '-mcmodel=extreme' when compiling crtbeginS.o. PR target/118844 libgcc/ChangeLog: * config/loongarch/t-crtstuff: Add '-mcmodel=extreme' to CRTSTUFF_T_CFLAGS_S.