aboutsummaryrefslogtreecommitdiffstats
path: root/main/libc0.9.32/0001-libc-x86-fix-stack-unwinding-and-backtrace-informati.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/libc0.9.32/0001-libc-x86-fix-stack-unwinding-and-backtrace-informati.patch')
-rw-r--r--main/libc0.9.32/0001-libc-x86-fix-stack-unwinding-and-backtrace-informati.patch120
1 files changed, 90 insertions, 30 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 @@
-From 80db5b343bd44806881d400a8627cb526ffccee7 Mon Sep 17 00:00:00 2001
+From 5f72f80e7ea0e3429c28ff5de7ca88cdd95e8904 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Thu, 10 Nov 2011 09:36:44 +0200
-Subject: [PATCH] libc/x86: fix stack unwinding and backtrace information
+Subject: [PATCHv2] libc/x86: fix stack unwinding and backtrace information
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@@ -11,6 +11,7 @@ for proper stack unwinding.
This patch adds the CFI information to:
* syscalls (so we get proper backtrace even for release builds)
+ the ebx hack was removed as it would complicate the CFI generation
* new thread stub function (so the backtrace is clean for user
created threads)
@@ -25,13 +26,13 @@ signal return frame.
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
---
- libc/sysdeps/linux/i386/bits/syscalls.h | 13 +++++++++----
- libc/sysdeps/linux/i386/clone.S | 17 +++++++++++++++++
- libc/sysdeps/linux/i386/sigaction.c | 4 ++++
- 3 files changed, 30 insertions(+), 4 deletions(-)
+ libc/sysdeps/linux/i386/bits/syscalls.h | 82 +++----------------------------
+ libc/sysdeps/linux/i386/clone.S | 17 ++++++
+ libc/sysdeps/linux/i386/sigaction.c | 4 ++
+ 3 files changed, 28 insertions(+), 75 deletions(-)
diff --git a/libc/sysdeps/linux/i386/bits/syscalls.h b/libc/sysdeps/linux/i386/bits/syscalls.h
-index eeafb3a..47d0b4c 100644
+index eeafb3a..1f60a44 100644
--- a/libc/sysdeps/linux/i386/bits/syscalls.h
+++ b/libc/sysdeps/linux/i386/bits/syscalls.h
@@ -13,6 +13,7 @@
@@ -42,25 +43,83 @@ index eeafb3a..47d0b4c 100644
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
({ \
-@@ -71,6 +72,8 @@ __asm__ (
- ".if 1 - \\name\n\t" /* if reg!=ebx... */
- ".if 2 - \\name\n\t" /* if reg can't be clobbered... */
- "pushl %ebx\n\t" /* save ebx on stack */
-+ CFI_ADJUST_CFA_OFFSET(4) "\n\t"
-+ CFI_REL_OFFSET(ebx, 0) "\n\t"
- ".else\n\t"
- "xchgl \\reg, %ebx\n\t" /* else save ebx in reg, and load reg to ebx */
- ".endif\n\t"
-@@ -89,6 +92,8 @@ __asm__ (
- ".if 1 - \\name\n\t"
- ".if 2 - \\name\n\t" /* if reg can't be clobbered... */
- "popl %ebx\n\t" /* restore ebx from stack */
-+ CFI_ADJUST_CFA_OFFSET(-4) "\n\t"
-+ CFI_RESTORE(ebx) "\n\t"
- ".else\n\t"
- "xchgl \\reg, %ebx\n\t" /* else restore ebx from reg */
- ".endif\n\t"
-@@ -106,7 +111,7 @@ __asm__ (
+@@ -31,90 +32,21 @@
+
+ #if 1 /* defined __PIC__ || defined __pic__ */
+
+-/* This code avoids pushing/popping ebx as much as possible.
+- * I think the main reason was that older GCCs had problems
+- * with proper saving/restoring of ebx if "b" constraint was used,
+- * which was breaking -fPIC code really badly.
+- * At least gcc 4.2.x seems to not need these tricks anymore,
+- * but this code is still useful because it often avoids
+- * using stack for saving ebx.
+- * Keeping it unconditionally enabled for now.
+- */
+-
+-/* We need some help from the assembler to generate optimal code.
+- * We define some macros here which later will be used. */
+-/* gcc>=4.6 with LTO need the same guards as IMA (a.k.a --combine) did.
+- * See gcc.gnu.org/PR47577 */
+-/* FIXME: drop these b* macros! */
+-
+-__asm__ (
+-#if defined __DOMULTI__ || __GNUC_PREREQ (4, 6)
+- /* Protect against asm macro redefinition (happens in __DOMULTI__ mode).
+- * Unfortunately, it ends up visible in .o files. */
+- ".ifndef _BITS_SYSCALLS_ASM\n\t"
+- ".set _BITS_SYSCALLS_ASM,1\n\t"
+-#endif
+- ".L__X'%ebx = 1\n\t"
+- ".L__X'%ecx = 2\n\t"
+- ".L__X'%edx = 2\n\t"
+- ".L__X'%eax = 3\n\t"
+- ".L__X'%esi = 3\n\t"
+- ".L__X'%edi = 3\n\t"
+- ".L__X'%ebp = 3\n\t"
+- ".L__X'%esp = 3\n\t"
+-
+- /* Loading param #1 (ebx) is done by loading it into
+- * another register, and then performing bpushl+bmovl,
+- * since we must preserve ebx */
+-
+- ".macro bpushl name reg\n\t"
+- ".if 1 - \\name\n\t" /* if reg!=ebx... */
+- ".if 2 - \\name\n\t" /* if reg can't be clobbered... */
+- "pushl %ebx\n\t" /* save ebx on stack */
+- ".else\n\t"
+- "xchgl \\reg, %ebx\n\t" /* else save ebx in reg, and load reg to ebx */
+- ".endif\n\t"
+- ".endif\n\t"
+- ".endm\n\t"
+-
+- ".macro bmovl name reg\n\t"
+- ".if 1 - \\name\n\t"
+- ".if 2 - \\name\n\t" /* if reg can't be clobbered... */
+- "movl \\reg, %ebx\n\t" /* load reg to ebx */
+- ".endif\n\t"
+- ".endif\n\t"
+- ".endm\n\t"
+-
+- ".macro bpopl name reg\n\t"
+- ".if 1 - \\name\n\t"
+- ".if 2 - \\name\n\t" /* if reg can't be clobbered... */
+- "popl %ebx\n\t" /* restore ebx from stack */
+- ".else\n\t"
+- "xchgl \\reg, %ebx\n\t" /* else restore ebx from reg */
+- ".endif\n\t"
+- ".endif\n\t"
+- ".endm\n\t"
+-
+-#if defined __DOMULTI__ || __GNUC_PREREQ (4, 6)
+- ".endif\n\t" /* _BITS_SYSCALLS_ASM */
+-#endif
+-);
+-
+ #define LOADARGS_0
+-#define LOADARGS_1 "bpushl .L__X'%k2, %k2\n\t" "bmovl .L__X'%k2, %k2\n\t"
++#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"
+ #define LOADARGS_2 LOADARGS_1
#define LOADARGS_3 LOADARGS_1
#define LOADARGS_4 LOADARGS_1
#define LOADARGS_5 LOADARGS_1
@@ -68,8 +127,9 @@ index eeafb3a..47d0b4c 100644
+#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"
#define RESTOREARGS_0
- #define RESTOREARGS_1 "bpopl .L__X'%k2, %k2\n\t"
-@@ -114,7 +119,7 @@ __asm__ (
+-#define RESTOREARGS_1 "bpopl .L__X'%k2, %k2\n\t"
++#define RESTOREARGS_1 "pop %%ebx\n\t" CFI_ADJUST_CFA_OFFSET(-4) "\n\t" CFI_RESTORE(ebx) "\n\t" RESTOREARGS_0
+ #define RESTOREARGS_2 RESTOREARGS_1
#define RESTOREARGS_3 RESTOREARGS_1
#define RESTOREARGS_4 RESTOREARGS_1
#define RESTOREARGS_5 RESTOREARGS_1
@@ -78,7 +138,7 @@ index eeafb3a..47d0b4c 100644
#define ASMFMT_0()
/* "acdSD" constraint would work too, but "SD" would use esi/edi and cause
-@@ -162,7 +167,7 @@ __asm__ (
+@@ -162,7 +94,7 @@ __asm__ (
#define LOADARGS_3
#define LOADARGS_4
#define LOADARGS_5
@@ -87,7 +147,7 @@ index eeafb3a..47d0b4c 100644
#define RESTOREARGS_0
#define RESTOREARGS_1
-@@ -170,7 +175,7 @@ __asm__ (
+@@ -170,7 +102,7 @@ __asm__ (
#define RESTOREARGS_3
#define RESTOREARGS_4
#define RESTOREARGS_5