On 02/28/2018 10:59 PM, Khem Raj wrote:
On Wed, Feb 28, 2018 at 12:46 AM, ChenQi <[email protected]> wrote:
On 02/28/2018 04:29 PM, Khem Raj wrote:
On Tue, Feb 27, 2018 at 9:56 PM, Chen Qi <[email protected]> wrote:
Remove the 'fstack-protector' and 'fstack-protector-strong' flags
as a workaround to fix the following error when building for qemux86
and qemuppc with musl.

    undefined reference to `__stack_chk_fail_local'

Signed-off-by: Chen Qi <[email protected]>
---
   ...ck-protector-flags-to-workaround-musl-bui.patch | 33
++++++++++++++++++++++
   meta/recipes-core/systemd/systemd_236.bb           |  4 +++
   2 files changed, 37 insertions(+)
   create mode 100644
meta/recipes-core/systemd/systemd/0001-Remove-fstack-protector-flags-to-workaround-musl-bui.patch

diff --git
a/meta/recipes-core/systemd/systemd/0001-Remove-fstack-protector-flags-to-workaround-musl-bui.patch
b/meta/recipes-core/systemd/systemd/0001-Remove-fstack-protector-flags-to-workaround-musl-bui.patch
new file mode 100644
index 0000000..783e579
--- /dev/null
+++
b/meta/recipes-core/systemd/systemd/0001-Remove-fstack-protector-flags-to-workaround-musl-bui.patch
@@ -0,0 +1,33 @@
+From a3e71209957e627be7e47969a61d2c69de4f2659 Mon Sep 17 00:00:00 2001
+From: Chen Qi <[email protected]>
+Date: Tue, 27 Feb 2018 18:06:51 -0800
+Subject: [PATCH] Remove fstack-protector flags to workaround musl build
+
+Remove fstack-protector and fstack-protector-strong flags to fix
+the following build failure for qemux86 and qemuppc with musl.
+
+  undefined reference to `__stack_chk_fail_local'
+
+Upstream-Status: Inappropriate [OE Specific]
+
+Signed-off-by: Chen Qi <[email protected]>
+---
+ meson.build | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index ddc061c12..631e76886 100644
+--- a/meson.build
++++ b/meson.build
+@@ -298,8 +298,6 @@ foreach arg : ['-Wextra',
+                '-fdiagnostics-show-option',
+                '-fno-strict-aliasing',
+                '-fvisibility=hidden',
+-               '-fstack-protector',
+-               '-fstack-protector-strong',
+                '-fPIE',
+                '--param=ssp-buffer-size=4',
+               ]
+--
+2.13.0
+
diff --git a/meta/recipes-core/systemd/systemd_236.bb
b/meta/recipes-core/systemd/systemd_236.bb
index a208f62..7798abb 100644
--- a/meta/recipes-core/systemd/systemd_236.bb
+++ b/meta/recipes-core/systemd/systemd_236.bb
@@ -53,6 +53,10 @@ SRC_URI =
"git://github.com/systemd/systemd.git;protocol=git \
              "
   SRC_URI_append_qemuall = "
file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch"

+# Workaround undefined reference to `__stack_chk_fail_local' on qemux86
and qemuppc for musl
+SRC_URI_append_libc-musl_qemux86 = "
file://0001-Remove-fstack-protector-flags-to-workaround-musl-bui.patch"
+SRC_URI_append_libc-musl_qemuppc = "
file://0001-Remove-fstack-protector-flags-to-workaround-musl-bui.patch"
+
we have security_flags.inc to build with these flags. So it might be fine
to just remove these flags including -fPIE

Hi Khem,

Just to confirm, do you mean that we remove these flags unconditionally?
Something like:
SRC_URI_append = " file://0001-Remove-security-flags"
yes


Hi Khem,

If removing PIE flag, we would have the following QA issue.

  ELF Binary 'xxx' has relations in .text

And the meson.build file has also slightly changed regarding the PIE flag.

So I chose to keep this patch as it is in the new patchset which upgrades systemd to 237. The meson.bbclass is fixed to use more vars than just CC and LD in the new patchset.

Best Regards,
Chen Qi
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Reply via email to