summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core')
-rw-r--r--meta/recipes-core/musl/libssp-nonshared.bb11
-rw-r--r--meta/recipes-core/musl/libssp-nonshared/ssp-local.c45
-rw-r--r--meta/recipes-core/musl/libssp-nonshared/stack_chk.c40
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
4SUMMARY = "Minimal libssp_nonshared.a must needed for ssp to work with gcc on musl" 4SUMMARY = "Minimal libssp_nonshared.a must needed for ssp to work with gcc on musl"
5LICENSE = "GPL-3.0-with-GCC-exception" 5LICENSE = "BSD-3-Clause"
6LIC_FILES_CHKSUM = "file://ssp-local.c;beginline=1;endline=32;md5=c06d391208c0cfcbc541a6728ed65cc4" 6LIC_FILES_CHKSUM = "file://stack_chk.c;beginline=1;endline=30;md5=97e59d9deee678a9332c9ddb2ab6360d"
7SECTION = "libs" 7SECTION = "libs"
8 8
9SRC_URI = "file://ssp-local.c" 9# Sourced from https://github.com/intel/linux-sgx/blob/master/sdk/compiler-rt/stack_chk.c
10SRC_URI = "file://stack_chk.c"
10 11
11INHIBIT_DEFAULT_DEPS = "1" 12INHIBIT_DEFAULT_DEPS = "1"
12 13
@@ -19,8 +20,8 @@ do_configure[noexec] = "1"
19S = "${WORKDIR}" 20S = "${WORKDIR}"
20 21
21do_compile() { 22do_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}
25do_install() { 26do_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
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}
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
32extern void __attribute__((noreturn)) __stack_chk_fail(void);
33
34void
35__attribute__((noreturn))
36__attribute__((visibility ("hidden")))
37__stack_chk_fail_local (void)
38{
39 __stack_chk_fail ();
40}