Skip to contentSkip to conversation

systemd: work-around ppc gold linker error

PATCH In review Randy MacLeod 2 participants 5 messages Jun 22, 2017 – Jun 26, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 systemd: work-around ppc gold linker error

If you enable systemd and build for qemuppc, then the compile of systemd fails due to a gold linker failure:

.../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

A git bisect confirms that the commit:
0b0f545 binutils-2.28: Update to latest on release branch
is the problem. This is only known to affect powerpc machines.

Work-around this for powerpc by getting configure to use the bfd linker rather than the gold linker.

This unblocks powerpc use until the linker bug can be resolved.

---
 .../systemd/systemd/systemd-drop-gold-use-bfd.patch   | 19 +++++++++++++++++++
 meta/recipes-core/systemd/systemd_232.bb              |  2 ++
 2 files changed, 21 insertions(+)
 create mode 100644 meta/recipes-core/systemd/systemd/systemd-drop-gold-use-bfd.patch
meta/recipes-core/systemd/systemd/systemd-drop-gold-use-bfd.patch new file +19 -0
new file mode 100644
index 0000000..e0eb0bd
@@ -0,0 +1,19 @@
+Upstream-Status: Inappropriate [other]
+
+The patch is not appropriate for upstream since it's a temporary
+work-around for only ppc arches. Once the binutils defect in the
+gold linker is resolved, this patch can be dropped.
+
+Signed-off-by: Randy MacLeod <[email protected]>
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -260,7 +260,7 @@
+         -Wl,-z,relro \
+         -Wl,-z,now \
+         -pie \
+-        -Wl,-fuse-ld=gold])
++        -Wl,-fuse-ld=bfd])
+ AC_SUBST([OUR_LDFLAGS], "$with_ldflags $sanitizer_ldflags")
+ 
+ AC_CHECK_SIZEOF(pid_t)
meta/recipes-core/systemd/systemd_232.bb +2 -0
index 1007360..1e8dffe 100644
@@ -41,6 +41,8 @@ SRC_URI_append_libc-uclibc = "\
 "
 SRC_URI_append_qemuall = " file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch"
 
+SRC_URI_append_powerpc = " file://systemd-drop-gold-use-bfd.patch"
+
 PACKAGECONFIG ??= "xz \
                    ${@bb.utils.filter('DISTRO_FEATURES', 'efi pam selinux ldconfig', d)} \
                    ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \
Signature · 1 line
2.7.4
#1 lore raw

Merge if you like or wait for the real fix to binutils.

This bug has been around for more than a week since the binutils upgrade was merged and
no one else seems to have noticed so it doesn't seem urgent.

I needed the work-around to keep our auto-builders happy. Oh and I did basic sanity testing to show that booting and systemctl status works on qemuppc.

../Randy

Quoted 63 lines · Randy MacLeod

If you enable systemd and build for qemuppc, then the compile of systemd fails due to a gold linker failure:

.../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

A git bisect confirms that the commit:
0b0f545 binutils-2.28: Update to latest on release branch
is the problem. This is only known to affect powerpc machines.

Work-around this for powerpc by getting configure to use the bfd linker rather than the gold linker.

This unblocks powerpc use until the linker bug can be resolved.

---
  .../systemd/systemd/systemd-drop-gold-use-bfd.patch   | 19 +++++++++++++++++++
  meta/recipes-core/systemd/systemd_232.bb              |  2 ++
  2 files changed, 21 insertions(+)

create mode 100644 meta/recipes-core/systemd/systemd/systemd-drop-gold-use-bfd.patch

meta/recipes-core/systemd/systemd/systemd-drop-gold-use-bfd.patch new file +19 -0
new file mode 100644
index 0000000..e0eb0bd
@@ -0,0 +1,19 @@
+Upstream-Status: Inappropriate [other]
+
+The patch is not appropriate for upstream since it's a temporary
+work-around for only ppc arches. Once the binutils defect in the
+gold linker is resolved, this patch can be dropped.
+
+Signed-off-by: Randy MacLeod <[email protected]>
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -260,7 +260,7 @@
+         -Wl,-z,relro \
+         -Wl,-z,now \
+         -pie \
+-        -Wl,-fuse-ld=gold])
++        -Wl,-fuse-ld=bfd])
+ AC_SUBST([OUR_LDFLAGS], "$with_ldflags $sanitizer_ldflags")
+
+ AC_CHECK_SIZEOF(pid_t)
meta/recipes-core/systemd/systemd_232.bb +2 -0
index 1007360..1e8dffe 100644
@@ -41,6 +41,8 @@ SRC_URI_append_libc-uclibc = "\
  "
  SRC_URI_append_qemuall = " file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch"
 
