Bug 11696 - systemd: gold linker fails for ppc machine
Summary: systemd: gold linker fails for ppc machine
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: devtools / tool chain (show other bugs)
Version: 2.5
Hardware: x86 ppc
: Medium+ normal
Target Milestone: 2.4 M3
Assignee: Randy MacLeod
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2017-06-21 00:47 UTC by Randy MacLeod
Modified: 2017-07-19 20:03 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments
Work-arorund for gold linker bug to enable systemd to build. (1.01 KB, patch)
2017-06-21 00:47 UTC, Randy MacLeod
no flags Details | Diff
0001-systemd-work-around-ppc-gold-linker-error.patch (with patch!) (1.76 KB, patch)
2017-06-21 01:11 UTC, Randy MacLeod
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Randy MacLeod 2017-06-21 00:47:59 UTC
Created attachment 3835 [details]
Work-arorund for gold linker bug to enable systemd to build.

This is likely a binutils bug.

A qemuppc specific work-around that uses fuse-ld=bfd rather than fuse-ld=gold is attached.


If you enable systemd in conf/local.conf:

VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_append = " systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
KERNEL_FEATURES_append = " cfg/systemd.scc"


and build for qemuppc:
$ bitbake systemd

it eventually fails to link like this:

powerpc-oe-linux-libtool: link: powerpc-oe-linux-gcc -m32 -mhard-float -mcpu=7400 -mno-spe --sysroot=/buildarea/rmacleod/src/distro/yocto/b/sd-ppc/tmp
-glibc/work/ppc7400-oe-linux/systemd/1_232-r0/recipe-sysroot -pipe -Wall -Wextra -Wundef -Wformat=2 -Wformat-security -Wformat-nonliteral -Wlogical-op -Wmissing-include-dirs -Wold-style-definition -Wpointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wsuggest-attribute=noreturn -W
error=missing-prototypes -Werror=implicit-function-declaration -Werror=missing-declarations -Werror=return-type -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wstrict-aliasing=2 -Wwrite-strings -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-resul
t -Wno-format-signedness -Werror=overflow -Wdate-time -Wnested-externs -ffast-math -fno-common -fdiagnostics-show-option -fno-strict-aliasing -fvisibility=hidden -fstack-protector -fstack-protector-strong -fPIE --param=ssp-buffer-size=4 -Werror=shadow -flto -ffunction-sections -fdata-sections -O2 -p
ipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/buildarea/rmacleod/src/distro/yocto/b/sd-ppc/tmp-glibc/work/ppc7400-oe-linux/systemd/1_232-r0=/usr/src/debug/systemd/1_232-r0 -fdebug-prefix-map=/buildarea/rmacleod/src/distro/yocto/b/sd-ppc/tmp-glibc/work/ppc7400-oe-linux/systemd/1_232-r0/re
cipe-sysroot-native= -fdebug-prefix-map=/buildarea/rmacleod/src/distro/yocto/b/sd-ppc/tmp-glibc/work/ppc7400-oe-linux/systemd/1_232-r0/recipe-sysroot= -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined -Wl,-z -Wl,relro -Wl,-z -Wl,now -pie -Wl,-fuse-ld=gold -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-nee
ded -o scsi_id src/udev/scsi_id/scsi_id.o src/udev/scsi_id/scsi_serial.o  ./.libs/libshared.a -lresolv -lcap -lrt -lm -llzma -lacl -pthread 
powerpc-oe-linux-libtool: link: ( cd ".libs" && rm -f "libnss_myhostname.la" && ln -s "../libnss_myhostname.la" "libnss_myhostname.la" )
/buildarea/rmacleod/src/distro/yocto/b/sd-ppc/tmp-glibc/work/ppc7400-oe-linux/systemd/1_232-r0/recipe-sysroot-native/usr/bin/powerpc-oe-linux/powerpc-oe-linux-ld.gold: error: invalid STB_LOCAL symbol in external symbols
/buildarea/rmacleod/src/distro/yocto/b/sd-ppc/tmp-glibc/work/ppc7400-oe-linux/systemd/1_232-r0/recipe-sysroot-native/usr/bin/powerpc-oe-linux/powerpc-oe-linux-ld.gold: error: linker defined: multiple definition of '00000001.plt_call.free+8000'
/buildarea/rmacleod/src/distro/yocto/b/sd-ppc/tmp-glibc/work/ppc7400-oe-linux/systemd/1_232-r0/recipe-sysroot-native/usr/bin/powerpc-oe-linux/powerpc-oe-linux-ld.gold: command line: previous definition here
/buildarea/rmacleod/src/distro/yocto/b/sd-ppc/tmp-glibc/work/ppc7400-oe-linux/systemd/1_232-r0/recipe-sysroot-native/usr/bin/powerpc-oe-linux/powerpc-oe-linux-ld.gold: error: invalid STB_LOCAL symbol in external symbols
/buildarea/rmacleod/src/distro/yocto/b/sd-ppc/tmp-glibc/work/ppc7400-oe-linux/systemd/1_232-r0/recipe-sysroot-native/usr/bin/powerpc-oe-linux/powerpc-oe-linux-ld.gold: error: linker defined: multiple definition of '00000001.plt_call.strspn+8000'
/buildarea/rmacleod/src/distro/yocto/b/sd-ppc/tmp-glibc/work/ppc7400-oe-linux/systemd/1_232-r0/recipe-sysroot-native/usr/bin/powerpc-oe-linux/powerpc-oe-linux-ld.gold: command line: previous definition here
/buildarea/rmacleod/src/distro/yocto/b/sd-ppc/tmp-glibc/work/ppc7400-oe-linux/systemd/1_232-r0/recipe-sysroot-native/usr/bin/powerpc-oe-linux/powerpc-
Comment 1 Randy MacLeod 2017-06-21 01:01:02 UTC
Tomorrow, I'll look for a fix in the binutils-gnu git repo. Threre are some fixes on master that look promising.

