diff options
author | Khem Raj <raj.khem@gmail.com> | 2021-06-10 19:44:35 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-06-12 22:54:13 +0100 |
commit | 957bab13efc76662e6178b55987fe288b8f66611 (patch) | |
tree | da0ea4462ec1fd3e38c7d3ba640c29863b0cb4a0 /meta/recipes-core | |
parent | 59d93693bf24e02ca0f05fe06d96a46f4f0f1bf8 (diff) | |
download | poky-957bab13efc76662e6178b55987fe288b8f66611.tar.gz |
libssp-nonshared: Use a different implementation for __stack_chk_fail
(From OE-Core rev: 8c4958cd53ce9265c2639dd3a90d38848edc3895)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r-- | meta/recipes-core/musl/libssp-nonshared.bb | 11 | ||||
-rw-r--r-- | meta/recipes-core/musl/libssp-nonshared/ssp-local.c | 45 | ||||
-rw-r--r-- | meta/recipes-core/musl/libssp-nonshared/stack_chk.c | 40 |
3 files changed, 46 insertions, 50 deletions
diff --git a/meta/recipes-core/musl/libssp-nonshared.bb b/meta/recipes-core/musl/libssp-nonshared.bb index bae8c81cc7..81c87e8e8d 100644 --- a/meta/recipes-core/musl/libssp-nonshared.bb +++ b/meta/recipes-core/musl/libssp-nonshared.bb | |||
@@ -2,11 +2,12 @@ | |||
2 | # Released under the MIT license (see COPYING.MIT for the terms) | 2 | # Released under the MIT license (see COPYING.MIT for the terms) |
3 | 3 | ||
4 | SUMMARY = "Minimal libssp_nonshared.a must needed for ssp to work with gcc on musl" | 4 | SUMMARY = "Minimal libssp_nonshared.a must needed for ssp to work with gcc on musl" |
5 | LICENSE = "GPL-3.0-with-GCC-exception" | 5 | LICENSE = "BSD-3-Clause" |
6 | LIC_FILES_CHKSUM = "file://ssp-local.c;beginline=1;endline=32;md5=c06d391208c0cfcbc541a6728ed65cc4" | 6 | LIC_FILES_CHKSUM = "file://stack_chk.c;beginline=1;endline=30;md5=97e59d9deee678a9332c9ddb2ab6360d" |
7 | SECTION = "libs" | 7 | SECTION = "libs" |
8 | 8 | ||
9 | SRC_URI = "file://ssp-local.c" | 9 | # Sourced from https://github.com/intel/linux-sgx/blob/master/sdk/compiler-rt/stack_chk.c |
10 | SRC_URI = "file://stack_chk.c" | ||
10 | 11 | ||
11 | INHIBIT_DEFAULT_DEPS = "1" | 12 | INHIBIT_DEFAULT_DEPS = "1" |
12 | 13 | ||
@@ -19,8 +20,8 @@ do_configure[noexec] = "1" | |||
19 | S = "${WORKDIR}" | 20 | S = "${WORKDIR}" |
20 | 21 | ||
21 | do_compile() { | 22 | do_compile() { |
22 | ${CC} ${CPPFLAGS} ${CFLAGS} -fPIE -c ssp-local.c -o ssp-local.o | 23 | ${CC} ${CPPFLAGS} ${CFLAGS} -fPIE -c stack_chk.c -o stack_chk.o |
23 | ${AR} r libssp_nonshared.a ssp-local.o | 24 | ${AR} r libssp_nonshared.a stack_chk.o |
24 | } | 25 | } |
25 | do_install() { | 26 | do_install() { |
26 | install -Dm 0644 ${B}/libssp_nonshared.a ${D}${base_libdir}/libssp_nonshared.a | 27 | install -Dm 0644 ${B}/libssp_nonshared.a ${D}${base_libdir}/libssp_nonshared.a |
diff --git a/meta/recipes-core/musl/libssp-nonshared/ssp-local.c b/meta/recipes-core/musl/libssp-nonshared/ssp-local.c deleted file mode 100644 index 8f51afa2c1..0000000000 --- a/meta/recipes-core/musl/libssp-nonshared/ssp-local.c +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | /* Stack protector support. | ||
2 | Copyright (C) 2005-2018 Free Software Foundation, Inc. | ||
3 | |||
4 | This file is part of GCC. | ||
5 | |||
6 | GCC is free software; you can redistribute it and/or modify it under | ||
7 | the terms of the GNU General Public License as published by the Free | ||
8 | Software Foundation; either version 3, or (at your option) any later | ||
9 | version. | ||
10 | |||
11 | In addition to the permissions in the GNU General Public License, the | ||
12 | Free Software Foundation gives you unlimited permission to link the | ||
13 | compiled version of this file into combinations with other programs, | ||
14 | and to distribute those combinations without any restriction coming | ||
15 | from the use of this file. (The General Public License restrictions | ||
16 | do apply in other respects; for example, they cover modification of | ||
17 | the file, and distribution when not linked into a combine | ||
18 | executable.) | ||
19 | |||
20 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY | ||
21 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
22 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
23 | for more details. | ||
24 | |||
25 | Under Section 7 of GPL version 3, you are granted additional | ||
26 | permissions described in the GCC Runtime Library Exception, version | ||
27 | 3.1, as published by the Free Software Foundation. | ||
28 | |||
29 | You should have received a copy of the GNU General Public License and | ||
30 | a copy of the GCC Runtime Library Exception along with this program; | ||
31 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | ||
32 | <http://www.gnu.org/licenses/>. */ | ||
33 | |||
34 | extern 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 | |||
40 | void | ||
41 | __attribute__((visibility ("hidden"))) | ||
42 | __stack_chk_fail_local (void) | ||
43 | { | ||
44 | __stack_chk_fail (); | ||
45 | } | ||
diff --git a/meta/recipes-core/musl/libssp-nonshared/stack_chk.c b/meta/recipes-core/musl/libssp-nonshared/stack_chk.c new file mode 100644 index 0000000000..097aae24b6 --- /dev/null +++ b/meta/recipes-core/musl/libssp-nonshared/stack_chk.c | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011-2021 Intel Corporation. All rights reserved. | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions | ||
6 | * are met: | ||
7 | * | ||
8 | * * Redistributions of source code must retain the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer. | ||
10 | * * Redistributions in binary form must reproduce the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer in | ||
12 | * the documentation and/or other materials provided with the | ||
13 | * distribution. | ||
14 | * * Neither the name of Intel Corporation nor the names of its | ||
15 | * contributors may be used to endorse or promote products derived | ||
16 | * from this software without specific prior written permission. | ||
17 | * | ||
18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
21 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
22 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
23 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
24 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
29 | * | ||
30 | */ | ||
31 | |||
32 | extern void __attribute__((noreturn)) __stack_chk_fail(void); | ||
33 | |||
34 | void | ||
35 | __attribute__((noreturn)) | ||
36 | __attribute__((visibility ("hidden"))) | ||
37 | __stack_chk_fail_local (void) | ||
38 | { | ||
39 | __stack_chk_fail (); | ||
40 | } | ||