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 https://www.mail-archive.com/systemd-devel@lists.freedesktop.org/msg18443.html on x86 it failed as below. There was similar failures on aarch64 too. http://koji.fedoraproject.org/koji/taskinfo?taskID=6782947 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
Using: -flto -ffat-lto-objects seems to make it work just fine.
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.
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.
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.
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.