InBetweenNames / gentooLTO

A Gentoo Portage configuration for building with -O3, Graphite, and LTO optimizations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

net-fs/cifs-utils fails to build with ltoize

jonesmz opened this issue · comments

x86_64-pc-linux-gnu-gcc -Wall -Wextra -D_FORTIFY_SOURCE=2 -fpie -pie -Wl,-z,relro,-z,now -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=auto -fuse-linker-plugin -march=core2 -mtune=generic -mpopcnt -Wl,-O1 -Wl,--as-needed  -Wl,-O1 -Wl,--as-needed -O3 -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=auto -fuse-linker-plugin -march=core2 -mtune=generic -mpopcnt -O2 -pipe -o mount.cifs mount.cifs.o mtab.o resolve_host.o util.o  -lcap-ng
In function ‘strlcat’,
    inlined from ‘resolve_host’ at resolve_host.c:95:4:
/usr/include/bits/string_fortified.h:167:1: error: inlining failed in call to ‘always_inline’ ‘strlcat.localalias’: function not inlinable
  167 | __NTH (strlcat (char *__restrict __dest, const char *__restrict __src,
      | ^
/usr/include/bits/string_fortified.h:174:10: note: called from here
  174 |   return __strlcat_alias (__dest, __src, __n);
      |          ^
In function ‘strlcat’,
    inlined from ‘resolve_host’ at resolve_host.c:97:3:
/usr/include/bits/string_fortified.h:167:1: error: inlining failed in call to ‘always_inline’ ‘strlcat.localalias’: function not inlinable
  167 | __NTH (strlcat (char *__restrict __dest, const char *__restrict __src,
      | ^
/usr/include/bits/string_fortified.h:174:10: note: called from here
  174 |   return __strlcat_alias (__dest, __src, __n);
      |          ^
In function ‘strlcpy’,
    inlined from ‘cifscreds_pam_update’ at pam_cifscreds.c:294:3:
/usr/include/bits/string_fortified.h:150:1: error: inlining failed in call to ‘always_inline’ ‘strlcpy.localalias’: function not inlinable
  150 | __NTH (strlcpy (char *__restrict __dest, const char *__restrict __src,
      | ^
/usr/include/bits/string_fortified.h:157:10: note: called from here
  157 |   return __strlcpy_alias (__dest, __src, __n);
      |          ^
In function ‘strlcpy’,
    inlined from ‘cifscreds_pam_add’ at pam_cifscreds.c:175:3:
/usr/include/bits/string_fortified.h:150:1: error: inlining failed in call to ‘always_inline’ ‘strlcpy.localalias’: function not inlinable
  150 | __NTH (strlcpy (char *__restrict __dest, const char *__restrict __src,
      | ^
/usr/include/bits/string_fortified.h:157:10: note: called from here
  157 |   return __strlcpy_alias (__dest, __src, __n);
      |          ^
make[3]: *** [/var/tmp/portage/net-fs/cifs-utils-7.0/temp/ccHLM2ob.mk:2: /var/tmp/portage/net-fs/cifs-utils-7.0/temp/ccjIdHyx.ltrans0.ltrans.o] Error 1
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:1487: pam_cifscreds.so] Error 1
make[2]: *** Waiting for unfinished jobs....
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /var/tmp/portage/net-fs/cifs-utils-7.0/temp/ccLNYWt8.ltrans0.ltrans.o: in function `main':
<artificial>:(.text.startup+0xb5f): warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
make[2]: Leaving directory '/var/tmp/portage/net-fs/cifs-utils-7.0/work/cifs-utils-7.0'
make[1]: *** [Makefile:986: all-recursive] Error 1
make[1]: Leaving directory '/var/tmp/portage/net-fs/cifs-utils-7.0/work/cifs-utils-7.0'
make: *** [Makefile:499: all] Error 2

Adding

net-fs/cifs-utils *FLAGS-="-flto*"
net-fs/cifs-utils *FLAGS-="${GRAPHITE}"
net-fs/cifs-utils *FLAGS-="-fdevirtualize-at-ltrans"

to package.cflags fixes it

Hit the same problem here!

I only hit this problem after upgrading gcc-12 to gcc-13.

  1. gcc-12.3.1_p20230825 building net-fs/cifs-utils-7.0: Success
  2. gcc-13.2.1_p20240113-r1 building net-fs/cifs-utils-7.0 (an --empty-tree build): Fail with the exact same message

Edit: Confirmed the solution, although the original solution is an overkill. You just need to add

net-fs/cifs-utils *FLAGS-="-flto*"

Getting rid of -flto is already enough.