From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 68C4A3858C74; Thu, 12 Jan 2023 19:00:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 68C4A3858C74 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673550056; bh=kD+XRVOVze7V/CkiInyzgBNa2amTEaS9yt9cXmp8Frc=; h=From:To:Subject:Date:From; b=i2BHdFzOwFSvVqGbYDWWYtaajDZ0sUdCLdItm6vI7KH8oMgbqQaIF1luSYfhAfZsz beJE4xYW6HPKLt3UUI1RiiBVNR6dLfBJSzoMTkIsx/+HpL/XRoyriimiTyEIzB11Zj ftmuzgkr4eShKqLrj4DZVWG63ou93hlZbpDPP37o= From: "eebssk1 at godaftwithebk dot pub" To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/108389] New: LTO(plugin) can not find lto-ed symbols Date: Thu, 12 Jan 2023 19:00:55 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: lto X-Bugzilla-Version: 12.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: eebssk1 at godaftwithebk dot pub 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108389 Bug ID: 108389 Summary: LTO(plugin) can not find lto-ed symbols Product: gcc Version: 12.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: eebssk1 at godaftwithebk dot pub CC: marxin at gcc dot gnu.org Target Milestone: --- I had compiled mingw32 crt with LTO on (fat objects enabled to maintain compability). However when I trying to compile a dll(also with lto),I got undefined refer= ence at final linking. like: /home/eebssk1/mingw32/x86_64-w64-mingw32/bin/../lib/gcc/x86_64-w64-mingw32/= 12.2.1/../../../../x86_64-w64-mingw32/bin/ld: /tmp/ccImpF6y.ltrans0.ltrans.o: in function `pthread_once': /home/eebssk1/g/mingw-crt-build/mingw-w64-mingw-w64/build/../mingw-w64-libr= aries/winpthreads/src/thread.c:762: undefined reference to `fprintf' /home/eebssk1/mingw32/x86_64-w64-mingw32/bin/../lib/gcc/x86_64-w64-mingw32/= 12.2.1/../../../../x86_64-w64-mingw32/bin/ld: /tmp/ccImpF6y.ltrans0.ltrans.o: in function `_amsg_exit': /home/eebssk1/g/mingw-crt-build/mingw-w64-mingw-w64/build/mingw-w64-crt/../= ../mingw-w64-crt/crt/ucrtbase_compat.c:106: undefined reference to `fprintf' /home/eebssk1/mingw32/x86_64-w64-mingw32/bin/../lib/gcc/x86_64-w64-mingw32/= 12.2.1/../../../../x86_64-w64-mingw32/bin/ld: /tmp/ccImpF6y.ltrans0.ltrans.o: in function `rwl_print': /home/eebssk1/g/mingw-crt-build/mingw-w64-mingw-w64/build/../mingw-w64-libr= aries/winpthreads/src/rwlock.c:139: undefined reference to `printf' from verbose ld: (/home/eebssk1/g/mingw-crt-build/mingw-w64-mingw-w64/build/../out/lib/libms= vcrt.a)libapi-ms-win-crt-heap-l1-1-0s00025.o (/home/eebssk1/g/mingw-crt-build/mingw-w64-mingw-w64/build/../out/lib/libms= vcrt.a)libapi-ms-win-crt-heap-l1-1-0s00026.o (/home/eebssk1/g/mingw-crt-build/mingw-w64-mingw-w64/build/../out/lib/libms= vcrt.a)lib64_libucrt_extra_a-ucrt_vfprintf.o: no new IR symbols to claim (/home/eebssk1/g/mingw-crt-build/mingw-w64-mingw-w64/build/../out/lib/libms= vcrt.a)lib64_libucrt_extra_a-ucrt_vfprintf.o: no new IR symbols to claim (/home/eebssk1/g/mingw-crt-build/mingw-w64-mingw-w64/build/../out/lib/libms= vcrt.a)lib64_libucrt_extra_a-ucrt_printf.o: no new IR symbols to claim (/home/eebssk1/g/mingw-crt-build/mingw-w64-mingw-w64/build/../out/lib/libms= vcrt.a)lib64_libucrt_extra_a-ucrt_printf.o: no new IR symbols to claim (/home/eebssk1/g/mingw-crt-build/mingw-w64-mingw-w64/build/../out/lib/libms= vcrt.a)lib64_libucrt_extra_a-ucrt_fprintf.o: no new IR symbols to claim These objects really have lto-ed reference indeed. lib64_libucrt_extra_a-ucrt_printf.o: U __acrt_iob_func 0000000000000000 b .bss 0000000000000000 d .data 0000000000000000 d .data$__imp_printf 0000000000000000 N .debug_abbrev 0000000000000000 N .debug_aranges 0000000000000000 N .debug_frame 0000000000000000 N .debug_info 0000000000000000 N .debug_line 0000000000000000 N .debug_line_str 0000000000000000 r .gnu.lto_.decls.c11a8587d357cea5 0000000000000000 r .gnu.lto_.ext_symtab.c11a8587d357cea5 0000000000000000 r .gnu.lto_.icf.c11a8587d357cea5 0000000000000000 r .gnu.lto___imp_printf.120.c11a8587d357cea5 0000000000000000 r .gnu.lto_.inline.c11a8587d357cea5 0000000000000000 r .gnu.lto_.ipa_modref.c11a8587d357cea5 0000000000000000 r .gnu.lto_.ipa_sra.c11a8587d357cea5 0000000000000000 r .gnu.lto_.jmpfuncs.c11a8587d357cea5 0000000000000000 r .gnu.lto_.lto.c11a8587d357cea5 0000000000000000 r .gnu.lto_.opts 0000000000000000 r .gnu.lto_printf.119.c11a8587d357cea5 0000000000000000 r .gnu.lto_.profile.c11a8587d357cea5 0000000000000000 r .gnu.lto_.pureconst.c11a8587d357cea5 0000000000000000 r .gnu.lto_.refs.c11a8587d357cea5 0000000000000000 r .gnu.lto_.symbol_nodes.c11a8587d357cea5 0000000000000000 r .gnu.lto_.symtab.c11a8587d357cea5 0000000000000000 D __imp_printf 0000000000000000 p .pdata 0000000000000000 T printf 0000000000000000 r .rdata$zzz U __stdio_common_vfprintf 0000000000000000 t .text 0000000000000000 r .xdata If I manually extract these objects and append them at compiler commandline, then the final linking successed. It looks like the gcc lto plugin does not want to handle them. The problem is persist both on linux cross compiling environment and windows msys2 environemnt.=