Bug 1091611 - -flto broken in gcc 4.9
-flto broken in gcc 4.9
Product: Fedora
Classification: Fedora
Component: binutils (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Nick Clifton
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2014-04-26 08:57 EDT by Peter Robinson
Modified: 2014-08-28 13:54 EDT (History)
6 users (show)

See Also:
Fixed In Version: binutils-2.24-21.fc21 and binutils-2.24-23.fc22
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2014-08-28 08:34:48 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Peter Robinson 2014-04-26 08:57:59 EDT
systemd 212 doesn't build with -flto with gcc 4.9. If CFLAGS="${CFLAGS} -fno-lto" is passed it builds fine.

The original 212 build was built with gcc 4.8.2 and there's not been a build with 4.9 since so it wasn't generally picked up.

It's also been noted on the systemd mailing list here

on x86 it failed as below. There was similar failures on aarch64 too.

libtool: link:  gcc -shared  -fPIC -DPIC  src/gudev/.libs/libgudev_1_0_la-gudevclient.o src/gudev/.libs/libgudev_1_0_la-gudevdevice.o src/gudev/.libs/libgudev_1_0_la-gudevenumerator.o src/gudev/.libs/libgudev_1_0_la-gudevmarshal.o src/gudev/.libs/libgudev_1_0_la-gudevenumtypes.o   -Wl,-rpath -Wl,/builddir/build/BUILD/systemd-212/build3/.libs ./.libs/libudev.so -lrt -lgio-2.0 -lgobject-2.0 -lglib-2.0 -ldl  -flto -pthread -O2 -m64 -mtune=generic -Wl,--as-needed -Wl,--no-undefined -Wl,--gc-sections -Wl,-z -Wl,relro -Wl,-z -Wl,now -Wl,-fuse-ld=gold -Wl,-z -Wl,relro   -pthread -Wl,-soname -Wl,libgudev-1.0.so.0 -Wl,-version-script -Wl,.libs/libgudev-1.0.ver -o .libs/libgudev-1.0.so.0.2.0
collect2: error: ld returned 1 exit status
make[2]: *** [pam_systemd.la] Error 1
make[2]: *** Waiting for unfinished jobs....
/usr/bin/ld.gold: error: .libs/libgudev-1.0.ver:2:1: syntax error, unexpected LOCAL, expecting STRING or QUOTED_STRING or EXTERN
/usr/bin/ld.gold: fatal error: unable to parse version script file .libs/libgudev-1.0.ver
collect2: error: ld returned 1 exit status
make[2]: *** [libgudev-1.0.la] Error 1
libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -include ./config.h -DPKGSYSCONFDIR=\"/etc/systemd\" -DSYSTEM_CONFIG_UNIT_PATH=\"/etc/systemd/system\" -DSYSTEM_DATA_UNIT_PATH=\"/usr/lib/systemd/system\" -DSYSTEM_SYSVINIT_PATH=\"/etc/rc.d/init.d\" -DSYSTEM_SYSVRCND_PATH=\"/etc/rc.d\" -DUSER_CONFIG_UNIT_PATH=\"/etc/systemd/user\" -DUSER_DATA_UNIT_PATH=\"/usr/lib/systemd/user\" -DCATALOG_DATABASE=\"/var/lib/systemd/catalog/database\" -DSYSTEMD_CGROUP_AGENT_PATH=\"/usr/lib/systemd/systemd-cgroups-agent\" -DSYSTEMD_BINARY_PATH=\"/usr/lib/systemd/systemd\" -DSYSTEMD_SHUTDOWN_BINARY_PATH=\"/usr/lib/systemd/systemd-shutdown\" -DSYSTEMD_SLEEP_BINARY_PATH=\"/usr/lib/systemd/systemd-sleep\" -DSYSTEMCTL_BINARY_PATH=\"/usr/bin/systemctl\" -DSYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH=\"/usr/bin/systemd-tty-ask-password-agent\" -DSYSTEMD_STDIO_BRIDGE_BINARY_PATH=\"/usr/bin/systemd-stdio-bridge\" -DROOTPREFIX=\"/usr\" -DRANDOM_SEED_DIR=\"/var/lib/systemd/\" -DRANDOM_SEED=\"/var/lib/systemd/random-seed\" -DSYSTEMD_CRYPTSETUP_PATH=\"/usr/lib/systemd/systemd-cryptsetup\" -DSYSTEM_GENERATOR_PATH=\"/usr/lib/systemd/system-generators\" -DUSER_GENERATOR_PATH=\"/usr/lib/systemd/user-generators\" -DSYSTEM_SHUTDOWN_PATH=\"/usr/lib/systemd/system-shutdown\" -DSYSTEM_SLEEP_PATH=\"/usr/lib/systemd/system-sleep\" -DSYSTEMD_KBD_MODEL_MAP=\"/usr/share/systemd/kbd-model-map\" -DX_SERVER=\"/usr/bin/X\" -DUDEVLIBEXECDIR=\"/usr/lib/udev\" -DPOLKIT_AGENT_BINARY_PATH=\"/usr/bin/pkttyagent\" -DQUOTACHECK=\"/usr/sbin/quotacheck\" -DKEXEC=\"/usr/sbin/kexec\" -I ../src -I ./src/shared -I ../src/shared -I ../src/network -I ../src/login -I ../src/journal -I ../src/timedate -I ../src/systemd -I ./src/core -I ../src/core -I ../src/libudev -I ../src/udev -I ../src/udev/net -I ./src/udev -I ../src/libsystemd/sd-bus -I ../src/libsystemd/sd-event -I ../src/libsystemd/sd-rtnl -I ../src/libsystemd-network -Wp,-D_FORTIFY_SOURCE=2 -pipe -Wall -Wextra -Wno-inline -Wundef -Wformat=2 -Wformat-security -Wformat-nonliteral -Wlogical-op -Wsign-compare -Wmissing-include-dirs -Wold-style-definition -Wpointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wsuggest-attribute=noreturn -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Wno-long-long -Wno-overlength-strings -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Werror=overflow -Wdate-time -Wnested-externs -ffast-math -fno-common -fdiagnostics-show-option -fdiagnostics-color -fno-strict-aliasing -fvisibility=hidden -ffunction-sections -fdata-sections -fstack-protector --param=ssp-buffer-size=4 -flto -fvisibility=default -I/usr/include/python3.3m -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -c ../src/python-systemd/_journal.c  -fPIC -DPIC -o src/python-systemd/.libs/_journal_la-_journal.o
make[1]: *** [all-recursive] Error 1
Comment 1 Kay Sievers 2014-06-04 12:04:47 EDT
  -flto -ffat-lto-objects
seems to make it work just fine.
Comment 2 Jakub Jelinek 2014-06-04 12:10:26 EDT
The question is how is the version script created.  If you create it by running nm/readelf on the slim LTO objects, I'd say it should be expected.  If you are using nm, you could use gcc-nm instead so that it can use the linker plugin.
Comment 3 Kay Sievers 2014-06-05 13:59:35 EDT
Libtool does that, there is no explicit config or setup in the build-sys.
It is just:
  -export-symbols-regex ...

It is probably just a libtool bug to not call gcc-nm.
Comment 4 Peter Robinson 2014-08-28 08:34:28 EDT
Updating to reflect actual resolution

- binutils-HEAD-change-ld-notice-interface.patch: backport fix from HEAD that fixes LTO + ifunc when using ld.bfd instead of gold.
Comment 5 Kyle McMartin 2014-08-28 13:54:18 EDT
for the sake of clarity, this is a different bug than the one i fixed... but it's fixed too, so it can be closed.

Note You need to log in before you can comment on or make changes to this bug.