Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 544654 - sys-devel/gcc-4.9.2 does not install liblto_plugin.so where it can be automatically used by binutils
Summary: sys-devel/gcc-4.9.2 does not install liblto_plugin.so where it can be automat...
Status: RESOLVED DUPLICATE of bug 494228
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-27 12:54 UTC by Jan Fikar
Modified: 2015-03-31 06:16 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Fikar 2015-03-27 12:54:54 UTC
I was playing with the unsupported (is it still?) -flto CFLAG and saw a lot of compilation breakages. It seems that there is a very easy fix for many of them.

It is enough to put the plugin build by gcc in a place, where ld sees it by:

mkdir -p /usr/x86_64-pc-linux-gnu/binutils-bin/lib/bfd-plugins
ln -s /usr/libexec/gcc/x86_64-pc-linux-gnu/4.9.2/liblto_plugin.so /usr/x86_64-pc-linux-gnu/binutils-bin/lib/bfd-plugins/

I'll demonstrate the problem on gzip package.

More details e.g.:
http://marxin.github.io/posts/gentoo-linux-packages-with-gcc-4-dot-9-lto

I have sys-devel/binutils-2.25 and it is fine.

Reproducible: Always

Steps to Reproduce:
1. place -flto in CFLAGS and LDFLAGS in /etc/portage/make.conf
2. emerge --oneshot gzip

Actual Results:  
....
  CC       glthread/lock.o
  AR       libgzip.a
BFD: c-ctype.o: plugin needed to handle lto object
BFD: c-strcasecmp.o: plugin needed to handle lto object
BFD: c-strncasecmp.o: plugin needed to handle lto object
BFD: cloexec.o: plugin needed to handle lto object
BFD: close-stream.o: plugin needed to handle lto object
BFD: closein.o: plugin needed to handle lto object
BFD: closeout.o: plugin needed to handle lto object
BFD: opendir-safer.o: plugin needed to handle lto object
BFD: dirname-lgpl.o: plugin needed to handle lto object
BFD: basename-lgpl.o: plugin needed to handle lto object
BFD: stripslash.o: plugin needed to handle lto object
BFD: exitfail.o: plugin needed to handle lto object
BFD: creat-safer.o: plugin needed to handle lto object
BFD: open-safer.o: plugin needed to handle lto object
BFD: fd-hook.o: plugin needed to handle lto object
BFD: filenamecat-lgpl.o: plugin needed to handle lto object
BFD: freading.o: plugin needed to handle lto object
BFD: gettime.o: plugin needed to handle lto object
BFD: localcharset.o: plugin needed to handle lto object
BFD: glthread/lock.o: plugin needed to handle lto object
BFD: math.o: plugin needed to handle lto object
BFD: openat-die.o: plugin needed to handle lto object
BFD: printf-frexp.o: plugin needed to handle lto object
BFD: printf-frexpl.o: plugin needed to handle lto object
BFD: quotearg.o: plugin needed to handle lto object
BFD: save-cwd.o: plugin needed to handle lto object
BFD: savedir.o: plugin needed to handle lto object
BFD: stat-time.o: plugin needed to handle lto object
BFD: glthread/threadlib.o: plugin needed to handle lto object
BFD: timespec.o: plugin needed to handle lto object
BFD: unistd.o: plugin needed to handle lto object
BFD: dup-safer.o: plugin needed to handle lto object
BFD: fd-safer.o: plugin needed to handle lto object
BFD: pipe-safer.o: plugin needed to handle lto object
BFD: utimens.o: plugin needed to handle lto object
BFD: wctype-h.o: plugin needed to handle lto object
BFD: xmalloc.o: plugin needed to handle lto object
.....
  GEN      zmore
  GEN      znew
  AR       libver.a
BFD: version.o: plugin needed to handle lto object
BFD: version.o: plugin needed to handle lto object
  CCLD     gzip
