meta: fix bfd "cannot make copy relocation for protected symbol" issues
PATCH 1/1 meta: fix bfd "cannot make copy relocation for protected symbol" issues
From: Ming Liu <[email protected]>
Quite a few such compiling issues were found when I was building with following configs:
...
MACHINE = "beaglebone"
TCLIBC = "musl"DISTRO_FEATURES_append = " ld-is-gold"
...
There is already a workaround fixed a same issue but only for libunwind:
commit 482733bae05bdc7b149e515fb209c3266f459a53:
[ libunwind: fix build by linking with bfd instead of gold ]
it also works for other recipes per test, so make a bfd-binding-now bbclass letting all recipes having this issue to inherit it.
[YOCTO #11679]
--- meta/classes/bfd-binding-now.bbclass | 4 ++++ meta/recipes-connectivity/connman/connman.inc | 2 +- meta/recipes-core/coreutils/coreutils_8.27.bb | 2 +- meta/recipes-core/gettext/gettext_0.19.8.1.bb | 2 +- meta/recipes-core/glib-2.0/glib.inc | 2 +- meta/recipes-core/udev/eudev_3.2.1.bb | 2 +- meta/recipes-core/util-linux/util-linux.inc | 2 +- meta/recipes-devtools/m4/m4.inc | 2 +- meta/recipes-extended/diffutils/diffutils.inc | 2 +- meta/recipes-extended/grep/grep_3.1.bb | 2 +- meta/recipes-extended/iptables/iptables_1.6.1.bb | 2 +- meta/recipes-extended/procps/procps_3.3.12.bb | 2 +- meta/recipes-extended/xz/xz_5.2.3.bb | 2 +- meta/recipes-graphics/wayland/libinput_1.7.3.bb | 2 +- meta/recipes-graphics/xorg-xserver/xserver-xorg.inc | 2 +- meta/recipes-kernel/kmod/kmod.inc | 2 +- meta/recipes-support/libevdev/libevdev_1.5.7.bb | 2 +- meta/recipes-support/libunwind/libunwind.inc | 2 +- meta/recipes-support/libunwind/libunwind_1.2.bb | 2 -- 19 files changed, 21 insertions(+), 19 deletions(-) create mode 100644 meta/classes/bfd-binding-now.bbclass
meta/classes/bfd-binding-now.bbclass new file +4 -0
@@ -0,0 +1,4 @@ +# Workaround for some ARCHs do not support bfd lazy binding well +# Refer to: https://bugzilla.yoctoproject.org/show_bug.cgi?id=11679 + +TARGET_LDFLAGS_append = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -Wl,-z,relro,-z,now -fuse-ld=bfd ', '', d)}"
meta/recipes-connectivity/connman/connman.inc +1 -1
@@ -13,7 +13,7 @@ LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e \ file://src/main.c;beginline=1;endline=20;md5=486a279a6ab0c8d152bcda3a5b5edc36" -inherit autotools pkgconfig systemd update-rc.d bluetooth update-alternatives +inherit autotools pkgconfig systemd update-rc.d bluetooth update-alternatives bfd-binding-now DEPENDS = "dbus glib-2.0 ppp readline"
meta/recipes-core/coreutils/coreutils_8.27.bb +1 -1
@@ -10,7 +10,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504\ DEPENDS = "gmp libcap" DEPENDS_class-native = "" -inherit autotools gettext texinfo +inherit autotools gettext texinfo bfd-binding-now SRC_URI = "${GNU_MIRROR}/coreutils/${BP}.tar.xz;name=tarball \ http://distfiles.gentoo.org/distfiles/${BP}-man.tar.xz;name=manpages \
meta/recipes-core/gettext/gettext_0.19.8.1.bb +1 -1
@@ -24,7 +24,7 @@ SRC_URI[sha256sum] = "ff942af0e438ced4a8b0ea4b0b6e0d6d657157c5e2364de57baa279c1c PACKAGECONFIG[msgcat-curses] = "--with-libncurses-prefix=${STAGING_LIBDIR}/..,--disable-curses,ncurses," -inherit autotools texinfo +inherit autotools texinfo bfd-binding-now EXTRA_OECONF += "--without-lispdir \ --disable-csharp \
meta/recipes-core/glib-2.0/glib.inc +1 -1
@@ -26,7 +26,7 @@ PACKAGES += "${PN}-codegen ${PN}-utils" LEAD_SONAME = "libglib-2.0.*" -inherit autotools gettext gtk-doc pkgconfig ptest-gnome upstream-version-is-even bash-completion gio-module-cache python3native manpages +inherit autotools gettext gtk-doc pkgconfig ptest-gnome upstream-version-is-even bash-completion gio-module-cache python3native manpages bfd-binding-now S = "${WORKDIR}/glib-${PV}"
meta/recipes-core/udev/eudev_3.2.1.bb +1 -1
@@ -26,7 +26,7 @@ UPSTREAM_CHECK_URI = "https://github.com/gentoo/eudev/releases" SRC_URI[md5sum] = "a2aae16bc432eac0e71c1267c384e295" SRC_URI[sha256sum] = "88f530c1540750e6daa91b5eaeebf88e761e6f0c86515c1c28eedfd871f027c6" -inherit autotools update-rc.d qemu pkgconfig +inherit autotools update-rc.d qemu pkgconfig bfd-binding-now EXTRA_OECONF = " \ --sbindir=${base_sbindir} \
meta/recipes-core/util-linux/util-linux.inc +1 -1
@@ -18,7 +18,7 @@ LIC_FILES_CHKSUM = "file://README.licensing;md5=1715f5ee3e01203ca1e1e0b9ee65918c file://libblkid/COPYING;md5=fb93f01d4361069c5616327705373b16" #gtk-doc is not enabled as it requires xmlto which requires util-linux -inherit autotools gettext pkgconfig systemd update-alternatives python3-dir bash-completion ptest +inherit autotools gettext pkgconfig systemd update-alternatives python3-dir bash-completion ptest bfd-binding-now DEPENDS = "zlib ncurses" DEPENDS_append_class-native = " lzo-native" DEPENDS_append_class-nativesdk = " lzo-native"
meta/recipes-devtools/m4/m4.inc +1 -1
@@ -3,7 +3,7 @@ DESCRIPTION = "GNU m4 is an implementation of the traditional Unix macro process compatible although it has some extensions (for example, handling more than 9 positional parameters to macros). \ GNU M4 also has built-in functions for including files, running shell commands, doing arithmetic, etc." -inherit autotools texinfo +inherit autotools texinfo bfd-binding-now EXTRA_OEMAKE += "'infodir=${infodir}'" SRC_URI = "${GNU_MIRROR}/m4/m4-${PV}.tar.gz"
meta/recipes-extended/diffutils/diffutils.inc +1 -1
@@ -4,7 +4,7 @@ sdiff, and cmp utilities. These programs are usually \ used for creating patch files." SECTION = "base" -inherit autotools texinfo update-alternatives gettext +inherit autotools texinfo update-alternatives gettext bfd-binding-now ALTERNATIVE_${PN} = "diff cmp" ALTERNATIVE_PRIORITY = "100"
meta/recipes-extended/grep/grep_3.1.bb +1 -1
@@ -12,7 +12,7 @@ SRC_URI = "${GNU_MIRROR}/grep/grep-${PV}.tar.xz \ SRC_URI[md5sum] = "feca7b3e7c7f4aab2b42ecbfc513b070" SRC_URI[sha256sum] = "db625c7ab3bb3ee757b3926a5cfa8d9e1c3991ad24707a83dde8a5ef2bf7a07e" -inherit autotools gettext texinfo pkgconfig +inherit autotools gettext texinfo pkgconfig bfd-binding-now EXTRA_OECONF = "--disable-perl-regexp"
meta/recipes-extended/iptables/iptables_1.6.1.bb +1 -1
@@ -28,7 +28,7 @@ SRC_URI = "http://netfilter.org/projects/iptables/files/iptables-${PV}.tar.bz2 \ SRC_URI[md5sum] = "ab38a33806b6182c6f53d6afb4619add" SRC_URI[sha256sum] = "0fc2d7bd5d7be11311726466789d4c65fb4c8e096c9182b56ce97440864f0cf5" -inherit autotools pkgconfig +inherit autotools pkgconfig bfd-binding-now EXTRA_OECONF = "--with-kernel=${STAGING_INCDIR} \ "
meta/recipes-extended/procps/procps_3.3.12.bb +1 -1
@@ -10,7 +10,7 @@ LIC_FILES_CHKSUM="file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ DEPENDS = "ncurses" -inherit autotools gettext pkgconfig update-alternatives +inherit autotools gettext pkgconfig update-alternatives bfd-binding-now SRC_URI = "http://downloads.sourceforge.net/project/procps-ng/Production/procps-ng-${PV}.tar.xz \ file://sysctl.conf \
meta/recipes-extended/xz/xz_5.2.3.bb +1 -1
@@ -25,7 +25,7 @@ SRC_URI = "http://tukaani.org/xz/xz-${PV}.tar.gz" SRC_URI[md5sum] = "ef68674fb47a8b8e741b34e429d86e9d" SRC_URI[sha256sum] = "71928b357d0a09a12a4b4c5fafca8c31c19b0e7d3b8ebb19622e96f26dbf28cb" -inherit autotools gettext +inherit autotools gettext bfd-binding-now PACKAGES =+ "liblzma"
meta/recipes-graphics/wayland/libinput_1.7.3.bb +1 -1
@@ -13,7 +13,7 @@ SRC_URI = "http://www.freedesktop.org/software/${BPN}/${BP}.tar.xz \ SRC_URI[md5sum] = "f2993b477db8d7ec0e785ce04ffecb03" SRC_URI[sha256sum] = "096d612d2711f0caa2de544976ff3729e6233511ab373808644cc2dd5affcb1d" -inherit autotools pkgconfig +inherit autotools pkgconfig bfd-binding-now PACKAGECONFIG ??= "" PACKAGECONFIG[libunwind] = "--with-libunwind,--without-libunwind,libunwind"
meta/recipes-graphics/xorg-xserver/xserver-xorg.inc +1 -1
@@ -21,7 +21,7 @@ SRC_URI += "file://macro_tweak.patch" S = "${WORKDIR}/${XORG_PN}-${PV}" -inherit autotools pkgconfig +inherit autotools pkgconfig bfd-binding-now inherit distro_features_check REQUIRED_DISTRO_FEATURES = "x11"
meta/recipes-kernel/kmod/kmod.inc +1 -1
@@ -12,7 +12,7 @@ SECTION = "base" LIC_FILES_CHKSUM = "file://COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343 \ file://libkmod/COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343 \ " -inherit autotools gtk-doc pkgconfig manpages +inherit autotools gtk-doc pkgconfig manpages bfd-binding-now SRCREV = "ef4257b59c4307b8c627d89f3c7f1feedb32582f" # Lookout for PV bump too when SRCREV is changed
meta/recipes-support/libevdev/libevdev_1.5.7.bb +1 -1
@@ -11,4 +11,4 @@ SRC_URI = "http://www.freedesktop.org/software/libevdev/${BP}.tar.xz" SRC_URI[md5sum] = "4f1cfaee8d75ea3fbbfeb99a98730952" SRC_URI[sha256sum] = "a1e59e37a2f0d397ffd7e83b73af0e638db83b8dd08902ef0f651a21cc1dd422" -inherit autotools pkgconfig +inherit autotools pkgconfig bfd-binding-now
meta/recipes-support/libunwind/libunwind.inc +1 -1
@@ -5,7 +5,7 @@ LICENSE = "MIT" LIC_FILES_CHKSUM = "file://COPYING;beginline=3;md5=3fced11d6df719b47505837a51c16ae5" DEPENDS += "libatomic-ops" -inherit autotools +inherit autotools bfd-binding-now PACKAGECONFIG ??= "" PACKAGECONFIG[lzma] = "--enable-minidebuginfo,--disable-minidebuginfo,xz"
meta/recipes-support/libunwind/libunwind_1.2.bb +0 -2
@@ -20,5 +20,3 @@ EXTRA_OECONF_append_libc-musl = " --disable-documentation --disable-tests " # http://errors.yoctoproject.org/Errors/Details/20487/ ARM_INSTRUCTION_SET_armv4 = "arm" ARM_INSTRUCTION_SET_armv5 = "arm" - -LDFLAGS += "-Wl,-z,relro,-z,now ${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd ', '', d)}"
Signature · 1 line
2.7.4
Quoted 8 lines · On 20 July 2017 at 10:52, <[email protected]> wrote:
+++ b/meta/classes/bfd-binding-now.bbclass
meta/classes/bfd-binding-now.bbclass new file +4
-0@@ -0,0 +1,4 @@ +# Workaround for some ARCHs do not support bfd lazy binding well +# Refer to: https://bugzilla.yoctoproject.org/show_bug.cgi?id=11679 + +TARGET_LDFLAGS_append = "${@bb.utils.contains('DISTRO_FEATURES','ld-is-gold', ' -Wl,-z,relro,-z,now -fuse-ld=bfd ', '', d)}"
This is pretty ugly.
Does this tell us that maybe gold should be considered opt-in on a per-recipe basis instead of used by default?
Can you instead have a .inc file which fiddles the flag for all the recipes from outside the recipes? See eg security_flags.inc.
Ross