public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/108389] New: LTO(plugin) can not find lto-ed symbols
@ 2023-01-12 19:00 eebssk1 at godaftwithebk dot pub
  2023-01-12 19:04 ` [Bug lto/108389] " eebssk1 at godaftwithebk dot pub
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: eebssk1 at godaftwithebk dot pub @ 2023-01-12 19:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108389

            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 reference
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-libraries/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-libraries/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/libmsvcrt.a)libapi-ms-win-crt-heap-l1-1-0s00025.o
(/home/eebssk1/g/mingw-crt-build/mingw-w64-mingw-w64/build/../out/lib/libmsvcrt.a)libapi-ms-win-crt-heap-l1-1-0s00026.o
(/home/eebssk1/g/mingw-crt-build/mingw-w64-mingw-w64/build/../out/lib/libmsvcrt.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/libmsvcrt.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/libmsvcrt.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/libmsvcrt.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/libmsvcrt.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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug lto/108389] LTO(plugin) can not find lto-ed symbols
  2023-01-12 19:00 [Bug lto/108389] New: LTO(plugin) can not find lto-ed symbols eebssk1 at godaftwithebk dot pub
@ 2023-01-12 19:04 ` eebssk1 at godaftwithebk dot pub
  2023-02-18 18:16 ` eebssk1 at godaftwithebk dot pub
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: eebssk1 at godaftwithebk dot pub @ 2023-01-12 19:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108389

--- Comment #1 from eebssk1 at godaftwithebk dot pub ---
binutils version 2.39

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug lto/108389] LTO(plugin) can not find lto-ed symbols
  2023-01-12 19:00 [Bug lto/108389] New: LTO(plugin) can not find lto-ed symbols eebssk1 at godaftwithebk dot pub
  2023-01-12 19:04 ` [Bug lto/108389] " eebssk1 at godaftwithebk dot pub
@ 2023-02-18 18:16 ` eebssk1 at godaftwithebk dot pub
  2023-02-18 18:23 ` eebssk1 at godaftwithebk dot pub
  2023-02-18 19:12 ` eebssk1 at godaftwithebk dot pub
  3 siblings, 0 replies; 5+ messages in thread
From: eebssk1 at godaftwithebk dot pub @ 2023-02-18 18:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108389

--- Comment #2 from BBK <eebssk1 at godaftwithebk dot pub> ---
It truly looks like a plugin problem.
See the output

eebssk1@dEBianKb:~/a$ ~/mingw-gcc/i686-w64-mingw32/bin/i686-w64-mingw32-gcc-nm
*strnlen*
00000000 T _strnlen
eebssk1@dEBianKb:~/a$ ~/mingw-gcc/i686-w64-mingw32/bin/i686-w64-mingw32-nm
*strnlen*
00000000 b .bss
00000000 d .data
00000000 N .debug_abbrev
00000000 N .debug_aranges
00000000 N .debug_info
00000000 N .debug_line
00000000 N .debug_line_str
00000000 r .eh_frame
00000000 r .gnu.lto_.decls.65045144
00000000 r .gnu.lto_.ext_symtab.65045144
00000000 r .gnu.lto_.icf.65045144
00000000 r .gnu.lto_.inline.65045144
00000000 r .gnu.lto_.ipa_modref.65045144
00000000 r .gnu.lto_.ipa_sra.65045144
00000000 r .gnu.lto_.jmpfuncs.65045144
00000000 r .gnu.lto_.lto.65045144
00000000 r .gnu.lto_.opts
00000000 r .gnu.lto_.profile.65045144
00000000 r .gnu.lto_.pureconst.65045144
00000000 r .gnu.lto_.refs.65045144
00000000 r .gnu.lto_strnlen.4.65045144
00000000 r .gnu.lto_.symbol_nodes.65045144
00000000 r .gnu.lto_.symtab.65045144
00000000 r .rdata$zzz
00000000 T _strnlen
00000000 t .text

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug lto/108389] LTO(plugin) can not find lto-ed symbols
  2023-01-12 19:00 [Bug lto/108389] New: LTO(plugin) can not find lto-ed symbols eebssk1 at godaftwithebk dot pub
  2023-01-12 19:04 ` [Bug lto/108389] " eebssk1 at godaftwithebk dot pub
  2023-02-18 18:16 ` eebssk1 at godaftwithebk dot pub
@ 2023-02-18 18:23 ` eebssk1 at godaftwithebk dot pub
  2023-02-18 19:12 ` eebssk1 at godaftwithebk dot pub
  3 siblings, 0 replies; 5+ messages in thread
From: eebssk1 at godaftwithebk dot pub @ 2023-02-18 18:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108389

--- Comment #3 from BBK <eebssk1 at godaftwithebk dot pub> ---
Also since the libraries are built with fat objects,build the program with
-fno-lto does success.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug lto/108389] LTO(plugin) can not find lto-ed symbols
  2023-01-12 19:00 [Bug lto/108389] New: LTO(plugin) can not find lto-ed symbols eebssk1 at godaftwithebk dot pub
                   ` (2 preceding siblings ...)
  2023-02-18 18:23 ` eebssk1 at godaftwithebk dot pub
@ 2023-02-18 19:12 ` eebssk1 at godaftwithebk dot pub
  3 siblings, 0 replies; 5+ messages in thread
From: eebssk1 at godaftwithebk dot pub @ 2023-02-18 19:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108389

--- Comment #4 from BBK <eebssk1 at godaftwithebk dot pub> ---
I managed to save the /tmp/*.res file generated by plugin,and there's no such
entry mention strnlen in it.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-02-18 19:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-12 19:00 [Bug lto/108389] New: LTO(plugin) can not find lto-ed symbols eebssk1 at godaftwithebk dot pub
2023-01-12 19:04 ` [Bug lto/108389] " eebssk1 at godaftwithebk dot pub
2023-02-18 18:16 ` eebssk1 at godaftwithebk dot pub
2023-02-18 18:23 ` eebssk1 at godaftwithebk dot pub
2023-02-18 19:12 ` eebssk1 at godaftwithebk dot pub

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).