/var/tmp/portage/app-arch/gzip-1.6/temp/ccj4A3N3.ltrans0.ltrans.o: In function `progerror.lto_priv.43':
ccj4A3N3.ltrans0.o:(.text+0x28): undefined reference to `rpl_fprintf'
/var/tmp/portage/app-arch/gzip-1.6/temp/ccj4A3N3.ltrans0.ltrans.o: In function `license':
ccj4A3N3.ltrans0.o:(.text+0x5a): undefined reference to `Version'
ccj4A3N3.ltrans0.o:(.text+0x6c): undefined reference to `_rpl_printf'
ccj4A3N3.ltrans0.o:(.text+0x81): undefined reference to `_rpl_printf'
/var/tmp/portage/app-arch/gzip-1.6/temp/ccj4A3N3.ltrans0.ltrans.o: In function `version':
ccj4A3N3.ltrans0.o:(.text+0xa1): undefined reference to `_rpl_printf'
/var/tmp/portage/app-arch/gzip-1.6/temp/ccj4A3N3.ltrans0.ltrans.o: In function `help':
ccj4A3N3.ltrans0.o:(.text+0xd5): undefined reference to `_rpl_printf'
ccj4A3N3.ltrans0.o:(.text+0xea): undefined reference to `_rpl_printf'
/var/tmp/portage/app-arch/gzip-1.6/temp/ccj4A3N3.ltrans0.ltrans.o: In function `try_help':
ccj4A3N3.ltrans0.o:(.text+0x53a): undefined reference to `rpl_fprintf'
/var/tmp/portage/app-arch/gzip-1.6/temp/ccj4A3N3.ltrans0.ltrans.o: In function `treat_stdin':
ccj4A3N3.ltrans0.o:(.text+0x617): undefined reference to `rpl_fprintf'
ccj4A3N3.ltrans0.o:(.text+0x6eb): undefined reference to `get_stat_mtime'
ccj4A3N3.ltrans0.o:(.text+0x725): undefined reference to `gettime'
/var/tmp/portage/app-arch/gzip-1.6/temp/ccj4A3N3.ltrans0.ltrans.o: In function `treat_file.lto_priv.42':
ccj4A3N3.ltrans0.o:(.text+0x93c): undefined reference to `rpl_fprintf'
ccj4A3N3.ltrans0.o:(.text+0x98e): undefined reference to `rpl_fprintf'
ccj4A3N3.ltrans0.o:(.text+0x9ed): undefined reference to `get_stat_mtime'
....
/var/tmp/portage/app-arch/gzip-1.6/temp/ccj4A3N3.ltrans6.ltrans.o:ccj4A3N3.ltrans6.o:(.text+0x145): more undefined references to `rpl_fprintf' follow
collect2: error: ld returned 1 exit status
Makefile:1545: recipe for target 'gzip' failed
make[2]: *** [gzip] Error 1
make[2]: Leaving directory '/var/tmp/portage/app-arch/gzip-1.6/work/gzip-1.6'
Makefile:1669: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/var/tmp/portage/app-arch/gzip-1.6/work/gzip-1.6'
Makefile:1455: recipe for target 'all' failed
make: *** [all] Error 2
 * ERROR: app-arch/gzip-1.6::gentoo failed (compile phase):
 *   emake failed
 * 
 * If you need support, post the output of `emerge --info '=app-arch/gzip-1.6::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=app-arch/gzip-1.6::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/app-arch/gzip-1.6/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/app-arch/gzip-1.6/temp/environment'.
 * Working directory: '/var/tmp/portage/app-arch/gzip-1.6/work/gzip-1.6'
 * S: '/var/tmp/portage/app-arch/gzip-1.6/work/gzip-1.6'


Expected Results:  
1. mkdir -p /usr/x86_64-pc-linux-gnu/binutils-bin/lib/bfd-plugins
2. ln -s /usr/libexec/gcc/x86_64-pc-linux-gnu/4.9.2/liblto_plugin.so /usr/x86_64-pc-linux-gnu/binutils-bin/lib/bfd-plugins/
3. place -flto in CFLAGS and LDFLAGS in /etc/portage/make.conf
4. emerge --oneshot gzip

Calculating dependencies... done!
>>> Verifying ebuild manifests
>>> Emerging (1 of 1) app-arch/gzip-1.6::gentoo
>>> Installing (1 of 1) app-arch/gzip-1.6::gentoo
>>> Jobs: 1 of 1 complete                           Load avg: 0.91, 0.60, 0.43
>>> Auto-cleaning packages...

>>> No outdated packages were found on your system.


it is interesting that ld.gold also looks in bfd-plugins folder and does not look in gold-plugins

the advantage of -flto:

ls -l /bin/gzip
ld.bfd  without -flto 98064
ld.bfd     with -flto 89776
ld.gold without -flto 96000
ld.gold    with -flto 87768
Comment 1 SpanKY gentoo-dev 2015-03-31 06:16:29 UTC

*** This bug has been marked as a duplicate of bug 494228 ***