Browse Source

musl: added patches from upstream and created compatibility symlinks.

tc-work-musl-mess
Nagy Károly Gábriel 8 years ago
parent
commit
5a06fa3243
3 changed files with 138 additions and 3 deletions
  1. +52
    -0
      base/musl/0008-fix-undefined-pointer-comparison-in-stdio-internal-_.patch
  2. +78
    -0
      base/musl/0009-fix-regression-disabling-use-of-pause-instruction-fo.patch
  3. +8
    -3
      base/musl/musl.conf

+ 52
- 0
base/musl/0008-fix-undefined-pointer-comparison-in-stdio-internal-_.patch

@ -0,0 +1,52 @@
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../musl/0008-fix-undefined-pointer-comparison-in-stdio-internal-_.patch
# Copyright (C) 2016 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- SDE-COPYRIGHT-NOTE-END ---
From 6d1a3dfeaf2caac4033a3c65822fb4e7e14866c7 Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
Date: Mon, 28 Mar 2016 23:41:17 -0400
Subject: [PATCH] fix undefined pointer comparison in stdio-internal __toread
the comparison f->wpos > f->buf has undefined behavior when f->wpos is
a null pointer, despite the intuition (and actual compiler behavior,
for all known compilers) being that NULL > ptr is false for all valid
pointers ptr.
the purpose of the comparison is to determine if the write buffer is
non-empty, and the idiom used elsewhere for that is comparison against
f->wbase, which is either a null pointer when not writing, or equal to
f->buf when writing. in the former case, both f->wpos and f->wbase are
null; in the latter they are both non-null and point into the same
array.
---
src/stdio/__toread.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/stdio/__toread.c b/src/stdio/__toread.c
index b08f5bb..35f67b8 100644
--- a/src/stdio/__toread.c
+++ b/src/stdio/__toread.c
@@ -3,7 +3,7 @@
int __toread(FILE *f)
{
f->mode |= f->mode-1;
- if (f->wpos > f->buf) f->write(f, 0, 0);
+ if (f->wpos > f->wbase) f->write(f, 0, 0);
f->wpos = f->wbase = f->wend = 0;
if (f->flags & F_NORD) {
f->flags |= F_ERR;
--
2.7.4

+ 78
- 0
base/musl/0009-fix-regression-disabling-use-of-pause-instruction-fo.patch

@ -0,0 +1,78 @@
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../musl/0009-fix-regression-disabling-use-of-pause-instruction-fo.patch
# Copyright (C) 2016 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- SDE-COPYRIGHT-NOTE-END ---
From 5c3412d22555d03a1c00578ba8faaa8dc9206420 Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
Date: Tue, 29 Mar 2016 21:22:52 -0400
Subject: [PATCH] fix regression disabling use of pause instruction for x86
a_spin
commits e24984efd5c6ac5ea8e6cb6cd914fa8435d458bc and
16b55298dc4b6a54d287d7494e04542667ef8861 inadvertently disabled the
a_spin implementations for i386, x86_64, and x32 by defining a macro
named a_pause instead of a_spin. this should not have caused any
functional regression, but it inhibited cpu relaxation while spinning
for locks.
bug reported by George Kulakowski.
---
arch/i386/atomic_arch.h | 2 +-
arch/x32/atomic_arch.h | 2 +-
arch/x86_64/atomic_arch.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/i386/atomic_arch.h b/arch/i386/atomic_arch.h
index 6e67c4c..2b1a049 100644
--- a/arch/i386/atomic_arch.h
+++ b/arch/i386/atomic_arch.h
@@ -71,7 +71,7 @@ static inline void a_barrier()
__asm__ __volatile__( "" : : : "memory" );
}
-#define a_pause a_pause
+#define a_spin a_spin
static inline void a_spin()
{
__asm__ __volatile__( "pause" : : : "memory" );
diff --git a/arch/x32/atomic_arch.h b/arch/x32/atomic_arch.h
index 26098d3..7daf4ae 100644
--- a/arch/x32/atomic_arch.h
+++ b/arch/x32/atomic_arch.h
@@ -87,7 +87,7 @@ static inline void a_barrier()
__asm__ __volatile__( "" : : : "memory" );
}
-#define a_pause a_pause
+#define a_spin a_spin
static inline void a_spin()
{
__asm__ __volatile__( "pause" : : : "memory" );
diff --git a/arch/x86_64/atomic_arch.h b/arch/x86_64/atomic_arch.h
index 9f47f80..55fc6fb 100644
--- a/arch/x86_64/atomic_arch.h
+++ b/arch/x86_64/atomic_arch.h
@@ -96,7 +96,7 @@ static inline void a_barrier()
__asm__ __volatile__( "" : : : "memory" );
}
-#define a_pause a_pause
+#define a_spin a_spin
static inline void a_spin()
{
__asm__ __volatile__( "pause" : : : "memory" );
--
2.7.4

+ 8
- 3
base/musl/musl.conf

@ -18,8 +18,11 @@ musl_arch="$( echo $arch | arch2uname )"
if [ $prefix_auto == 1 ]; then
syslibdir="/lib"
fi
var_append configprefix ' ' "LDFLAGS=\"$LDFLAGS -Wl,-soname,libc.musl-$arch.so.1\""
if atstage toolchain; then
var_append extraconfopt ' ' '--host=$arch_build'
confopt="--prefix=$base/build/$SDECFG_ID/usr \$extraconfopt"
makeopt="ARCH=$musl_arch"
@ -42,6 +45,11 @@ musl_postinstall() {
# was started as "ldd" it will print DSO information
ln -vsf $( relative_path $root$syslibdir/$LDSO $root$bindir/ldd ) \
$root$bindir/ldd
# make some compat links for various libraries
for i in libc.so.6 libcrypt.so.1 libm.so.6 libpthread.so.0 librt.so.1 libutil.so.1; do
ln -sf $root$syslibdir/$LIBCSO $root$syslibdir/$i
done
}
musl_make_utils() {
@ -66,6 +74,3 @@ if [ "$SDECFG_LIBC" == "musl" ]; then
hook_add postpatch 5 'musl_make_utils'
fi
# always install the headers even if already present in the sandbox
#hook_add postpatch 9 "touch include/*.h include/*/*.h arch/$musl_arch/*.h arch/$musl_arch/*/*.h"
#var_append makeinstopt ' ' "install-headers"

Loading…
Cancel
Save