+SRC_URI_append_powerpc = " file://systemd-drop-gold-use-bfd.patch"
+
  PACKAGECONFIG ??= "xz \
                     ${@bb.utils.filter('DISTRO_FEATURES', 'efi pam selinux ldconfig', d)} \
                     ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \
Signature · 2 lines
# Randy MacLeod. SMTS, Linux, Wind River
Direct: 613.963.1350 | 350 Terry Fox Drive, Suite 200, Ottawa, ON, Canada, K2K 2W5
#2 lore raw

What's the link to upstream bug in linker

Quoted 98 lines · Randy MacLeod

Merge if you like or wait for the real fix to binutils.

This bug has been around for more than a week since the binutils upgrade was merged and
no one else seems to have noticed so it doesn't seem urgent.

I needed the work-around to keep our auto-builders happy. Oh and I did basic sanity testing to show that booting and systemctl status works on qemuppc.

../Randy

Quoted 6 lines · Randy MacLeod

If you enable systemd and build for qemuppc, then the compile of systemd fails due to a gold linker failure:

.../powerpc-oe-linux-ld.gold:
error: invalid STB_LOCAL symbol in external symbols
error: linker defined: multiple definition of

'00000001.plt_call.memcpy+8000'

Quoted 6 lines

command line: previous definition here

A git bisect confirms that the commit:
0b0f545 binutils-2.28: Update to latest on release branch
is the problem. This is only known to affect powerpc machines.

Quoted 8 lines

Work-around this for powerpc by getting configure to use the bfd linker rather than the gold linker.

This unblocks powerpc use until the linker bug can be resolved.

---
  .../systemd/systemd/systemd-drop-gold-use-bfd.patch   | 19

+++++++++++++++++++

Quoted 3 lines
  meta/recipes-core/systemd/systemd_232.bb              |  2 ++
  2 files changed, 21 insertions(+)

create mode 100644

meta/recipes-core/systemd/systemd/systemd-drop-gold-use-bfd.patch

Quoted 2 lines

diff --git

a/meta/recipes-core/systemd/systemd/systemd-drop-gold-use-bfd.patch b/meta/recipes-core/systemd/systemd/systemd-drop-gold-use-bfd.patch

Review

Quoted 25 lines

new file mode 100644
index 0000000..e0eb0bd

meta/recipes-core/systemd/systemd/systemd-drop-gold-use-bfd.patch new file +19 -0
@@ -0,0 +1,19 @@
+Upstream-Status: Inappropriate [other]
+
+The patch is not appropriate for upstream since it's a temporary
+work-around for only ppc arches. Once the binutils defect in the
+gold linker is resolved, this patch can be dropped.
+
+Signed-off-by: Randy MacLeod <[email protected]>
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -260,7 +260,7 @@
+         -Wl,-z,relro \
+         -Wl,-z,now \
+         -pie \
+-        -Wl,-fuse-ld=gold])
++        -Wl,-fuse-ld=bfd])
+ AC_SUBST([OUR_LDFLAGS], "$with_ldflags $sanitizer_ldflags")
+
+ AC_CHECK_SIZEOF(pid_t)
(quoted diff) +0 -0

b/meta/recipes-core/systemd/systemd_232.bb

meta/recipes-core/systemd/systemd_232.bb SRC_URI_append_libc-uclibc = "\ · line 42

Quoted 6 lines

index 1007360..1e8dffe 100644

meta/recipes-core/systemd/systemd_232.bb +0 -0
@@ -41,6 +41,8 @@ SRC_URI_append_libc-uclibc = "\
  "
  SRC_URI_append_qemuall = "

file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch"

meta/recipes-core/systemd/systemd_232.bb SRC_URI_append_libc-uclibc = "\

Quoted 5 lines
meta/recipes-core/systemd/systemd_232.bb +2 -0
+SRC_URI_append_powerpc = " file://systemd-drop-gold-use-bfd.patch"
+
  PACKAGECONFIG ??= "xz \
                     ${@bb.utils.filter('DISTRO_FEATURES', 'efi pam

selinux ldconfig', d)} \

meta/recipes-core/systemd/systemd_232.bb SRC_URI_append_libc-uclibc = "\ · line 47

Quoted 1 line
meta/recipes-core/systemd/systemd_232.bb +0 -0
                     ${@bb.utils.contains('DISTRO_FEATURES', 'x11',

'xkbcommon', '', d)} \

Quoted 1 line

