Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 522316 - sys-devel/m4-1.4.16 with sys-devel/gcc-4.9.1 and LTO CFLAGS - function main: error: undefined reference to 'set_program_name'
Summary: sys-devel/m4-1.4.16 with sys-devel/gcc-4.9.1 and LTO CFLAGS - function main: ...
Status: RESOLVED DUPLICATE of bug 494228
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 Linux
: Normal minor (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-07 17:14 UTC by Petros
Modified: 2015-09-24 19:19 UTC (History)
1 user (show)

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


Attachments
emerge --info (info,7.83 KB, text/plain)
2014-09-07 17:19 UTC, Petros
Details
build.log (build.log,89.68 KB, text/plain)
2014-09-07 17:20 UTC, Petros
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petros 2014-09-07 17:14:27 UTC
I am trying to test the new compiler and it's LTO progress. So I added -flto=n -fuse-linker-plugin and after reemerging gcc and glibc succesfully I gave a shot at a random package (m4). The problem is also present at (~amd64) =sys-devel/m4-1.4.17 (USE=examples).

I tried out with multiple version of pre-installed binutils and even from git (-9999) and it always rants about ld (gold of course).

binutils-config -l
 [1] x86_64-pc-linux-gnu-2.23.2
 [2] x86_64-pc-linux-gnu-2.24 *
 [3] x86_64-pc-linux-gnu-2.24.51.0.2
 [4] x86_64-pc-linux-gnu-2.24.51.0.3
 [5] x86_64-pc-linux-gnu-git

Binutils can not be emerged with LTO as it also crashes at linking. But that is another report. 



Reproducible: Always

Steps to Reproduce:
1.Add proper LTO C/FLAGS.
2.emerge -v1 m4.
3.
Comment 1 Petros 2014-09-07 17:19:04 UTC
Created attachment 384354 [details]
emerge --info
Comment 2 Petros 2014-09-07 17:20:34 UTC
Created attachment 384356 [details]
build.log
Comment 3 Petros 2014-09-07 17:21:08 UTC
Portage 2.2.10 (default/linux/amd64/13.0/desktop, gcc-4.9.1, glibc-2.19-r1, 3.16.1-gentoo x86_64)
=================================================================
System uname: Linux-3.16.1-gentoo-x86_64-AMD_Phenom-tm-_II_X6_1090T_Processor-with-gentoo-2.2
KiB Mem:     3918132 total,    840456 free
KiB Swap:          0 total,         0 free
Timestamp of tree: Sat, 06 Sep 2014 12:30:01 +0000
ld GNU gold (Gentoo 2.24 p1.4 2.24) 1.11
app-shells/bash:          4.2_p45
dev-java/java-config:     2.2.0
dev-lang/python:          2.7.7, 3.2.5-r6, 3.3.5-r1
dev-util/cmake:           2.8.12.2-r2
dev-util/pkgconfig:       0.28-r1
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.12.4
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.6, 1.12.6, 1.13.4, 1.14.1
sys-devel/binutils:       2.23.2, 2.24-r3, 2.24.51.0.2::hacking-gentoo, 2.24.51.0.3, 9999
sys-devel/gcc:            4.7.3-r1, 4.8.3, 4.9.1
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4.2-r1
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.13 (virtual/os-headers)
sys-libs/glibc:           2.19-r1
Repositories: gentoo x-portage vaca mipl_emc ext-devlibs gentoo-el last-hope science steam-overlay stuff gentoo-zh qt kde x11 x-layman
Installed sets: @kde-applications-live, @kde-frameworks-live, @kde-next-live, @kde-plasma-live, @qt5-addons
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA PUEL googleearth Q3AEULA-20000111 AdobeFlash-11.x Intel-SDP Q3AEULA skype-4.0.0.7-copyright Oracle-BCLA-JavaSE cadsoft GIMPS"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -m3dnow -mtls-dialect=gnu2 -mglibc -m64 -pipe -flto=3 "
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /etc/entropy /usr/share/config /usr/share/gnupg/qualified.txt /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -O2 -m3dnow -mtls-dialect=gnu2 -mglibc -m64 -pipe -flto=3 "
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks downgrade-backup ebuild-locks fixlafiles merge-sync news parallel-fetch parallel-install preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="C"
LDFLAGS="-Wl,--as-needed -Wl,-O1 -Wl,--hash-style=gnu -Wl,--sort-common -Wl,-zcombreloc -flto=3 -fuse-linker-plugin "
MAKEOPTS="-j3"
PKGDIR="usr/portage/distfiles"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage /var/lib/layman/vaca /var/lib/layman/emc /var/lib/layman/ext-devlibs /var/lib/layman/gentoo-el /var/lib/layman/last-hope /var/lib/layman/science /var/lib/layman/steam /var/lib/layman/stuff /var/lib/layman/gentoo-zh /var/lib/layman/qt /var/lib/layman/kde /var/lib/layman/x11 /var/lib/layman"
USE="256-color 3d 3dnow 3dnowext 3ds 64bit 7zip R X Xaw3d a52 aac aalib accessibility acl acpi aes aes-ccm aes-gcm aes-ni aiglx aio airdrop-ng airgraph-ng alert alsa amd64 analitza ap apache apache2 applet asm athena atm atmo attica audio audio-sdl audioeffects audiofile bash-completion bazaar bench berkdb bindist bittorrent boundschecks branding bugzilla bullet bzip2 bzr c++0x cairo cdda cddb cdr chm city clamav clamd clamdtop clang cli cmake colordiff colorio colors conky consolekit corefonts cpudetection cpufreq cpufreq_bench cpuload cpusets cracklib cramfs crash-reporter crc crypt csharp cups curl cxx cycles d dbus demangle dep device-mapper dga dhcp digital direct2d directfb directx distribution djvu dmenu dmx dos dot dpi dri drm dts dv dvd dvdr ebook editor eigen emacs emboss encode evdev eve examples exif extensions extra extras facebook fam fbcon fbcon_frontend_linux fbdev fcitx ffmpeg fftw firefox firmware flac fltk font-styles fontconfig fortran fpx freetype freetype2 ftp g3dvl gbm gcode gd gdbm gdm ggi gif gimp git glamor glibc glut gnome gnuplot go gold gpm gps graphviz gstreamer gtk gtkstyle gudev gui guile hal hddtemp help hscolour hwdb ibus icons iconv idn ieee1394 imagemagic imlib inotify iostats ipv6 irc jack jadetex java jpeg jpeg2 jpeg2k json kate kdm kdrive kerberos keyring lame latex lcms ldap libass libcaca libkms libnotify libsamplerate libv4l live llvm llvm-gcc lm_sensors lto lua lua-cairo lua-imlib lzma lzo mad maps matroska mms mmx mmxext mng modplug modules mono motif mp3 mp4 mpeg mpfi mplayer msn mtp mudflap multilib multimedia multislot musepack mysql nas ncurses netlink network networkmanager nfs nis nls nptl nsplugin nss ntfs ntp ntpl oauth octave offensive ogg okteta okular openal opencascade opencl openexr opengl opengtl openinventor openmp openrc openvg oss overlays p2p pam pango pdf perl physfs physics plasma plotutils png policykit ppds pulseaudio python q64 qalculate qml qt qt3support qt4 qt5 qthelp quota qwt rar rdesktop readline resolvconf rss rtf ruby rups samba samples schematics sdk sdl sdl-image server session shine skins skype smp sms sndfile solver sound speex spell sqlite sse sse2 sse3 ssl ssse3 startup-notification stroke subversion svg tcpd telepathy theora threads thumbnail tiff timidity tk tools truetype tty-helpers twolame udev udisks unicode unit-mm upower urwid usb userlocales utils v4l v4l2 vaapi valgrind vcd vcdx vdpau videos vim-syntax vlc vnc volpack vorbis vtk waveform weather-metar webkit widgets wimax winbind word-perfect wps wxwidgets x264 xa xattr xcb xcomposite xine xinerama xkb xml xmlreader xmlwriter xmms2 xmp xnest xorg xplanet xprint xrandr xrender xv xvfb xvid xvmc xz zeroconf zip zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="emu efi-32 efi-64 pc" INPUT_DEVICES="keyboard evdev mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en el" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5_4" PYTHON_SINGLE_TARGET="python2_7 pyhton3_2 python3_3" PYTHON_TARGETS="python2_7 python3_3" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="radeon r600" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
USE_PYTHON="2.7 3.2 3.3"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, SYNC
Comment 4 David Kredba 2014-09-07 17:41:04 UTC
I do not think so this is Gentoo problem.
There are still troubles with LTO in GCC. Even 4.10.0/5.0 can't compile pykde4 for example.

Do you have GCC lto plugin symlink placed into Binutils plugin folder, the GIT one, of course?

With Bunutils 2.24 you can try to skip -fuse-linker-plugin and use AR=gcc-ar NM=gcc-nm instead.

Did you tried -ffat-lto-objects option?
Comment 5 Petros 2014-09-07 18:12:06 UTC
Oh, I was told to report at bugs.gentoo and not upstream so I filed the bug here.

I am not aware of this lto plugin symlinks, that applies only on 9999 and besides that, not any other version seems to make things in a "proper" way. Of course binutils aren't broken just not ready. Let me google a bit what are you talking about.

I will follow your advice about skiping fuse-linker-plugin and try out -ffat-lto-objects. I have noticed it in several web sites but the lack of documentation made me use older choiches (flto fuse-linker-plugin) for GCC-4.7.

So, to be with acceptable C/LDFLAGS from gentoo developers, should I use something like: 

CFLAGS="-march=native -O2 -pipe -fomit-frame-pointers -ffat-lto-objects -flto=3"
LDFLAGS="-Wl,--as-needed -Wl,-O1 -Wl,--hash-style=gnu -Wl,--sort-common -Wl,-zcombreloc AR=gcc-ar NM=gcc-nm"

Although, I feel I missplaced AR and NM and it's kind of silly right now.
Comment 6 David Kredba 2014-09-07 18:26:00 UTC
AR=gcc-ar and NM=gcc-nm should be used as EXTRA_ECONF or if you will call ebuild functions by hand. It calls nm and ar from gcc tree instead of binutils standard variants.
AR=gcc-ar NM=gcc-nm ebuild /usr/portage/sys-devel/m4/m4-1.4.17.ebuild configure, then install and then merge for example or merge as one step from command line.
Based on results you can decide where to report it later.
Please try -flto only and NM and AR firts. M4 is a small package, -flto=3 will not speed it up I think.
If it will fail add -ffat-lto-objects.

Here it can stay for information in my opinion if there will later will be LTO tracker bug created then as blocker.

Let please Gentoo developers decide.
Comment 7 Petros 2014-09-07 19:10:56 UTC
It worked *just* like you wrote.

I used -flto and EXTRA_ECONF, it failed and after adding -ffat-lto-objects, everything worked beautifully. Even binutils could finally be reemerged.

I thought that after binutils-2.24.51.0.3 have compiled with these options, perhaps it was possible to compile again sys-devel/m4-1.4.16, but with 
-fuse-linker-plugin and without the EXTRA_ECONF variable this time. 
And guess what...this worked too. Not tested on more packages though (except sys-devel/patch-2.7.1-r3 with success). Small sample to make a safe conclusion I'd say.

I think there is no problem anymore relevant to the initial post and title, so there is nothing to say anymore, but one last thing: I am going to compile with binutils/-fuse-linker-plugin and if something is going to fail I will try out with gcc/EXTRA_ECONF. 

Thank you very much for your guidance.
Comment 8 SpanKY gentoo-dev 2015-09-24 19:19:59 UTC
doesn't seem like a m4-specific issue if it works w/-ffat-lto-objects

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