https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119386
--- Comment #32 from Ard Biesheuvel <ardb at kernel dot org> --- Franz, given that you are building your own compiler, mind checking whether the below fixes the issue for you? --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -23154,6 +23154,8 @@ if (flag_nop_mcount || !strcmp (target, "nop")) /* 5 byte nop: nopl 0(%[re]ax,%[re]ax,1) */ fprintf (file, "1:" ASM_BYTE "0x0f, 0x1f, 0x44, 0x00, 0x00\n"); + else if (flag_pic && flag_plt) + fprintf (file, "1:\tcall\t%s@PLT\n", target); else fprintf (file, "1:\tcall\t%s\n", target); } @@ -23317,7 +23319,7 @@ break; case CM_SMALL_PIC: case CM_MEDIUM_PIC: - if (!ix86_direct_extern_access) + if (!flag_plt) { if (ASSEMBLER_DIALECT == ASM_INTEL) fprintf (file, "1:\tcall\t[QWORD PTR %s@GOTPCREL[rip]]\n",