summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/musl
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2018-04-13 22:35:49 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-05-09 10:47:50 +0100
commitbe600d88c7d98cda9000265b356baee8a4a92541 (patch)
treec12fded9c1f3c8de7d6a33e4ecfe8330d51f9f43 /meta/recipes-core/musl
parent27dca7d2e955370166042c05aef1524fe1fbc70b (diff)
downloadpoky-be600d88c7d98cda9000265b356baee8a4a92541.tar.gz
libssp-nonshared: Add recipe
libssp-nonshared is a minimal gcc runtime piece which is needed on non-glibc systems which do implement libssp APIs in libc Use PIE flags to compile libssp_nonshared.a so it works with security flags on as well (From OE-Core rev: ddfab4d021d4daa5aefcd9cdd89d349bbd4b6869) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/musl')
-rw-r--r--meta/recipes-core/musl/libssp-nonshared.bb39
-rw-r--r--meta/recipes-core/musl/libssp-nonshared/ssp-local.c45
2 files changed, 84 insertions, 0 deletions
diff --git a/meta/recipes-core/musl/libssp-nonshared.bb b/meta/recipes-core/musl/libssp-nonshared.bb
new file mode 100644
index 0000000000..458eafef52
--- /dev/null
+++ b/meta/recipes-core/musl/libssp-nonshared.bb
@@ -0,0 +1,39 @@
1# Copyright (C) 2018 Khem Raj <raj.khem@gmail.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4SUMMARY = "Minimal libssp_nonshared.a must needed for ssp to work with gcc on musl"
5LICENSE = "GPL-3.0-with-GCC-exception"
6LIC_FILES_CHKSUM = "file://ssp-local.c;beginline=1;endline=32;md5=c06d391208c0cfcbc541a6728ed65cc4"
7SECTION = "libs"
8
9SRC_URI = "file://ssp-local.c"
10
11PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:"
12
13INHIBIT_DEFAULT_DEPS = "1"
14
15STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}"
16STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${SDK_SYS}"
17
18DEPENDS = "virtual/${TARGET_PREFIX}binutils \
19 virtual/${TARGET_PREFIX}gcc-initial \
20"
21
22do_configure[noexec] = "1"
23
24S = "${WORKDIR}"
25
26do_compile() {
27 ${CC} ${CPPFLAGS} ${CFLAGS} -fPIE -c ssp-local.c -o ssp-local.o
28 ${AR} r libssp_nonshared.a ssp-local.o
29}
30do_install() {
31 install -Dm 0644 ${B}/libssp_nonshared.a ${D}${base_libdir}/libssp_nonshared.a
32}
33#
34# We will skip parsing for non-musl systems
35#
36COMPATIBLE_HOST = ".*-musl.*"
37RDEPENDS_${PN}-staticdev = ""
38RDEPENDS_${PN}-dev = ""
39RRECOMMENDS_${PN}-dbg = "${PN}-staticdev (= ${EXTENDPKGV})"
diff --git a/meta/recipes-core/musl/libssp-nonshared/ssp-local.c b/meta/recipes-core/musl/libssp-nonshared/ssp-local.c
new file mode 100644
index 0000000000..8f51afa2c1
--- /dev/null
+++ b/meta/recipes-core/musl/libssp-nonshared/ssp-local.c
@@ -0,0 +1,45 @@
1/* Stack protector support.
2 Copyright (C) 2005-2018 Free Software Foundation, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11In addition to the permissions in the GNU General Public License, the
12Free Software Foundation gives you unlimited permission to link the
13compiled version of this file into combinations with other programs,
14and to distribute those combinations without any restriction coming
15from the use of this file. (The General Public License restrictions
16do apply in other respects; for example, they cover modification of
17the file, and distribution when not linked into a combine
18executable.)
19
20GCC is distributed in the hope that it will be useful, but WITHOUT ANY
21WARRANTY; without even the implied warranty of MERCHANTABILITY or
22FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23for more details.
24
25Under Section 7 of GPL version 3, you are granted additional
26permissions described in the GCC Runtime Library Exception, version
273.1, as published by the Free Software Foundation.
28
29You should have received a copy of the GNU General Public License and
30a copy of the GCC Runtime Library Exception along with this program;
31see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
32<http://www.gnu.org/licenses/>. */
33
34extern void __stack_chk_fail (void);
35
36/* Some targets can avoid loading a GP for calls to hidden functions.
37 Using this entry point may avoid the load of a GP entirely for the
38 function, making the overall code smaller. */
39
40void
41__attribute__((visibility ("hidden")))
42__stack_chk_fail_local (void)
43{
44 __stack_chk_fail ();
45}