diff options
author | Khem Raj <raj.khem@gmail.com> | 2016-03-22 17:06:07 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-03-25 10:29:16 +0000 |
commit | 4fe64d79a08cc08f3322546136e35a080aa5458b (patch) | |
tree | 8480bd2ba8ba19b1d3b3d870d6f2f41f98515aec /meta | |
parent | 4aa08b897628ef43adc9c3aa86bdf32499c328c1 (diff) | |
download | poky-4fe64d79a08cc08f3322546136e35a080aa5458b.tar.gz |
libunwind: Fix build with fstack-protector on musl
libunwind makery inserts -nostdlib during linking
which fails the build on musl when security flags are enabled
since it remove ssp from linking, so add them explicitly
to SECURITY_LDFLAGS
disable tests for musl targets, tests use obsolete
posix APIs e.g. getcontext
patchout x86_local_resume() on x86, gets a working
linunwind on x86, it seems that it wont work even
in glibc case but lets leave it as it is for glibc
and apply the patch only for musl
(From OE-Core rev: c8ac9d483f6e1cfca82dad8cf3e0745935e96214)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
4 files changed, 99 insertions, 11 deletions
diff --git a/meta/recipes-support/libunwind/libunwind-1.1/0001-disable-tests.patch b/meta/recipes-support/libunwind/libunwind-1.1/0001-disable-tests.patch new file mode 100644 index 0000000000..7309ffd865 --- /dev/null +++ b/meta/recipes-support/libunwind/libunwind-1.1/0001-disable-tests.patch | |||
@@ -0,0 +1,31 @@ | |||
1 | From b07435a90bd636ee718e2238fb46c74a6dd5e069 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Tue, 22 Mar 2016 16:41:13 +0000 | ||
4 | Subject: [PATCH] disable tests | ||
5 | |||
6 | Tests use getcontext() API which is | ||
7 | not there on musl | ||
8 | |||
9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
10 | --- | ||
11 | Upstream-Status: Inappropriate [MUSL-only] | ||
12 | |||
13 | Makefile.am | 2 +- | ||
14 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
15 | |||
16 | diff --git a/Makefile.am b/Makefile.am | ||
17 | index e24fe1e..15380e4 100644 | ||
18 | --- a/Makefile.am | ||
19 | +++ b/Makefile.am | ||
20 | @@ -39,7 +39,7 @@ endif | ||
21 | |||
22 | nodist_include_HEADERS = include/libunwind-common.h | ||
23 | |||
24 | -SUBDIRS = src tests doc | ||
25 | +SUBDIRS = src doc | ||
26 | |||
27 | noinst_HEADERS = include/dwarf.h include/dwarf_i.h include/dwarf-eh.h \ | ||
28 | include/compiler.h include/libunwind_i.h include/mempool.h \ | ||
29 | -- | ||
30 | 1.8.3.1 | ||
31 | |||
diff --git a/meta/recipes-support/libunwind/libunwind-1.1/0001-x86-Stub-out-x86_local_resume.patch b/meta/recipes-support/libunwind/libunwind-1.1/0001-x86-Stub-out-x86_local_resume.patch new file mode 100644 index 0000000000..371013aaaa --- /dev/null +++ b/meta/recipes-support/libunwind/libunwind-1.1/0001-x86-Stub-out-x86_local_resume.patch | |||
@@ -0,0 +1,54 @@ | |||
1 | From f5df01655a4b76d4fe415747de581d94ac593e6a Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Tue, 22 Mar 2016 16:19:29 +0000 | ||
4 | Subject: [PATCH] x86: Stub out x86_local_resume() | ||
5 | |||
6 | its purpose seems | ||
7 | to be unwinding across signal handler boundaries, which cannot happen | ||
8 | in correct programs anyway. Replacing the whole function with | ||
9 | something like *(volatile char *)0=0; (i.e. crash), gets a working | ||
10 | libunwind | ||
11 | |||
12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
13 | --- | ||
14 | Upstream-Status: Pending | ||
15 | |||
16 | src/x86/Gos-linux.c | 22 +--------------------- | ||
17 | 1 file changed, 1 insertion(+), 21 deletions(-) | ||
18 | |||
19 | diff --git a/src/x86/Gos-linux.c b/src/x86/Gos-linux.c | ||
20 | index 31f83ba..3aaa34e 100644 | ||
21 | --- a/src/x86/Gos-linux.c | ||
22 | +++ b/src/x86/Gos-linux.c | ||
23 | @@ -281,27 +281,7 @@ x86_r_uc_addr (ucontext_t *uc, int reg) | ||
24 | HIDDEN int | ||
25 | x86_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) | ||
26 | { | ||
27 | - struct cursor *c = (struct cursor *) cursor; | ||
28 | - ucontext_t *uc = c->uc; | ||
29 | - | ||
30 | - /* Ensure c->pi is up-to-date. On x86, it's relatively common to be | ||
31 | - missing DWARF unwind info. We don't want to fail in that case, | ||
32 | - because the frame-chain still would let us do a backtrace at | ||
33 | - least. */ | ||
34 | - dwarf_make_proc_info (&c->dwarf); | ||
35 | - | ||
36 | - if (unlikely (c->sigcontext_format != X86_SCF_NONE)) | ||
37 | - { | ||
38 | - struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr; | ||
39 | - | ||
40 | - Debug (8, "resuming at ip=%x via sigreturn(%p)\n", c->dwarf.ip, sc); | ||
41 | - sigreturn (sc); | ||
42 | - } | ||
43 | - else | ||
44 | - { | ||
45 | - Debug (8, "resuming at ip=%x via setcontext()\n", c->dwarf.ip); | ||
46 | - setcontext (uc); | ||
47 | - } | ||
48 | + *(volatile char *)0=0; | ||
49 | return -UNW_EINVAL; | ||
50 | } | ||
51 | #endif | ||
52 | -- | ||
53 | 1.8.3.1 | ||
54 | |||
diff --git a/meta/recipes-support/libunwind/libunwind.inc b/meta/recipes-support/libunwind/libunwind.inc index f83614bf5c..1c342d3922 100644 --- a/meta/recipes-support/libunwind/libunwind.inc +++ b/meta/recipes-support/libunwind/libunwind.inc | |||
@@ -5,8 +5,6 @@ LICENSE = "MIT" | |||
5 | LIC_FILES_CHKSUM = "file://LICENSE;md5=3fced11d6df719b47505837a51c16ae5" | 5 | LIC_FILES_CHKSUM = "file://LICENSE;md5=3fced11d6df719b47505837a51c16ae5" |
6 | DEPENDS += "libatomic-ops" | 6 | DEPENDS += "libatomic-ops" |
7 | 7 | ||
8 | SRC_URI = "${SAVANNAH_NONGNU_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz" | ||
9 | |||
10 | inherit autotools | 8 | inherit autotools |
11 | 9 | ||
12 | PACKAGECONFIG ??= "" | 10 | PACKAGECONFIG ??= "" |
@@ -29,4 +27,6 @@ LDFLAGS_append_aarch64 = " -fuse-ld=gold" | |||
29 | LDFLAGS_append_powerpc = " -fuse-ld=gold -mbss-plt" | 27 | LDFLAGS_append_powerpc = " -fuse-ld=gold -mbss-plt" |
30 | LDFLAGS_append_powerpc64 = " -fuse-ld=gold -mbss-plt" | 28 | LDFLAGS_append_powerpc64 = " -fuse-ld=gold -mbss-plt" |
31 | 29 | ||
30 | SECURITY_LDFLAGS_append_libc-musl = " -lssp_nonshared -lssp" | ||
31 | |||
32 | BBCLASSEXTEND = "native" | 32 | BBCLASSEXTEND = "native" |
diff --git a/meta/recipes-support/libunwind/libunwind_1.1.bb b/meta/recipes-support/libunwind/libunwind_1.1.bb index 7df9f5ee05..1ed525f515 100644 --- a/meta/recipes-support/libunwind/libunwind_1.1.bb +++ b/meta/recipes-support/libunwind/libunwind_1.1.bb | |||
@@ -1,15 +1,18 @@ | |||
1 | require libunwind.inc | 1 | require libunwind.inc |
2 | 2 | ||
3 | SRC_URI += "\ | 3 | SRC_URI = "${SAVANNAH_NONGNU_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz \ |
4 | file://Support-building-with-older-compilers.patch \ | 4 | file://Support-building-with-older-compilers.patch \ |
5 | file://AArch64-port.patch \ | 5 | file://AArch64-port.patch \ |
6 | file://Fix-test-case-link-failure-on-PowerPC-systems-with-Altivec.patch \ | 6 | file://Fix-test-case-link-failure-on-PowerPC-systems-with-Altivec.patch \ |
7 | file://Link-libunwind-to-libgcc_s-rather-than-libgcc.patch \ | 7 | file://Link-libunwind-to-libgcc_s-rather-than-libgcc.patch \ |
8 | file://0001-Invalid-dwarf-opcodes-can-cause-references-beyond-th.patch \ | 8 | file://0001-Invalid-dwarf-opcodes-can-cause-references-beyond-th.patch \ |
9 | file://Add-AO_REQUIRE_CAS-to-fix-build-on-ARM-v6.patch \ | 9 | file://Add-AO_REQUIRE_CAS-to-fix-build-on-ARM-v6.patch \ |
10 | file://0001-backtrace-Use-only-with-glibc-and-uclibc.patch \ | 10 | file://0001-backtrace-Use-only-with-glibc-and-uclibc.patch \ |
11 | " | ||
12 | SRC_URI_append_libc-musl = "\ | ||
13 | file://0001-x86-Stub-out-x86_local_resume.patch \ | ||
14 | file://0001-disable-tests.patch \ | ||
11 | " | 15 | " |
12 | |||
13 | SRC_URI[md5sum] = "fb4ea2f6fbbe45bf032cd36e586883ce" | 16 | SRC_URI[md5sum] = "fb4ea2f6fbbe45bf032cd36e586883ce" |
14 | SRC_URI[sha256sum] = "9dfe0fcae2a866de9d3942c66995e4b460230446887dbdab302d41a8aee8d09a" | 17 | SRC_URI[sha256sum] = "9dfe0fcae2a866de9d3942c66995e4b460230446887dbdab302d41a8aee8d09a" |
15 | 18 | ||