The bug is originally discovered as a fuse-2.9.9 build failure on CFLAGS="-O2 -flto" LDFLAGS="-O2 -flto -Wl,--no-undefined": https://bugs.gentoo.org/663518 I failed to extract minimal example off fuse. Attaching self-contained source tarball with a simple build script. Script tries to build with lto in 3 modes: $ ./bug2.bash Building -O1 Building -flto -O1 --param lto-partitions=1 Building -flto -O1 --param lto-partitions=2 /usr/lib/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/libbug.so.IbcCw4.ltrans0.ltrans.o: in function `mt_chan_receive': <artificial>:(.text+0x9f0d): undefined reference to `__fuse_read_cmd@' collect2: error: ld returned 1 exit status Note: only --param lto-partitions=2 triggers build failure. It's an x86_64-pc-linux-gnu gcc-9.1.1 / binutils-2.32.
Created attachment 46605 [details] gcc-lto-partition-bug.tar.gz
There are known issues with top-level inline-asm and LTO and you are running into one of those. FUSE_SYMVER(".symver fuse_setup_compat2,__fuse_setup@"); FUSE_SYMVER(".symver fuse_setup_compat22,fuse_setup@FUSE_2.2"); FUSE_SYMVER(".symver fuse_teardown,__fuse_teardown@"); FUSE_SYMVER(".symver fuse_main_compat2,fuse_main@"); FUSE_SYMVER(".symver fuse_main_real_compat22,fuse_main_real@FUSE_2.2");
It's a known limitation. *** This bug has been marked as a duplicate of bug 48200 ***