Then I guess I should try to come up with a minimal reproducer and report the bug to the binutils devs.
Comment 2 Randy MacLeod 2017-06-21 01:11:02 UTC
Created attachment 3836 [details]
0001-systemd-work-around-ppc-gold-linker-error.patch (with patch!)

I had forgotten the patch originally.
Comment 3 Paul Eggleton 2017-06-21 07:44:01 UTC
Assigning this back to you Randy since you already seem to have a handle on the fix ;)
Comment 4 Randy MacLeod 2017-06-26 21:21:39 UTC
webkitgtk_2.16.1 also fails for qemuppc with a similar error. I haven't tried to work-around the bug. I've reported the gold defect upstream:
   https://sourceware.org/bugzilla/show_bug.cgi?id=21678
Comment 5 Randy MacLeod 2017-07-17 18:31:05 UTC
Gcc devs have a proposed patch that I'll test soon.
Comment 6 Randy MacLeod 2017-07-17 19:56:12 UTC
(In reply to comment #5)
> Gcc devs have a proposed patch that I'll test soon.

Err, wrong bug, ignore this. I'm getting caught up after vacation.
Comment 7 Randy MacLeod 2017-07-19 20:03:32 UTC
Fixed by:

commit 0d1273cdf8652bf1844f1f1fe4ba0eacd27ada65
Author: Randy MacLeod <Randy.MacLeod@windriver.com>
Date:   Tue Jun 27 21:35:06 2017 -0400

    binutils: update SRCREV to fix powerpc gold link bug
    
    Update to the latest commit on the 2.28 branch to pick up:
       a3e00a8 [GOLD] Avoid duplicate PLT stub symbols on ppc32
    along with several backported bug fixes for arm*, etc.
    
    This resolves the systemd link error for qemuppc
    with the error message:
       .../powerpc-oe-linux-ld.gold:
       error: invalid STB_LOCAL symbol in external symbols
       error: linker defined: multiple definition of '00000001.plt_call.memcpy+8000'
       command line: previous definition here
    
    described in:
    
    [YOCTO #11696]