summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/musl
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/musl')
-rw-r--r--meta/recipes-core/musl/bsd-headers.bb6
-rw-r--r--meta/recipes-core/musl/bsd-headers/sys-cdefs.h8
-rw-r--r--meta/recipes-core/musl/gcompat/0001-Add-fcntl64-wrapper.patch44
-rw-r--r--meta/recipes-core/musl/gcompat/0001-make-Static-PIE-does-not-work-on-musl-ppc.patch30
-rw-r--r--meta/recipes-core/musl/gcompat_git.bb58
-rw-r--r--meta/recipes-core/musl/libc-test/run-libc-ptests28
-rw-r--r--meta/recipes-core/musl/libc-test/run-ptest3
-rw-r--r--meta/recipes-core/musl/libc-test_git.bb55
-rw-r--r--meta/recipes-core/musl/libssp-nonshared.bb23
-rw-r--r--meta/recipes-core/musl/libssp-nonshared/ssp-local.c45
-rw-r--r--meta/recipes-core/musl/libssp-nonshared/stack_chk.c40
-rw-r--r--meta/recipes-core/musl/libucontext_1.3.2.bb (renamed from meta/recipes-core/musl/libucontext_git.bb)30
-rw-r--r--meta/recipes-core/musl/musl-legacy-error.bb26
-rw-r--r--meta/recipes-core/musl/musl-legacy-error/error.h60
-rw-r--r--meta/recipes-core/musl/musl-locales_git.bb100
-rw-r--r--meta/recipes-core/musl/musl-obstack.bb10
-rw-r--r--meta/recipes-core/musl/musl-utils.bb10
-rw-r--r--meta/recipes-core/musl/musl.inc16
-rw-r--r--meta/recipes-core/musl/musl/0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch22
-rw-r--r--meta/recipes-core/musl/musl/0001-Update-syscalls-for-r32-rv64-from-kernel-6.4-through.patch70
-rw-r--r--meta/recipes-core/musl/musl/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch22
-rw-r--r--meta/recipes-core/musl/musl_git.bb49
22 files changed, 618 insertions, 137 deletions
diff --git a/meta/recipes-core/musl/bsd-headers.bb b/meta/recipes-core/musl/bsd-headers.bb
index c9945d45eb..ad9ba81e4f 100644
--- a/meta/recipes-core/musl/bsd-headers.bb
+++ b/meta/recipes-core/musl/bsd-headers.bb
@@ -15,7 +15,7 @@ do_compile[noexec] = "1"
15 15
16INHIBIT_DEFAULT_DEPS = "1" 16INHIBIT_DEFAULT_DEPS = "1"
17 17
18S = "${WORKDIR}" 18S = "${UNPACKDIR}"
19 19
20do_install() { 20do_install() {
21 install -Dm 0644 ${S}/sys-queue.h ${D}${includedir}/sys/queue.h 21 install -Dm 0644 ${S}/sys-queue.h ${D}${includedir}/sys/queue.h
@@ -27,5 +27,5 @@ do_install() {
27# 27#
28 28
29COMPATIBLE_HOST = ".*-musl.*" 29COMPATIBLE_HOST = ".*-musl.*"
30RDEPENDS_${PN}-dev = "" 30DEV_PKG_DEPENDENCY = ""
31RRECOMMENDS_${PN}-dbg = "${PN}-dev (= ${EXTENDPKGV})" 31RRECOMMENDS:${PN}-dbg = "${PN}-dev (= ${EXTENDPKGV})"
diff --git a/meta/recipes-core/musl/bsd-headers/sys-cdefs.h b/meta/recipes-core/musl/bsd-headers/sys-cdefs.h
index 209a623c0f..841a5da8ba 100644
--- a/meta/recipes-core/musl/bsd-headers/sys-cdefs.h
+++ b/meta/recipes-core/musl/bsd-headers/sys-cdefs.h
@@ -1,3 +1,6 @@
1#ifndef _SYS_CDEFS_H_
2#define _SYS_CDEFS_H_
3
1#warning usage of non-standard #include <sys/cdefs.h> is deprecated 4#warning usage of non-standard #include <sys/cdefs.h> is deprecated
2 5
3#undef __P 6#undef __P
@@ -24,3 +27,8 @@
24# define __THROW 27# define __THROW
25# define __NTH(fct) fct 28# define __NTH(fct) fct
26#endif 29#endif
30
31#define __CONCAT(x,y) x ## y
32#define __STRING(x) #x
33
34#endif /* _SYS_CDEFS_H_ */
diff --git a/meta/recipes-core/musl/gcompat/0001-Add-fcntl64-wrapper.patch b/meta/recipes-core/musl/gcompat/0001-Add-fcntl64-wrapper.patch
new file mode 100644
index 0000000000..3f265e273a
--- /dev/null
+++ b/meta/recipes-core/musl/gcompat/0001-Add-fcntl64-wrapper.patch
@@ -0,0 +1,44 @@
1From 37f70f54c74c4ceeb089cbee88311ba00638f211 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 13 Oct 2023 21:02:23 -0700
4Subject: [PATCH] Add fcntl64 wrapper
5
6fixes loadtime errors with pvr precompiled driver for visionfive2
7
8load libpvr_dri_support.so: Error relocating /usr/lib/libpvr_dri_support.so: fcntl64: symbol not found
9
10Upstream-Status: Submitted [https://git.adelielinux.org/adelie/gcompat/-/merge_requests/28]
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 libgcompat/unistd.c | 11 +++++++++++
14 1 file changed, 11 insertions(+)
15
16diff --git a/libgcompat/unistd.c b/libgcompat/unistd.c
17index 011fba2..400abf3 100644
18--- a/libgcompat/unistd.c
19+++ b/libgcompat/unistd.c
20@@ -1,6 +1,7 @@
21 #include <assert.h> /* assert */
22 #include <fcntl.h> /* O_CREAT */
23 #include <limits.h> /* NGROUPS_MAX */
24+#include <stdarg.h> /* va_list, va_start, va_end */
25 #include <stddef.h> /* NULL, size_t */
26 #include <unistd.h> /* confstr, getcwd, getgroups, ... */
27 #include <errno.h> /* ENOSYS, ENOMEM */
28@@ -250,3 +251,13 @@ int __close(int fd)
29 {
30 return close(fd);
31 }
32+
33+int fcntl64 (int fd, int cmd, ...)
34+{
35+ int ret;
36+ va_list ap;
37+ va_start(ap, cmd);
38+ ret = fcntl(fd, cmd, ap);
39+ va_end(ap);
40+ return ret;
41+}
42--
432.42.0
44
diff --git a/meta/recipes-core/musl/gcompat/0001-make-Static-PIE-does-not-work-on-musl-ppc.patch b/meta/recipes-core/musl/gcompat/0001-make-Static-PIE-does-not-work-on-musl-ppc.patch
new file mode 100644
index 0000000000..1d731163d0
--- /dev/null
+++ b/meta/recipes-core/musl/gcompat/0001-make-Static-PIE-does-not-work-on-musl-ppc.patch
@@ -0,0 +1,30 @@
1From 01180e78fe9568e7fb2673ba61801c42f0f70115 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 11 Mar 2022 10:37:51 -0800
4Subject: [PATCH] make: Static PIE does not work on musl/ppc
5
6Fixes linker error e.g.
7"read-only segment has dynamic relocations"
8
9Upstream-Status: Inappropriate [OE specific]
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 Makefile | 2 +-
13 1 file changed, 1 insertion(+), 1 deletion(-)
14
15diff --git a/Makefile b/Makefile
16index cbb7634..69ee228 100644
17--- a/Makefile
18+++ b/Makefile
19@@ -76,7 +76,7 @@ ${LIBGCOMPAT_NAME}: ${LIBGCOMPAT_OBJ}
20 ${LIBGCOMPAT_OBJ}: ${LIBGCOMPAT_INCLUDE}
21
22 ${LOADER_NAME}: ${LOADER_OBJ}
23- ${CC} ${CFLAGS} ${LDFLAGS} -static-pie -o ${LOADER_NAME} ${LOADER_OBJ}
24+ ${CC} ${CFLAGS} ${LDFLAGS} -static -o ${LOADER_NAME} ${LOADER_OBJ}
25
26 .c.o:
27 ${CC} ${CPPFLAGS} ${CFLAGS} -c -D_BSD_SOURCE \
28--
292.35.1
30
diff --git a/meta/recipes-core/musl/gcompat_git.bb b/meta/recipes-core/musl/gcompat_git.bb
new file mode 100644
index 0000000000..6f9710e71a
--- /dev/null
+++ b/meta/recipes-core/musl/gcompat_git.bb
@@ -0,0 +1,58 @@
1# Copyright (C) 2021 Khem Raj <raj.khem@gmail.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4SUMMARY = "A library which provides glibc-compatible APIs for use on musl libc systems"
5HOMEPAGE = "https://git.adelielinux.org/adelie/gcompat"
6
7LICENSE = "NCSA"
8LIC_FILES_CHKSUM = "file://LICENSE;md5=802b1aed7330d90086be4de63a3188e3"
9
10SRC_URI = "git://git.adelielinux.org/adelie/gcompat.git;protocol=https;branch=current \
11 file://0001-Add-fcntl64-wrapper.patch \
12 "
13SRC_URI:append:powerpc = "\
14 file://0001-make-Static-PIE-does-not-work-on-musl-ppc.patch \
15 "
16PV = "1.1.0"
17SRCREV = "b7bfe0b08c52fdc72e0c1d9d4dcb2129f1642bd6"
18
19inherit pkgconfig linuxloader siteinfo
20
21DEPENDS += "musl-obstack"
22
23GLIBC_LDSO = "${@get_glibc_loader(d)}"
24MUSL_LDSO = "${@get_musl_loader(d)}"
25
26EXTRA_OEMAKE = "LINKER_PATH=${MUSL_LDSO} \
27 LOADER_NAME=`basename ${GLIBC_LDSO}` \
28 "
29
30do_configure () {
31 :
32}
33
34do_compile () {
35 oe_runmake
36}
37
38do_install () {
39 oe_runmake install 'DESTDIR=${D}${root_prefix}'
40 if [ "${SITEINFO_BITS}" = "64" ]; then
41 install -d ${D}${nonarch_base_libdir}${SITEINFO_BITS}
42 ln -rs ${D}${GLIBC_LDSO} ${D}${nonarch_base_libdir}${SITEINFO_BITS}/`basename ${GLIBC_LDSO}`
43 fi
44 install -d ${D}${libdir}
45 ln -sf ${base_libdir}/libgcompat.so.0 ${D}${libdir}/libgcompat.so
46}
47
48FILES:${PN} += "${nonarch_base_libdir}${SITEINFO_BITS}"
49
50INSANE_SKIP:${PN} = "libdir"
51
52RPROVIDES:${PN} += "musl-glibc-compat"
53#
54# We will skip parsing for non-musl systems
55#
56COMPATIBLE_HOST = ".*-musl.*"
57
58UPSTREAM_CHECK_COMMITS = "1"
diff --git a/meta/recipes-core/musl/libc-test/run-libc-ptests b/meta/recipes-core/musl/libc-test/run-libc-ptests
new file mode 100644
index 0000000000..0b4b687dec
--- /dev/null
+++ b/meta/recipes-core/musl/libc-test/run-libc-ptests
@@ -0,0 +1,28 @@
1#!/bin/sh
2
3set -e
4
5cd /opt/libc-test
6make cleanall
7make run || true
8
9echo ""
10echo "--- ptest result ---"
11# libc-test runs tests by module(e.g. src/api) and generates sub-module test
12# report(e.g. src/api/REPORT) first. After all tests finish, it generates the
13# consolidated report file src/REPORT.
14report="/opt/libc-test/src/REPORT"
15if ! [ -f "${report}" ]; then
16 echo "${report} not found!"
17 echo "FAIL: libc-test"
18 exit 1
19# libc-test prints error on failure and prints nothing on success.
20elif grep -q '^FAIL src.*\.exe.*' "${report}"; then
21 # Print test failure in ptest format.
22 # e.g. "FAIL src/api/main.exe [status 1]" -> "FAIL: api_main"
23 grep '^FAIL src.*\.exe.*' "${report}" \
24 | sed 's|^FAIL src/|FAIL: |;s|/|_|;s|\.exe.*\]||'
25 exit 1
26else
27 echo "PASS: libc-test"
28fi
diff --git a/meta/recipes-core/musl/libc-test/run-ptest b/meta/recipes-core/musl/libc-test/run-ptest
new file mode 100644
index 0000000000..53cd34f506
--- /dev/null
+++ b/meta/recipes-core/musl/libc-test/run-ptest
@@ -0,0 +1,3 @@
1#!/bin/sh
2chown -R ptest:ptest /opt/libc-test
3 su -c ./run-libc-ptests ptest
diff --git a/meta/recipes-core/musl/libc-test_git.bb b/meta/recipes-core/musl/libc-test_git.bb
new file mode 100644
index 0000000000..71a111cfa4
--- /dev/null
+++ b/meta/recipes-core/musl/libc-test_git.bb
@@ -0,0 +1,55 @@
1SUMMARY = "Musl libc unit tests"
2HOMEPAGE = "https://wiki.musl-libc.org/libc-test.html"
3DESCRIPTION = "libc-test is a collection of unit tests to measure the \
4correctness and robustness of a C/POSIX standard library implementation. It is \
5developed as part of the musl project."
6SECTION = "tests"
7LICENSE = "MIT"
8LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=43ed1245085be90dc934288117d55a3b"
9
10inherit ptest
11
12SRCREV = "18e28496adee3d84fefdda6efcb9c5b8996a2398"
13SRC_URI = " \
14 git://repo.or.cz/libc-test;branch=master;protocol=https \
15 file://run-ptest \
16 file://run-libc-ptests \
17"
18
19PV = "0+git"
20
21# libc-test 'make' or 'make run' command is designed to build and run tests. It
22# reports both build and test failures. The commands should be run on target.
23do_compile() {
24 :
25}
26
27RDEPENDS:${PN} = " \
28 bash \
29 grep \
30 musl \
31 packagegroup-core-buildessential \
32"
33
34RDEPENDS:${PN}-ptest = " \
35 ${PN} \
36 musl-staticdev \
37 sed \
38"
39
40install_path = "/opt/${PN}"
41FILES:${PN} += "${install_path}/*"
42
43do_install () {
44 install -d ${D}${install_path}/
45 cp ${S}/Makefile ${D}${install_path}
46 cp ${S}/config.mak.def ${D}${install_path}/config.mak
47 cp -r ${S}/src ${D}${install_path}
48}
49
50do_install_ptest_base:append() {
51 install -Dm 0755 ${UNPACKDIR}/run-libc-ptests ${D}${PTEST_PATH}/run-libc-ptests
52}
53
54COMPATIBLE_HOST = "null"
55COMPATIBLE_HOST:libc-musl = "(.*)"
diff --git a/meta/recipes-core/musl/libssp-nonshared.bb b/meta/recipes-core/musl/libssp-nonshared.bb
index bae8c81cc7..4bcbaef7ea 100644
--- a/meta/recipes-core/musl/libssp-nonshared.bb
+++ b/meta/recipes-core/musl/libssp-nonshared.bb
@@ -2,25 +2,26 @@
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
13DEPENDS = "virtual/${TARGET_PREFIX}binutils \ 14DEPENDS = "virtual/cross-binutils \
14 virtual/${TARGET_PREFIX}gcc \ 15 virtual/cross-cc \
15" 16"
16 17
17do_configure[noexec] = "1" 18do_configure[noexec] = "1"
18 19
19S = "${WORKDIR}" 20S = "${UNPACKDIR}"
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
@@ -29,6 +30,6 @@ do_install() {
29# We will skip parsing for non-musl systems 30# We will skip parsing for non-musl systems
30# 31#
31COMPATIBLE_HOST = ".*-musl.*" 32COMPATIBLE_HOST = ".*-musl.*"
32RDEPENDS_${PN}-staticdev = "" 33RDEPENDS:${PN}-staticdev = ""
33RDEPENDS_${PN}-dev = "" 34DEV_PKG_DEPENDENCY = ""
34RRECOMMENDS_${PN}-dbg = "${PN}-staticdev (= ${EXTENDPKGV})" 35RRECOMMENDS:${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
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}
diff --git a/meta/recipes-core/musl/libucontext_git.bb b/meta/recipes-core/musl/libucontext_1.3.2.bb
index 734ad9c953..c5b802207b 100644
--- a/meta/recipes-core/musl/libucontext_git.bb
+++ b/meta/recipes-core/musl/libucontext_1.3.2.bb
@@ -4,16 +4,13 @@
4SUMMARY = "ucontext implementation featuring glibc-compatible ABI" 4SUMMARY = "ucontext implementation featuring glibc-compatible ABI"
5HOMEPAGE = "https://github.com/kaniini/libucontext" 5HOMEPAGE = "https://github.com/kaniini/libucontext"
6LICENSE = "ISC" 6LICENSE = "ISC"
7LIC_FILES_CHKSUM = "file://LICENSE;md5=6eed01fa0e673c76f5a5715438f65b1d" 7LIC_FILES_CHKSUM = "file://LICENSE;md5=ebea527af0602d509b7f4c49533fb1bd"
8SECTION = "libs" 8SECTION = "libs"
9DEPENDS = "" 9DEPENDS = ""
10 10
11PV = "0.10+${SRCPV}" 11SRCREV = "a0323579ac50b9a9d4033754d089f1fed0f59a00"
12SRCREV = "19fa1bbfc26efb92147b5e85cc0ca02a0e837561" 12SRC_URI = "git://github.com/kaniini/libucontext;branch=master;protocol=https \
13SRC_URI = "git://github.com/kaniini/libucontext \ 13 "
14"
15
16S = "${WORKDIR}/git"
17 14
18COMPATIBLE_HOST = ".*-musl.*" 15COMPATIBLE_HOST = ".*-musl.*"
19 16
@@ -40,8 +37,8 @@ def map_kernel_arch(a, d):
40 elif re.match('aarch64_be_ilp32$', a): return 'aarch64' 37 elif re.match('aarch64_be_ilp32$', a): return 'aarch64'
41 elif re.match('mips(isa|)(32|)(r6|)(el|)$', a): return 'mips' 38 elif re.match('mips(isa|)(32|)(r6|)(el|)$', a): return 'mips'
42 elif re.match('mips(isa|)64(r6|)(el|)$', a): return 'mips64' 39 elif re.match('mips(isa|)64(r6|)(el|)$', a): return 'mips64'
40 elif re.match('p(pc64|owerpc64)(le)', a): return 'ppc64'
43 elif re.match('p(pc|owerpc)', a): return 'ppc' 41 elif re.match('p(pc|owerpc)', a): return 'ppc'
44 elif re.match('p(pc64|owerpc64)', a): return 'ppc64'
45 elif re.match('riscv64$', a): return 'riscv64' 42 elif re.match('riscv64$', a): return 'riscv64'
46 elif re.match('riscv32$', a): return 'riscv32' 43 elif re.match('riscv32$', a): return 'riscv32'
47 else: 44 else:
@@ -49,16 +46,11 @@ def map_kernel_arch(a, d):
49 return a 46 return a
50 bb.error("cannot map '%s' to a linux kernel architecture" % a) 47 bb.error("cannot map '%s' to a linux kernel architecture" % a)
51 48
52export ARCH = "${@map_kernel_arch(d.getVar('TARGET_ARCH'), d)}" 49EXTRA_OEMESON = "-Dcpu=${@map_kernel_arch(d.getVar('TARGET_ARCH'), d)}"
53 50inherit meson
54CFLAGS += "-Iarch/${ARCH} -Iarch/common"
55
56EXTRA_OEMAKE = "CFLAGS='${CFLAGS}' LDFLAGS='${LDFLAGS}' LIBDIR='${base_libdir}'"
57 51
58do_compile() { 52ARM_TARGET_CPPFLAGS = ""
59 oe_runmake ARCH=${ARCH} 53ARM_TARGET_CPPFLAGS:append:arm = "${@bb.utils.contains('TARGET_FPU', 'hard', ' -DFORCE_HARD_FLOAT', '', d)}"
60} 54ARM_TARGET_CPPFLAGS:append:arm = "${@bb.utils.contains('TARGET_FPU', 'soft', ' -DFORCE_SOFT_FLOAT', '', d)}"
61 55
62do_install() { 56TARGET_CPPFLAGS .= "${ARM_TARGET_CPPFLAGS}"
63 oe_runmake ARCH="${ARCH}" DESTDIR="${D}" install
64}
diff --git a/meta/recipes-core/musl/musl-legacy-error.bb b/meta/recipes-core/musl/musl-legacy-error.bb
new file mode 100644
index 0000000000..b40075c0b6
--- /dev/null
+++ b/meta/recipes-core/musl/musl-legacy-error.bb
@@ -0,0 +1,26 @@
1# Copyright (C) 2023 Khem Raj <raj.khem@gmail.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4SUMMARY = "error API GNU extention implementation"
5LICENSE = "BSD-2-Clause"
6LIC_FILES_CHKSUM = "file://error.h;beginline=1;md5=2ee396b23e8507fbf8f98af0471a77c6"
7SECTION = "devel"
8
9SRC_URI = "file://error.h"
10
11do_configure[noexec] = "1"
12do_compile[noexec] = "1"
13
14INHIBIT_DEFAULT_DEPS = "1"
15
16S = "${UNPACKDIR}"
17
18do_install() {
19 install -Dm 0644 ${S}/error.h -t ${D}${includedir}
20}
21#
22# We will skip parsing for non-musl systems
23#
24COMPATIBLE_HOST = ".*-musl.*"
25DEV_PKG_DEPENDENCY = ""
26RRECOMMENDS:${PN}-dbg = "${PN}-dev (= ${EXTENDPKGV})"
diff --git a/meta/recipes-core/musl/musl-legacy-error/error.h b/meta/recipes-core/musl/musl-legacy-error/error.h
new file mode 100644
index 0000000000..9a4e1f8d00
--- /dev/null
+++ b/meta/recipes-core/musl/musl-legacy-error/error.h
@@ -0,0 +1,60 @@
1#ifndef _ERROR_H_
2#define _ERROR_H_
3
4#include <stdarg.h>
5#include <stdio.h>
6#include <stdlib.h>
7#include <string.h>
8#include <errno.h>
9
10#warning usage of non-standard #include <error.h> is deprecated
11
12static unsigned int error_message_count = 0;
13
14static inline void error(int status, int errnum, const char* format, ...)
15{
16 /* should be fflush(stdout), but that's unspecified if stdout has been closed;
17 * stick with fflush(NULL) for simplicity (glibc checks if the fd is still valid) */
18 fflush(NULL);
19
20 va_list ap;
21 fprintf(stderr, "%s: ", program_invocation_name);
22 va_start(ap, format);
23 vfprintf(stderr, format, ap);
24 va_end(ap);
25 if (errnum)
26 fprintf(stderr, ": %s", strerror(errnum));
27 fprintf(stderr, "\n");
28 error_message_count++;
29 if (status)
30 exit(status);
31}
32
33static int error_one_per_line = 0;
34
35static inline void error_at_line(int status, int errnum, const char *filename,
36 unsigned int linenum, const char *format, ...)
37{
38 va_list ap;
39 if (error_one_per_line) {
40 static const char *old_filename;
41 static int old_linenum;
42 if (linenum == old_linenum && filename == old_filename)
43 return;
44 old_filename = filename;
45 old_linenum = linenum;
46 }
47 fprintf(stderr, "%s: %s:%u: ", program_invocation_name, filename, linenum);
48 va_start(ap, format);
49 vfprintf(stderr, format, ap);
50 va_end(ap);
51 if (errnum)
52 fprintf(stderr, ": %s", strerror(errnum));
53 fprintf(stderr, "\n");
54 error_message_count++;
55 if (status)
56 exit(status);
57}
58
59
60#endif /* _ERROR_H_ */
diff --git a/meta/recipes-core/musl/musl-locales_git.bb b/meta/recipes-core/musl/musl-locales_git.bb
new file mode 100644
index 0000000000..c8510596cf
--- /dev/null
+++ b/meta/recipes-core/musl/musl-locales_git.bb
@@ -0,0 +1,100 @@
1# Copyright (C) 2022 Khem Raj <raj.khem@gmail.com>
2# Released under the MIT license (see COPYING.MIT for the terms)
3#
4SUMMARY = "Locales support for musl"
5HOMEPAGE = "https://git.adelielinux.org/adelie/musl-locales/-/wikis/home"
6LICENSE = "MIT & LGPL-3.0-or-later"
7LIC_FILES_CHKSUM = "file://LICENSE;md5=cf5713fba707073020b1db2acaa73e78 \
8 file://LICENSE.MIT;md5=a4f1c6864a83ddf4b754cdab7d593523"
9
10SRC_URI = "git://git.adelielinux.org/adelie/musl-locales;protocol=https;branch=main"
11
12PV = "1.0+git"
13SRCREV = "5663f5bfd30bf9e1e0ba3fc5fe2da6725969f30e"
14
15DEPENDS = "virtual/libintl gettext-native"
16
17PROVIDES = "virtual/libc-locale"
18
19inherit cmake
20
21# We will skip parsing for non-musl systems
22python () {
23 if d.getVar('TCLIBC') != "musl":
24 raise bb.parse.SkipRecipe("Only use it with Musl C library")
25}
26
27# only locale binaries are under GPL-3.0-or-later others are MIT
28LICENSE:${PN} = "LGPL-3.0-or-later"
29LICENSE:locale-base-cs-cz = "MIT"
30LICENSE:locale-base-de-ch = "MIT"
31LICENSE:locale-base-de-de = "MIT"
32LICENSE:locale-base-en-gb = "MIT"
33LICENSE:locale-base-en-us = "MIT"
34LICENSE:locale-base-es-es = "MIT"
35LICENSE:locale-base-fi-fi = "MIT"
36LICENSE:locale-base-fr-ca = "MIT"
37LICENSE:locale-base-fr-fr = "MIT"
38LICENSE:locale-base-it-it = "MIT"
39LICENSE:locale-base-nb-no = "MIT"
40LICENSE:locale-base-nl-nl = "MIT"
41LICENSE:locale-base-pt-br = "MIT"
42LICENSE:locale-base-pt-pt = "MIT"
43LICENSE:locale-base-ru-ru = "MIT"
44LICENSE:locale-base-sr-rs = "MIT"
45LICENSE:locale-base-sv-se = "MIT"
46
47PACKAGES =+ "locale-base-cs-cz \
48 locale-base-de-ch \
49 locale-base-de-de \
50 locale-base-en-gb \
51 locale-base-en-us \
52 locale-base-es-es \
53 locale-base-fi-fi \
54 locale-base-fr-ca \
55 locale-base-fr-fr \
56 locale-base-it-it \
57 locale-base-nb-no \
58 locale-base-nl-nl \
59 locale-base-pt-br \
60 locale-base-pt-pt \
61 locale-base-ru-ru \
62 locale-base-sr-rs \
63 locale-base-sv-se \
64 "
65FILES:locale-base-cs-cz += "${datadir}/i18n/locales/musl/cs_CZ.UTF-8"
66FILES:locale-base-de-ch += "${datadir}/i18n/locales/musl/de_CH.UTF-8"
67FILES:locale-base-de-de += "${datadir}/i18n/locales/musl/de_DE.UTF-8"
68FILES:locale-base-en-gb += "${datadir}/i18n/locales/musl/en_GB.UTF-8"
69FILES:locale-base-en-us += "${datadir}/i18n/locales/musl/en_US.UTF-8"
70FILES:locale-base-es-es += "${datadir}/i18n/locales/musl/es_ES.UTF-8"
71FILES:locale-base-fi-fi += "${datadir}/i18n/locales/musl/fi_FI.UTF-8"
72FILES:locale-base-fr-ca += "${datadir}/i18n/locales/musl/fr_CA.UTF-8"
73FILES:locale-base-fr-fr += "${datadir}/i18n/locales/musl/fr_FR.UTF-8"
74FILES:locale-base-it-it += "${datadir}/i18n/locales/musl/it_IT.UTF-8"
75FILES:locale-base-nb-no += "${datadir}/i18n/locales/musl/nb_NO.UTF-8"
76FILES:locale-base-nl-nl += "${datadir}/i18n/locales/musl/nl_NL.UTF-8"
77FILES:locale-base-pt-br += "${datadir}/i18n/locales/musl/pt_BR.UTF-8"
78FILES:locale-base-pt-pt += "${datadir}/i18n/locales/musl/pt_PT.UTF-8"
79FILES:locale-base-ru-ru += "${datadir}/i18n/locales/musl/ru_RU.UTF-8"
80FILES:locale-base-sr-rs += "${datadir}/i18n/locales/musl/sr_RS.UTF-8"
81FILES:locale-base-sv-se += "${datadir}/i18n/locales/musl/sv_SE.UTF-8"
82
83RRECOMMENDS:locale-base-cs-cz += "${PN}"
84RRECOMMENDS:locale-base-de-ch += "${PN}"
85RRECOMMENDS:locale-base-de-de += "${PN}"
86RRECOMMENDS:locale-base-en-gb += "${PN}"
87RRECOMMENDS:locale-base-en-us += "${PN}"
88RRECOMMENDS:locale-base-es-es += "${PN}"
89RRECOMMENDS:locale-base-fi-fi += "${PN}"
90RRECOMMENDS:locale-base-fr-ca += "${PN}"
91RRECOMMENDS:locale-base-fr-fr += "${PN}"
92RRECOMMENDS:locale-base-it-it += "${PN}"
93RRECOMMENDS:locale-base-nb-no += "${PN}"
94RRECOMMENDS:locale-base-nl-nl += "${PN}"
95RRECOMMENDS:locale-base-pt-br += "${PN}"
96RRECOMMENDS:locale-base-ru-ru += "${PN}"
97RRECOMMENDS:locale-base-sr-sr += "${PN}"
98RRECOMMENDS:locale-base-sv-se += "${PN}"
99
100UPSTREAM_CHECK_COMMITS = "1"
diff --git a/meta/recipes-core/musl/musl-obstack.bb b/meta/recipes-core/musl/musl-obstack.bb
index 3003935fe5..d8a5ae8d82 100644
--- a/meta/recipes-core/musl/musl-obstack.bb
+++ b/meta/recipes-core/musl/musl-obstack.bb
@@ -4,19 +4,17 @@
4SUMMARY = "A standalone library to implement GNU libc's obstack" 4SUMMARY = "A standalone library to implement GNU libc's obstack"
5DESCRIPTION = "copy + paste of the obstack functions and macros found in GNU gcc libiberty library for use with musl libc" 5DESCRIPTION = "copy + paste of the obstack functions and macros found in GNU gcc libiberty library for use with musl libc"
6HOMEPAGE = "https://github.com/pullmoll/musl-obstack" 6HOMEPAGE = "https://github.com/pullmoll/musl-obstack"
7LICENSE = "GPL-2.0+" 7LICENSE = "GPL-2.0-or-later"
8LIC_FILES_CHKSUM = "file://COPYING;md5=3d23e4eef8243efcaab6f0a438078932" 8LIC_FILES_CHKSUM = "file://COPYING;md5=3d23e4eef8243efcaab6f0a438078932"
9SECTION = "libs" 9SECTION = "libs"
10 10
11PV = "1.1" 11PV = "1.2.3"
12SRCREV = "d2ad66b0df44a4b784956f7f7f2717131ddc05f4" 12SRCREV = "f4385255be1615688c6a5f042277304d7ab288b1"
13SRC_URI = "git://github.com/pullmoll/musl-obstack" 13SRC_URI = "git://github.com/void-linux/musl-obstack;branch=master;protocol=https"
14 14
15UPSTREAM_CHECK_COMMITS = "1" 15UPSTREAM_CHECK_COMMITS = "1"
16 16
17inherit autotools pkgconfig 17inherit autotools pkgconfig
18 18
19S = "${WORKDIR}/git"
20
21COMPATIBLE_HOST = ".*-musl.*" 19COMPATIBLE_HOST = ".*-musl.*"
22 20
diff --git a/meta/recipes-core/musl/musl-utils.bb b/meta/recipes-core/musl/musl-utils.bb
index dd0ce33061..4b685640c8 100644
--- a/meta/recipes-core/musl/musl-utils.bb
+++ b/meta/recipes-core/musl/musl-utils.bb
@@ -1,9 +1,9 @@
1# Copyright (C) 2018 Khem Raj <raj.khem@gmail.com> 1# Copyright (C) 2018 Khem Raj <raj.khem@gmail.com>
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
4DESCRIPTION = "getconf, getent and iconv implementations for musl" 4SUMMARY = "getconf, getent and iconv implementations for musl"
5HOMEPAGE = "https://git.alpinelinux.org/cgit/aports/tree/main/musl" 5HOMEPAGE = "https://git.alpinelinux.org/cgit/aports/tree/main/musl"
6LICENSE = "BSD-2-Clause & GPL-2.0+" 6LICENSE = "BSD-2-Clause & GPL-2.0-or-later"
7LIC_FILES_CHKSUM = "file://LICENSE;md5=9d08215e611db87b357e8674b4b42564" 7LIC_FILES_CHKSUM = "file://LICENSE;md5=9d08215e611db87b357e8674b4b42564"
8SECTION = "utils" 8SECTION = "utils"
9 9
@@ -11,17 +11,15 @@ SECTION = "utils"
11PV = "20170421" 11PV = "20170421"
12 12
13SRCREV = "fb5630138ccabbbc14a19d372096a04e42573c7d" 13SRCREV = "fb5630138ccabbbc14a19d372096a04e42573c7d"
14SRC_URI = "git://github.com/boltlinux/musl-utils" 14SRC_URI = "git://github.com/boltlinux/musl-utils;branch=master;protocol=https"
15 15
16UPSTREAM_CHECK_COMMITS = "1" 16UPSTREAM_CHECK_COMMITS = "1"
17 17
18inherit autotools 18inherit autotools
19 19
20S = "${WORKDIR}/git"
21
22PACKAGES =+ "${PN}-iconv" 20PACKAGES =+ "${PN}-iconv"
23 21
24FILES_${PN}-iconv = "${bindir}/iconv" 22FILES:${PN}-iconv = "${bindir}/iconv"
25 23
26COMPATIBLE_HOST = ".*-musl.*" 24COMPATIBLE_HOST = ".*-musl.*"
27 25
diff --git a/meta/recipes-core/musl/musl.inc b/meta/recipes-core/musl/musl.inc
index 54edfc88e5..ce45de2d23 100644
--- a/meta/recipes-core/musl/musl.inc
+++ b/meta/recipes-core/musl/musl.inc
@@ -9,23 +9,29 @@ standards-conformance and safety."
9HOMEPAGE = "http://www.musl-libc.org/" 9HOMEPAGE = "http://www.musl-libc.org/"
10LICENSE = "MIT" 10LICENSE = "MIT"
11SECTION = "libs" 11SECTION = "libs"
12LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=b03f1cc25363d094011f8f4fd8bcfb68" 12LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=0c2904cdc34777fb4067732bae145506"
13 13
14INHIBIT_DEFAULT_DEPS = "1" 14INHIBIT_DEFAULT_DEPS = "1"
15 15
16FILES_SOLIBSDEV = "" 16FILES_SOLIBSDEV = ""
17FILES_${PN} += "${libdir}/lib*${SOLIBSDEV}" 17FILES:${PN} += "${libdir}/lib*${SOLIBSDEV}"
18INSANE_SKIP_${PN} = "dev-so" 18INSANE_SKIP:${PN} = "dev-so"
19 19
20# Doesn't compile in MIPS16e mode due to use of hand-written 20# Doesn't compile in MIPS16e mode due to use of hand-written
21# assembly 21# assembly
22MIPS_INSTRUCTION_SET = "mips" 22MIPS_INSTRUCTION_SET = "mips"
23 23
24# thumb1 is unsupported 24# thumb1 is unsupported
25ARM_INSTRUCTION_SET_armv5 = "arm" 25ARM_INSTRUCTION_SET:armv5 = "arm"
26ARM_INSTRUCTION_SET_armv4 = "arm" 26ARM_INSTRUCTION_SET:armv4 = "arm"
27 27
28# Enable out of tree build 28# Enable out of tree build
29B = "${WORKDIR}/build" 29B = "${WORKDIR}/build"
30 30
31do_configure[cleandirs] = "${B}" 31do_configure[cleandirs] = "${B}"
32
33python () {
34 multilibs = d.getVar("MULTILIBS")
35 if multilibs:
36 raise bb.parse.SkipRecipe("musl is not compatible with multilibs")
37}
diff --git a/meta/recipes-core/musl/musl/0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch b/meta/recipes-core/musl/musl/0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch
index ba00efe7b3..06ab27f0eb 100644
--- a/meta/recipes-core/musl/musl/0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch
+++ b/meta/recipes-core/musl/musl/0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch
@@ -1,7 +1,7 @@
1From 0ec74744a4cba7c5fdfaa2685995119a4fca0260 Mon Sep 17 00:00:00 2001 1From 665ecc610c261d5e98710aa0c6ccf6e4991eaf58 Mon Sep 17 00:00:00 2001
2From: Amarnath Valluri <amarnath.valluri@intel.com> 2From: Amarnath Valluri <amarnath.valluri@intel.com>
3Date: Wed, 18 Jan 2017 16:14:37 +0200 3Date: Wed, 18 Jan 2017 16:14:37 +0200
4Subject: [PATCH] Make dynamic linker a relative symlink to libc 4Subject: [PATCH 1/2] Make dynamic linker a relative symlink to libc
5 5
6absolute symlink into $(libdir) fails to load in a cross build 6absolute symlink into $(libdir) fails to load in a cross build
7environment, especially when executing qemu in usermode to run target 7environment, especially when executing qemu in usermode to run target
@@ -13,18 +13,19 @@ V2:
13 Make use of 'ln -r' to create relative symlinks, as most fo the distros 13 Make use of 'ln -r' to create relative symlinks, as most fo the distros
14 shipping coreutils 8.16+ 14 shipping coreutils 8.16+
15 15
16Upstream-Status: Pending
16Signed-off-by: Khem Raj <raj.khem@gmail.com> 17Signed-off-by: Khem Raj <raj.khem@gmail.com>
17Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com> 18Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
18--- 19---
19Upstream-Status: Pending
20---
21 Makefile | 2 +- 20 Makefile | 2 +-
22 tools/install.sh | 8 +++++--- 21 tools/install.sh | 8 +++++---
23 2 files changed, 6 insertions(+), 4 deletions(-) 22 2 files changed, 6 insertions(+), 4 deletions(-)
24 23
24diff --git a/Makefile b/Makefile
25index e8cc4436..466d9afd 100644
25--- a/Makefile 26--- a/Makefile
26+++ b/Makefile 27+++ b/Makefile
27@@ -210,7 +210,7 @@ $(DESTDIR)$(includedir)/%: $(srcdir)/inc 28@@ -210,7 +210,7 @@ $(DESTDIR)$(includedir)/%: $(srcdir)/include/%
28 $(INSTALL) -D -m 644 $< $@ 29 $(INSTALL) -D -m 644 $< $@
29 30
30 $(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so 31 $(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so
@@ -33,6 +34,8 @@ Upstream-Status: Pending
33 34
34 install-libs: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),) 35 install-libs: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),)
35 36
37diff --git a/tools/install.sh b/tools/install.sh
38index 855a8ca2..a2e6a5eb 100755
36--- a/tools/install.sh 39--- a/tools/install.sh
37+++ b/tools/install.sh 40+++ b/tools/install.sh
38@@ -6,18 +6,20 @@ 41@@ -6,18 +6,20 @@
@@ -58,12 +61,15 @@ Upstream-Status: Pending
58 m) mode=$OPTARG ;; 61 m) mode=$OPTARG ;;
59 ?) usage ;; 62 ?) usage ;;
60 esac 63 esac
61@@ -48,7 +50,7 @@ trap 'rm -f "$tmp"' EXIT INT QUIT TERM H 64@@ -49,7 +51,7 @@ umask 077
62 umask 077
63 65
64 if test "$symlink" ; then 66 if test "$symlink" ; then
67 umask 000
65-ln -s "$1" "$tmp" 68-ln -s "$1" "$tmp"
66+ln $symlinkflags "$1" "$tmp" 69+ln $symlinkflags "$1" "$tmp"
70 umask 077
67 else 71 else
68 cat < "$1" > "$tmp" 72 cat < "$1" > "$tmp"
69 chmod "$mode" "$tmp" 73--
742.43.0
75
diff --git a/meta/recipes-core/musl/musl/0001-Update-syscalls-for-r32-rv64-from-kernel-6.4-through.patch b/meta/recipes-core/musl/musl/0001-Update-syscalls-for-r32-rv64-from-kernel-6.4-through.patch
new file mode 100644
index 0000000000..78ba903ca6
--- /dev/null
+++ b/meta/recipes-core/musl/musl/0001-Update-syscalls-for-r32-rv64-from-kernel-6.4-through.patch
@@ -0,0 +1,70 @@
1From 31dce8e958f5185e7fda653214da12bbc75f244e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 4 Dec 2024 11:16:43 -0800
4Subject: [PATCH] Update syscalls for r32/rv64 from kernel 6.4 through 6.10
5
6Upstream-Status: Submitted [https://www.openwall.com/lists/musl/2024/12/04/3]
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9 arch/riscv32/bits/syscall.h.in | 11 +++++++++++
10 arch/riscv64/bits/syscall.h.in | 11 +++++++++++
11 2 files changed, 22 insertions(+)
12
13diff --git a/arch/riscv32/bits/syscall.h.in b/arch/riscv32/bits/syscall.h.in
14index 9228d840..a54d9ffc 100644
15--- a/arch/riscv32/bits/syscall.h.in
16+++ b/arch/riscv32/bits/syscall.h.in
17@@ -216,6 +216,7 @@
18 #define __NR_perf_event_open 241
19 #define __NR_accept4 242
20 #define __NR_arch_specific_syscall 244
21+#define __NR_riscv_hwprobe 258
22 #define __NR_prlimit64 261
23 #define __NR_fanotify_init 262
24 #define __NR_fanotify_mark 263
25@@ -295,6 +296,16 @@
26 #define __NR_cachestat 451
27 #define __NR_fchmodat2 452
28 #define __NR_futex __NR_futex_time64
29+#define __NR_map_shadow_stack 453
30+#define __NR_futex_wake 454
31+#define __NR_futex_wait 455
32+#define __NR_futex_requeue 456
33+#define __NR_statmount 457
34+#define __NR_listmount 458
35+#define __NR_lsm_get_self_attr 459
36+#define __NR_lsm_list_modules 461
37+#define __NR_lsm_set_self_attr 460
38+#define __NR_mseal 462
39
40 #define __NR_sysriscv __NR_arch_specific_syscall
41 #define __NR_riscv_flush_icache (__NR_sysriscv + 15)
42diff --git a/arch/riscv64/bits/syscall.h.in b/arch/riscv64/bits/syscall.h.in
43index e362bd0e..6991a89c 100644
44--- a/arch/riscv64/bits/syscall.h.in
45+++ b/arch/riscv64/bits/syscall.h.in
46@@ -242,6 +242,7 @@
47 #define __NR_accept4 242
48 #define __NR_recvmmsg 243
49 #define __NR_arch_specific_syscall 244
50+#define __NR_riscv_hwprobe 258
51 #define __NR_wait4 260
52 #define __NR_prlimit64 261
53 #define __NR_fanotify_init 262
54@@ -304,6 +305,16 @@
55 #define __NR_set_mempolicy_home_node 450
56 #define __NR_cachestat 451
57 #define __NR_fchmodat2 452
58+#define __NR_map_shadow_stack 453
59+#define __NR_futex_wake 454
60+#define __NR_futex_wait 455
61+#define __NR_futex_requeue 456
62+#define __NR_statmount 457
63+#define __NR_listmount 458
64+#define __NR_lsm_get_self_attr 459
65+#define __NR_lsm_list_modules 461
66+#define __NR_lsm_set_self_attr 460
67+#define __NR_mseal 462
68
69 #define __NR_sysriscv __NR_arch_specific_syscall
70 #define __NR_riscv_flush_icache (__NR_sysriscv + 15)
diff --git a/meta/recipes-core/musl/musl/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch b/meta/recipes-core/musl/musl/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch
index 0aeb5eb5c2..04630b32ee 100644
--- a/meta/recipes-core/musl/musl/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch
+++ b/meta/recipes-core/musl/musl/0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch
@@ -1,7 +1,8 @@
1From 5a2886f81dbca3f2ed28eebe7d27d471da278db8 Mon Sep 17 00:00:00 2001 1From e27de983ef70257ca1fd7f5096eea41613612ecf Mon Sep 17 00:00:00 2001
2From: Serhey Popovych <serhe.popovych@gmail.com> 2From: Serhey Popovych <serhe.popovych@gmail.com>
3Date: Tue, 11 Dec 2018 05:44:20 -0500 3Date: Tue, 11 Dec 2018 05:44:20 -0500
4Subject: [PATCH] ldso: Use syslibdir and libdir as default pathes to libdirs 4Subject: [PATCH 2/2] ldso: Use syslibdir and libdir as default pathes to
5 libdirs
5 6
6In absence of /etc/ld-musl-$(ARCH).path ldso uses default path to search 7In absence of /etc/ld-musl-$(ARCH).path ldso uses default path to search
7libraries /lib:/usr/local/lib:/usr/lib. 8libraries /lib:/usr/local/lib:/usr/lib.
@@ -20,6 +21,8 @@ Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
20 ldso/dynlink.c | 4 +++- 21 ldso/dynlink.c | 4 +++-
21 2 files changed, 5 insertions(+), 2 deletions(-) 22 2 files changed, 5 insertions(+), 2 deletions(-)
22 23
24diff --git a/Makefile b/Makefile
25index 466d9afd..d2f458fa 100644
23--- a/Makefile 26--- a/Makefile
24+++ b/Makefile 27+++ b/Makefile
25@@ -47,7 +47,8 @@ CFLAGS_AUTO = -Os -pipe 28@@ -47,7 +47,8 @@ CFLAGS_AUTO = -Os -pipe
@@ -32,18 +35,20 @@ Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
32 CFLAGS_ALL += $(CPPFLAGS) $(CFLAGS_AUTO) $(CFLAGS) 35 CFLAGS_ALL += $(CPPFLAGS) $(CFLAGS_AUTO) $(CFLAGS)
33 36
34 LDFLAGS_ALL = $(LDFLAGS_AUTO) $(LDFLAGS) 37 LDFLAGS_ALL = $(LDFLAGS_AUTO) $(LDFLAGS)
38diff --git a/ldso/dynlink.c b/ldso/dynlink.c
39index 324aa859..7d3ab44c 100644
35--- a/ldso/dynlink.c 40--- a/ldso/dynlink.c
36+++ b/ldso/dynlink.c 41+++ b/ldso/dynlink.c
37@@ -29,6 +29,8 @@ 42@@ -35,6 +35,8 @@ static size_t ldso_page_size;
38 #define realloc __libc_realloc 43 #define realloc __libc_realloc
39 #define free __libc_free 44 #define free __libc_free
40 45
41+#define SYS_PATH_DFLT SYSLIBDIR ":" LIBDIR 46+#define SYS_PATH_DFLT SYSLIBDIR ":" LIBDIR
42+ 47+
43 static void error(const char *, ...); 48 static void error_impl(const char *, ...);
44 49 static void error_noop(const char *, ...);
45 #define MAXP2(a,b) (-(-(a)&-(b))) 50 static void (*error)(const char *, ...) = error_noop;
46@@ -1094,7 +1096,7 @@ static struct dso *load_library(const ch 51@@ -1159,7 +1161,7 @@ static struct dso *load_library(const char *name, struct dso *needed_by)
47 sys_path = ""; 52 sys_path = "";
48 } 53 }
49 } 54 }
@@ -52,3 +57,6 @@ Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
52 fd = path_open(name, sys_path, buf, sizeof buf); 57 fd = path_open(name, sys_path, buf, sizeof buf);
53 } 58 }
54 pathname = buf; 59 pathname = buf;
60--
612.43.0
62
diff --git a/meta/recipes-core/musl/musl_git.bb b/meta/recipes-core/musl/musl_git.bb
index e6f9e2441e..51e429b093 100644
--- a/meta/recipes-core/musl/musl_git.bb
+++ b/meta/recipes-core/musl/musl_git.bb
@@ -4,25 +4,22 @@
4require musl.inc 4require musl.inc
5inherit linuxloader 5inherit linuxloader
6 6
7SRCREV = "e5d2823631bbfebacf48e1a34ed28f28d7cb2570" 7SRCREV = "ae3a8c93a663b553e65f096498937083dad210d2"
8 8
9BASEVER = "1.2.2" 9BASEVER = "1.2.5"
10 10
11PV = "${BASEVER}+git${SRCPV}" 11PV = "${BASEVER}+git"
12 12
13# mirror is at git://github.com/kraj/musl.git 13SRC_URI = "git://git.musl-libc.org/musl;branch=master \
14
15SRC_URI = "git://git.musl-libc.org/musl \
16 file://0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch \ 14 file://0001-Make-dynamic-linker-a-relative-symlink-to-libc.patch \
17 file://0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch \ 15 file://0002-ldso-Use-syslibdir-and-libdir-as-default-pathes-to-l.patch \
16 file://0001-Update-syscalls-for-r32-rv64-from-kernel-6.4-through.patch \
18 " 17 "
19 18
20S = "${WORKDIR}/git"
21
22PROVIDES += "virtual/libc virtual/libiconv virtual/libintl virtual/crypt" 19PROVIDES += "virtual/libc virtual/libiconv virtual/libintl virtual/crypt"
23 20
24DEPENDS = "virtual/${TARGET_PREFIX}binutils \ 21DEPENDS = "virtual/cross-binutils \
25 virtual/${TARGET_PREFIX}gcc \ 22 virtual/cross-cc \
26 libgcc-initial \ 23 libgcc-initial \
27 linux-libc-headers \ 24 linux-libc-headers \
28 bsd-headers \ 25 bsd-headers \
@@ -31,7 +28,7 @@ DEPENDS = "virtual/${TARGET_PREFIX}binutils \
31GLIBC_LDSO = "${@get_glibc_loader(d)}" 28GLIBC_LDSO = "${@get_glibc_loader(d)}"
32MUSL_LDSO_ARCH = "${@get_musl_loader_arch(d)}" 29MUSL_LDSO_ARCH = "${@get_musl_loader_arch(d)}"
33 30
34export CROSS_COMPILE="${TARGET_PREFIX}" 31export CROSS_COMPILE = "${TARGET_PREFIX}"
35 32
36LDFLAGS += "-Wl,-soname,libc.so" 33LDFLAGS += "-Wl,-soname,libc.so"
37 34
@@ -41,7 +38,7 @@ LDFLAGS += "-Wl,-soname,libc.so"
41# disabled automatically due to the optimisation level, but append an explicit 38# disabled automatically due to the optimisation level, but append an explicit
42# -fomit-frame-pointer to handle cases where optimisation is set to -O0 or frame 39# -fomit-frame-pointer to handle cases where optimisation is set to -O0 or frame
43# pointers have been enabled by -fno-omit-frame-pointer earlier in CFLAGS, etc. 40# pointers have been enabled by -fno-omit-frame-pointer earlier in CFLAGS, etc.
44CFLAGS_append_arm = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}" 41CFLAGS:append:arm = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}"
45 42
46CONFIGUREOPTS = " \ 43CONFIGUREOPTS = " \
47 --prefix=${prefix} \ 44 --prefix=${prefix} \
@@ -49,7 +46,7 @@ CONFIGUREOPTS = " \
49 --bindir=${bindir} \ 46 --bindir=${bindir} \
50 --libdir=${libdir} \ 47 --libdir=${libdir} \
51 --includedir=${includedir} \ 48 --includedir=${includedir} \
52 --syslibdir=/lib \ 49 --syslibdir=${nonarch_base_libdir} \
53" 50"
54 51
55do_configure() { 52do_configure() {
@@ -62,28 +59,26 @@ do_compile() {
62 59
63do_install() { 60do_install() {
64 oe_runmake install DESTDIR='${D}' 61 oe_runmake install DESTDIR='${D}'
65 install -d ${D}${bindir} ${D}/lib ${D}${sysconfdir} 62 install -d ${D}${bindir} ${D}${sysconfdir}
66 echo "${base_libdir}" > ${D}${sysconfdir}/ld-musl-${MUSL_LDSO_ARCH}.path 63 echo "${base_libdir}" > ${D}${sysconfdir}/ld-musl-${MUSL_LDSO_ARCH}.path
67 echo "${libdir}" >> ${D}${sysconfdir}/ld-musl-${MUSL_LDSO_ARCH}.path 64 echo "${libdir}" >> ${D}${sysconfdir}/ld-musl-${MUSL_LDSO_ARCH}.path
68 rm -f ${D}${bindir}/ldd ${D}${GLIBC_LDSO} 65 rm -f ${D}${bindir}/ldd ${D}${GLIBC_LDSO}
69 lnr ${D}${libdir}/libc.so ${D}${bindir}/ldd 66 ln -rs ${D}${libdir}/libc.so ${D}${bindir}/ldd
70 lnr ${D}${libdir}/libc.so ${D}${GLIBC_LDSO}
71} 67}
72 68
73PACKAGES =+ "${PN}-glibc-compat" 69FILES:${PN} += "${nonarch_base_libdir}/ld-musl-${MUSL_LDSO_ARCH}.so.1 ${sysconfdir}/ld-musl-${MUSL_LDSO_ARCH}.path"
74 70FILES:${PN}-staticdev = "${libdir}/libc.a"
75FILES_${PN} += "/lib/ld-musl-${MUSL_LDSO_ARCH}.so.1 ${sysconfdir}/ld-musl-${MUSL_LDSO_ARCH}.path" 71FILES:${PN}-dev =+ "${libdir}/libcrypt.a ${libdir}/libdl.a ${libdir}/libm.a \
76FILES_${PN}-glibc-compat += "${GLIBC_LDSO}"
77FILES_${PN}-staticdev = "${libdir}/libc.a"
78FILES_${PN}-dev =+ "${libdir}/libcrypt.a ${libdir}/libdl.a ${libdir}/libm.a \
79 ${libdir}/libpthread.a ${libdir}/libresolv.a \ 72 ${libdir}/libpthread.a ${libdir}/libresolv.a \
80 ${libdir}/librt.a ${libdir}/libutil.a ${libdir}/libxnet.a \ 73 ${libdir}/librt.a ${libdir}/libutil.a ${libdir}/libxnet.a \
81 " 74 "
82 75
83RDEPENDS_${PN}-dev += "linux-libc-headers-dev bsd-headers-dev libssp-nonshared-staticdev" 76RDEPENDS:${PN}-dev += "linux-libc-headers-dev bsd-headers-dev libssp-nonshared-staticdev"
84RPROVIDES_${PN}-dev += "libc-dev virtual-libc-dev" 77RPROVIDES:${PN}-dev += "libc-dev virtual-libc-dev"
85RPROVIDES_${PN} += "ldd libsegfault rtld(GNU_HASH)" 78RPROVIDES:${PN} += "ldd rtld(GNU_HASH)"
86 79
87LEAD_SONAME = "libc.so" 80LEAD_SONAME = "libc.so"
88INSANE_SKIP_${PN}-dev = "staticdev" 81INSANE_SKIP:${PN}-dev = "staticdev"
89INSANE_SKIP_${PN} = "libdir" 82INSANE_SKIP:${PN} = "libdir"
83
84UPSTREAM_CHECK_COMMITS = "1"