--
# Randy MacLeod. SMTS, Linux, Wind River
Direct: 613.963.1350 | 350 Terry Fox Drive, Suite 200, Ottawa, ON, Canada, K2K 2W5
--
_______________________________________________
Openembedded-core mailing list [email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#3 lore raw
Quoted 1 line · Khem Raj

What's the link to upstream bug in linker

Do you mean: Have I created an upstream bug?

No, not yet but I'm just reading their email lists and trying to understand where and how to report the bug. If you'd like to do that and CC me, then the task will finish sooner and I'll know for next time. :)

I've been taking the opportunity to see how we manage binutils by adding a bintuils-2.29 this points to master but I haven't gotten very far yet. My intent is to see if this bug is reproducible on the bintuils master branch since looking at:
git log --oneline master ^binutils-2_28-branch gold/powerpc.cc
only turned up:

bdab445 [GOLD] PowerPC move plt indx_ out of unordered map key 94de2a2 [GOLD] Avoid duplicate PLT stub symbols on ppc32 590b87f PR21503, Gold doesn't create linker stub symbols on ppc64 6528b6e PowerPC ld segfault on script discarding dynamic sections e666304 [GOLD] PowerPC64 TOC indirect to TOC relative segfault 857e829 Gold: Fix build with GCC 4.2
5edad15 [GOLD] PowerPC64 TOC indirect to TOC relative code editing f159cdb [GOLD] Add --secure-plt option for ppc32 3254d32 [GOLD] Set sh_info of .rela.plt for powerpc 0e123f6 [GOLD] powerpc.cc tidies
2571583 Update year range in copyright notice of all files.

and after an initial quick review it seems that those commits are either not relevant or have been cherry-picked back to binutils-2_28-branch already.

I'll include my cleaned-up link failure summary below.

Signature · 54 lines
# Randy MacLeod. SMTS, Linux, Wind River
Direct: 613.963.1350 | 350 Terry Fox Drive, Suite 200, Ottawa, ON, Canada, K2K 2W5


--------


powerpc-oe-linux-libtool: link: powerpc-oe-linux-gcc  \
  -m32 -mhard-float -mcpu=7400 -mno-spe \

--sysroot=/.../tmp-glibc/work/ppc7400-oe-linux/systemd/1_232-r0/recipe-sysroot \
  -shared  -fPIC -DPIC  \
  src/basic/.libs/libsystemd_shared_la-capability-util.o \
  src/basic/.libs/libsystemd_shared_la-conf-files.o \
  src/basic/.libs/libsystemd_shared_la-hostname-util.o \
  ...
  src/libudev/.libs/libsystemd_shared_la-libudev-queue.o \
  src/libudev/.libs/libsystemd_shared_la-libudev-hwdb.o \
  -lcap -lrt -lm -lresolv -llzma -lacl  \
  -m32 -mhard-float -mcpu=7400 -mno-spe \

--sysroot=/.../tmp-glibc/work/ppc7400-oe-linux/systemd/1_232-r0/recipe-sysroot \
  -fstack-protector -fstack-protector-strong -flto -fstack-protector 
-fstack-protector-strong \
  -flto -pthread -fstack-protector -fstack-protector-strong -flto 
-fstack-protector -fstack-protector-strong \
  -flto -O2 -g \
  -Wl,--gc-sections -Wl,--as-needed -Wl,--no-undefined \
  -Wl,-z -Wl,relro -Wl,-z -Wl,now -Wl,-fuse-ld=gold \
  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed   -pthread \
  -Wl,-soname -Wl,libsystemd-shared-232.so \
  -o .libs/libsystemd-shared-232.so
----------------------------------------------->>>
/.../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
   error: linker defined: multiple definition of 
'00000001.plt_call.memcpy+8000'
   command line: previous definition here
... <5577 more> ... with functions/symbols such as:
'00000001.plt_call.fflush_and_check+8000'
'00000001.plt_call.fileno+8000'
'00000001.plt_call.fchmod+8000'

| collect2: error: ld returned 1 exit status
| Makefile:11575: recipe for target 'libsystemd-shared.la' failed
| make[2]: *** [libsystemd-shared.la] Error 1
| Makefile:21970: recipe for target 'all-recursive' failed
| make[1]: *** [all-recursive] Error 1
| Makefile:9900: recipe for target 'all' failed
| make: *** [all] Error 2
| ERROR: oe_runmake failed

----------
#4 lore raw
Quoted 7 lines · Randy MacLeod
Quoted 1 line · Khem Raj

What's the link to upstream bug in linker

Do you mean: Have I created an upstream bug?

No, not yet but I'm just reading their email lists and trying to understand where and how to report the bug.

Done:
https://sourceware.org/bugzilla/show_bug.cgi?id=21678

I haven't made any progress on testing master.
I should have time this week.

Oh, webkitgtk_2.16.1 also fails for qemuppc with a similar error.

Signature · 2 lines
# Randy MacLeod. SMTS, Linux, Wind River
Direct: 613.963.1350 | 350 Terry Fox Drive, Suite 200, Ottawa, ON, Canada, K2K 2W5