aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/libc0.9.32/APKBUILD4
-rw-r--r--main/libc0.9.32/uclibc-libm-pic.patch67
2 files changed, 70 insertions, 1 deletions
diff --git a/main/libc0.9.32/APKBUILD b/main/libc0.9.32/APKBUILD
index db7a9b0c18..84fe97a842 100644
--- a/main/libc0.9.32/APKBUILD
+++ b/main/libc0.9.32/APKBUILD
@@ -3,7 +3,7 @@ _abiver=0.9.32
pkgname=libc$_abiver
_gitver=100507
pkgver=${_abiver}_alpha0_git$_gitver
-pkgrel=0
+pkgrel=1
pkgdesc="C library for developing embedded Linux systems"
url=http://uclibc.org
license="LGPL-2"
@@ -19,6 +19,7 @@ source="http://build.alpinelinux.org:8010/distfiles/$_snapfile
compat-stack-guard.patch
0001-static-build-fix-internal-locking-weaks-to-get-pulle.patch
0002-resolv-various-memory-corruption-and-off-by-one-fixe.patch
+ uclibc-libm-pic.patch
uclibcconfig.x86
uclibcconfig.i486
"
@@ -96,5 +97,6 @@ md5sums="46e98672dc2a4309d9a7c65b4e626845 libc0.9.32-0.9.32_alpha0_git100507.ta
4d408f72142ce55a0754948cc9cfe447 compat-stack-guard.patch
826666b365f2d63a71d67eb76c94f7bc 0001-static-build-fix-internal-locking-weaks-to-get-pulle.patch
0800a489a738c7b1d8c3643cb9806926 0002-resolv-various-memory-corruption-and-off-by-one-fixe.patch
+2f9739a980be24a842c57516155c7885 uclibc-libm-pic.patch
e2eb3bb00a0fe4d6f3d5b5c56b027bab uclibcconfig.x86
e2eb3bb00a0fe4d6f3d5b5c56b027bab uclibcconfig.i486"
diff --git a/main/libc0.9.32/uclibc-libm-pic.patch b/main/libc0.9.32/uclibc-libm-pic.patch
new file mode 100644
index 0000000000..ad87b78b24
--- /dev/null
+++ b/main/libc0.9.32/uclibc-libm-pic.patch
@@ -0,0 +1,67 @@
+GCC can emit prologue/epilogue code for the functions in various
+different cases:
+ - frame pointers
+ - PIC build (to load ebx for indirect calls/jumps)
+ - forced stack smashing protection
+
+If we used jump in such cases, we'd corrupt the call stack and
+crash.
+
+Signed-off-by: Timo Teräs <timo.teras at iki.fi>
+---
+ libm/ldouble_wrappers.c | 12 +++++++-----
+ 1 files changed, 7 insertions(+), 5 deletions(-)
+
+diff --git a/libm/ldouble_wrappers.c b/libm/ldouble_wrappers.c
+index 7d5af90..5b424dc 100644
+--- a/libm/ldouble_wrappers.c
++++ b/libm/ldouble_wrappers.c
+@@ -60,7 +60,9 @@ long long func##l(long double x) \
+ * The return value is returned in st(0) per ABI in both cases (returning
+ * a long double or returning a double). So we can simply jump to func.
+ * Using __GI_func in jump to make optimized intra-library jump.
+- * gcc will still generate a useless "ret" after asm. Oh well...
++ *
++ * We do need to use call (instead of tail jump) as gcc can create
++ * stack frame, and push/modify/pop ebx during PIC build.
+ */
+ # define WRAPPER1(func) \
+ long double func##l(long double x) \
+@@ -69,7 +71,7 @@ long double func##l(long double x) \
+ __asm ( \
+ " fldt %1\n" \
+ " fstpl %1\n" \
+- " jmp " __stringify(__GI_##func) "\n" \
++ " call " __stringify(__GI_##func) "\n" \
+ : "=t" (st_top) \
+ : "m" (x) \
+ ); \
+@@ -82,7 +84,7 @@ int func##l(long double x) \
+ __asm ( \
+ " fldt %1\n" \
+ " fstpl %1\n" \
+- " jmp " __stringify(__GI_##func) "\n" \
++ " call " __stringify(__GI_##func) "\n" \
+ : "=a" (ret) \
+ : "m" (x) \
+ ); \
+@@ -95,7 +97,7 @@ long func##l(long double x) \
+ __asm ( \
+ " fldt %1\n" \
+ " fstpl %1\n" \
+- " jmp " __stringify(__GI_##func) "\n" \
++ " call " __stringify(__GI_##func) "\n" \
+ : "=a" (ret) \
+ : "m" (x) \
+ ); \
+@@ -108,7 +110,7 @@ long long func##l(long double x) \
+ __asm ( \
+ " fldt %1\n" \
+ " fstpl %1\n" \
+- " jmp " __stringify(__GI_##func) "\n" \
++ " call " __stringify(__GI_##func) "\n" \
+ : "=A" (ret) \
+ : "m" (x) \
+ ); \
+--
+1.7.0.4