aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-11-11 14:06:29 +0200
committerTimo Teräs <timo.teras@iki.fi>2011-11-11 14:17:24 +0200
commit6f8933ee7b806ed757664856433e47e315c4019a (patch)
treea4173e3350245e42e4ad814a71af265a800e91a1
parent55d08e35363c3ac6741723c20b3559002585ff6f (diff)
downloadalpine_aports-6f8933ee7b806ed757664856433e47e315c4019a.tar.bz2
alpine_aports-6f8933ee7b806ed757664856433e47e315c4019a.tar.xz
alpine_aports-6f8933ee7b806ed757664856433e47e315c4019a.zip
main/libc0.9.32: improve the stack unwinding fix
should now work with all syscalls
-rw-r--r--main/libc0.9.32/0001-libc-x86-fix-stack-unwinding-and-backtrace-informati.patch120
-rw-r--r--main/libc0.9.32/APKBUILD4
2 files changed, 92 insertions, 32 deletions
diff --git a/main/libc0.9.32/0001-libc-x86-fix-stack-unwinding-and-backtrace-informati.patch b/main/libc0.9.32/0001-libc-x86-fix-stack-unwinding-and-backtrace-informati.patch
index 87a1758523..62c1456949 100644
--- a/main/libc0.9.32/0001-libc-x86-fix-stack-unwinding-and-backtrace-informati.patch
+++ b/main/libc0.9.32/0001-libc-x86-fix-stack-unwinding-and-backtrace-informati.patch
@@ -1,7 +1,7 @@
1From 80db5b343bd44806881d400a8627cb526ffccee7 Mon Sep 17 00:00:00 2001 1From 5f72f80e7ea0e3429c28ff5de7ca88cdd95e8904 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi> 2From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
3Date: Thu, 10 Nov 2011 09:36:44 +0200 3Date: Thu, 10 Nov 2011 09:36:44 +0200
4Subject: [PATCH] libc/x86: fix stack unwinding and backtrace information 4Subject: [PATCHv2] libc/x86: fix stack unwinding and backtrace information
5MIME-Version: 1.0 5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8 6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit 7Content-Transfer-Encoding: 8bit
@@ -11,6 +11,7 @@ for proper stack unwinding.
11 11
12This patch adds the CFI information to: 12This patch adds the CFI information to:
13 * syscalls (so we get proper backtrace even for release builds) 13 * syscalls (so we get proper backtrace even for release builds)
14 the ebx hack was removed as it would complicate the CFI generation
14 * new thread stub function (so the backtrace is clean for user 15 * new thread stub function (so the backtrace is clean for user
15 created threads) 16 created threads)
16 17
@@ -25,13 +26,13 @@ signal return frame.
25 26
26Signed-off-by: Timo Teräs <timo.teras@iki.fi> 27Signed-off-by: Timo Teräs <timo.teras@iki.fi>
27--- 28---
28 libc/sysdeps/linux/i386/bits/syscalls.h | 13 +++++++++---- 29 libc/sysdeps/linux/i386/bits/syscalls.h | 82 +++----------------------------
29 libc/sysdeps/linux/i386/clone.S | 17 +++++++++++++++++ 30 libc/sysdeps/linux/i386/clone.S | 17 ++++++
30 libc/sysdeps/linux/i386/sigaction.c | 4 ++++ 31 libc/sysdeps/linux/i386/sigaction.c | 4 ++
31 3 files changed, 30 insertions(+), 4 deletions(-) 32 3 files changed, 28 insertions(+), 75 deletions(-)
32 33
33diff --git a/libc/sysdeps/linux/i386/bits/syscalls.h b/libc/sysdeps/linux/i386/bits/syscalls.h 34diff --git a/libc/sysdeps/linux/i386/bits/syscalls.h b/libc/sysdeps/linux/i386/bits/syscalls.h
34index eeafb3a..47d0b4c 100644 35index eeafb3a..1f60a44 100644
35--- a/libc/sysdeps/linux/i386/bits/syscalls.h 36--- a/libc/sysdeps/linux/i386/bits/syscalls.h
36+++ b/libc/sysdeps/linux/i386/bits/syscalls.h 37+++ b/libc/sysdeps/linux/i386/bits/syscalls.h
37@@ -13,6 +13,7 @@ 38@@ -13,6 +13,7 @@
@@ -42,25 +43,83 @@ index eeafb3a..47d0b4c 100644
42 43
43 #define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ 44 #define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
44 ({ \ 45 ({ \
45@@ -71,6 +72,8 @@ __asm__ ( 46@@ -31,90 +32,21 @@
46 ".if 1 - \\name\n\t" /* if reg!=ebx... */ 47
47 ".if 2 - \\name\n\t" /* if reg can't be clobbered... */ 48 #if 1 /* defined __PIC__ || defined __pic__ */
48 "pushl %ebx\n\t" /* save ebx on stack */ 49
49+ CFI_ADJUST_CFA_OFFSET(4) "\n\t" 50-/* This code avoids pushing/popping ebx as much as possible.
50+ CFI_REL_OFFSET(ebx, 0) "\n\t" 51- * I think the main reason was that older GCCs had problems
51 ".else\n\t" 52- * with proper saving/restoring of ebx if "b" constraint was used,
52 "xchgl \\reg, %ebx\n\t" /* else save ebx in reg, and load reg to ebx */ 53- * which was breaking -fPIC code really badly.
53 ".endif\n\t" 54- * At least gcc 4.2.x seems to not need these tricks anymore,
54@@ -89,6 +92,8 @@ __asm__ ( 55- * but this code is still useful because it often avoids
55 ".if 1 - \\name\n\t" 56- * using stack for saving ebx.
56 ".if 2 - \\name\n\t" /* if reg can't be clobbered... */ 57- * Keeping it unconditionally enabled for now.
57 "popl %ebx\n\t" /* restore ebx from stack */ 58- */
58+ CFI_ADJUST_CFA_OFFSET(-4) "\n\t" 59-
59+ CFI_RESTORE(ebx) "\n\t" 60-/* We need some help from the assembler to generate optimal code.
60 ".else\n\t" 61- * We define some macros here which later will be used. */
61 "xchgl \\reg, %ebx\n\t" /* else restore ebx from reg */ 62-/* gcc>=4.6 with LTO need the same guards as IMA (a.k.a --combine) did.
62 ".endif\n\t" 63- * See gcc.gnu.org/PR47577 */
63@@ -106,7 +111,7 @@ __asm__ ( 64-/* FIXME: drop these b* macros! */
65-
66-__asm__ (
67-#if defined __DOMULTI__ || __GNUC_PREREQ (4, 6)
68- /* Protect against asm macro redefinition (happens in __DOMULTI__ mode).
69- * Unfortunately, it ends up visible in .o files. */
70- ".ifndef _BITS_SYSCALLS_ASM\n\t"
71- ".set _BITS_SYSCALLS_ASM,1\n\t"
72-#endif
73- ".L__X'%ebx = 1\n\t"
74- ".L__X'%ecx = 2\n\t"
75- ".L__X'%edx = 2\n\t"
76- ".L__X'%eax = 3\n\t"
77- ".L__X'%esi = 3\n\t"
78- ".L__X'%edi = 3\n\t"
79- ".L__X'%ebp = 3\n\t"
80- ".L__X'%esp = 3\n\t"
81-
82- /* Loading param #1 (ebx) is done by loading it into
83- * another register, and then performing bpushl+bmovl,
84- * since we must preserve ebx */
85-
86- ".macro bpushl name reg\n\t"
87- ".if 1 - \\name\n\t" /* if reg!=ebx... */
88- ".if 2 - \\name\n\t" /* if reg can't be clobbered... */
89- "pushl %ebx\n\t" /* save ebx on stack */
90- ".else\n\t"
91- "xchgl \\reg, %ebx\n\t" /* else save ebx in reg, and load reg to ebx */
92- ".endif\n\t"
93- ".endif\n\t"
94- ".endm\n\t"
95-
96- ".macro bmovl name reg\n\t"
97- ".if 1 - \\name\n\t"
98- ".if 2 - \\name\n\t" /* if reg can't be clobbered... */
99- "movl \\reg, %ebx\n\t" /* load reg to ebx */
100- ".endif\n\t"
101- ".endif\n\t"
102- ".endm\n\t"
103-
104- ".macro bpopl name reg\n\t"
105- ".if 1 - \\name\n\t"
106- ".if 2 - \\name\n\t" /* if reg can't be clobbered... */
107- "popl %ebx\n\t" /* restore ebx from stack */
108- ".else\n\t"
109- "xchgl \\reg, %ebx\n\t" /* else restore ebx from reg */
110- ".endif\n\t"
111- ".endif\n\t"
112- ".endm\n\t"
113-
114-#if defined __DOMULTI__ || __GNUC_PREREQ (4, 6)
115- ".endif\n\t" /* _BITS_SYSCALLS_ASM */
116-#endif
117-);
118-
119 #define LOADARGS_0
120-#define LOADARGS_1 "bpushl .L__X'%k2, %k2\n\t" "bmovl .L__X'%k2, %k2\n\t"
121+#define LOADARGS_1 "push %%ebx\n\t" CFI_ADJUST_CFA_OFFSET(4) "\n\t" CFI_REL_OFFSET(ebx, 0) "\n\t" "movl %k2, %%ebx\n\t"
122 #define LOADARGS_2 LOADARGS_1
64 #define LOADARGS_3 LOADARGS_1 123 #define LOADARGS_3 LOADARGS_1
65 #define LOADARGS_4 LOADARGS_1 124 #define LOADARGS_4 LOADARGS_1
66 #define LOADARGS_5 LOADARGS_1 125 #define LOADARGS_5 LOADARGS_1
@@ -68,8 +127,9 @@ index eeafb3a..47d0b4c 100644
68+#define LOADARGS_6 LOADARGS_1 "push %%ebp\n\t" CFI_ADJUST_CFA_OFFSET(4) "\n\t" CFI_REL_OFFSET(ebp, 0) "\n\t" "movl %7, %%ebp\n\t" 127+#define LOADARGS_6 LOADARGS_1 "push %%ebp\n\t" CFI_ADJUST_CFA_OFFSET(4) "\n\t" CFI_REL_OFFSET(ebp, 0) "\n\t" "movl %7, %%ebp\n\t"
69 128
70 #define RESTOREARGS_0 129 #define RESTOREARGS_0
71 #define RESTOREARGS_1 "bpopl .L__X'%k2, %k2\n\t" 130-#define RESTOREARGS_1 "bpopl .L__X'%k2, %k2\n\t"
72@@ -114,7 +119,7 @@ __asm__ ( 131+#define RESTOREARGS_1 "pop %%ebx\n\t" CFI_ADJUST_CFA_OFFSET(-4) "\n\t" CFI_RESTORE(ebx) "\n\t" RESTOREARGS_0
132 #define RESTOREARGS_2 RESTOREARGS_1
73 #define RESTOREARGS_3 RESTOREARGS_1 133 #define RESTOREARGS_3 RESTOREARGS_1
74 #define RESTOREARGS_4 RESTOREARGS_1 134 #define RESTOREARGS_4 RESTOREARGS_1
75 #define RESTOREARGS_5 RESTOREARGS_1 135 #define RESTOREARGS_5 RESTOREARGS_1
@@ -78,7 +138,7 @@ index eeafb3a..47d0b4c 100644
78 138
79 #define ASMFMT_0() 139 #define ASMFMT_0()
80 /* "acdSD" constraint would work too, but "SD" would use esi/edi and cause 140 /* "acdSD" constraint would work too, but "SD" would use esi/edi and cause
81@@ -162,7 +167,7 @@ __asm__ ( 141@@ -162,7 +94,7 @@ __asm__ (
82 #define LOADARGS_3 142 #define LOADARGS_3
83 #define LOADARGS_4 143 #define LOADARGS_4
84 #define LOADARGS_5 144 #define LOADARGS_5
@@ -87,7 +147,7 @@ index eeafb3a..47d0b4c 100644
87 147
88 #define RESTOREARGS_0 148 #define RESTOREARGS_0
89 #define RESTOREARGS_1 149 #define RESTOREARGS_1
90@@ -170,7 +175,7 @@ __asm__ ( 150@@ -170,7 +102,7 @@ __asm__ (
91 #define RESTOREARGS_3 151 #define RESTOREARGS_3
92 #define RESTOREARGS_4 152 #define RESTOREARGS_4
93 #define RESTOREARGS_5 153 #define RESTOREARGS_5
diff --git a/main/libc0.9.32/APKBUILD b/main/libc0.9.32/APKBUILD
index 54d69866cc..8fc93dadaa 100644
--- a/main/libc0.9.32/APKBUILD
+++ b/main/libc0.9.32/APKBUILD
@@ -4,7 +4,7 @@ pkgname=libc$_abiver
4_gitver= 4_gitver=
5pkgver=0.9.32 5pkgver=0.9.32
6_ver=${pkgver/_/-} 6_ver=${pkgver/_/-}
7pkgrel=7 7pkgrel=8
8pkgdesc="C library for developing embedded Linux systems" 8pkgdesc="C library for developing embedded Linux systems"
9url=http://uclibc.org 9url=http://uclibc.org
10license="LGPL-2" 10license="LGPL-2"
@@ -145,7 +145,7 @@ b4fb68ad3d0e8331b1b40c30eb21dfdc 0002-stdlib-fix-arc4random-return-type-to-u_in
14530f27fe51fdc4d121166ad2af18dfb8d 0001-malloc-standard-synchronize-on-fork.patch 14530f27fe51fdc4d121166ad2af18dfb8d 0001-malloc-standard-synchronize-on-fork.patch
1462548d9f470c9a5b2c117ec3d6f35c105 0001-time-fix-parsing-of-tzdata-files-where-off_t-is-64-b.patch 1462548d9f470c9a5b2c117ec3d6f35c105 0001-time-fix-parsing-of-tzdata-files-where-off_t-is-64-b.patch
1479e1ffc8dae55f4489c770f284734804f 0001-getaddrinfo-allow-numeric-service-without-any-hints.patch 1479e1ffc8dae55f4489c770f284734804f 0001-getaddrinfo-allow-numeric-service-without-any-hints.patch
1481aed313e59ca9bc15f87273d4b3d4fde 0001-libc-x86-fix-stack-unwinding-and-backtrace-informati.patch 148e814d39ab0adab58d69396ac0b9acdea 0001-libc-x86-fix-stack-unwinding-and-backtrace-informati.patch
14940e9c7f017cc81ee5b19ead000b9b6b7 libm-cabsf.patch 14940e9c7f017cc81ee5b19ead000b9b6b7 libm-cabsf.patch
15042416385763f7cd50775ed9bfaf2d59e libm-cexp.patch 15042416385763f7cd50775ed9bfaf2d59e libm-cexp.patch
1517c47e9cb284b0da8df6ed2096b2c9c66 uclibc-ubacktrace-asneeded-fix.patch 1517c47e9cb284b0da8df6ed2096b2c9c66 uclibc-ubacktrace-asneeded-fix.patch