This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
[arm,patch] Prevent unwindiing off top of stack.
- From: Paul Brook <paul at codesourcery dot com>
- To: newlib at sources dot redhat dot com
- Date: Wed, 24 Nov 2004 15:03:23 +0000
- Subject: [arm,patch] Prevent unwindiing off top of stack.
- Organization: CodeSourcery
The attached patch adds Arm EABI unwinding annotations to _start to prevent
unwinding off the top of the stack if main() throws an exception.
Tested with cross to arm-none-elf and arm-none-eabi.
Ok?
Paul
2004-11-24 Paul Brook <paul@codesourcery.com>
* libc/sys/arm/crt0.S (_start): Add .cantunwind annotation.
Index: newlib/libc/sys/arm/crt0.S
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/arm/crt0.S,v
retrieving revision 1.8
diff -u -p -r1.8 crt0.S
--- newlib/libc/sys/arm/crt0.S 18 Nov 2002 16:30:55 -0000 1.8
+++ newlib/libc/sys/arm/crt0.S 1 Oct 2004 11:28:03 -0000
@@ -21,6 +21,10 @@
start:
_start:
_mainCRTStartup:
+#if defined(__ELF__) && !defined(__USING_SJLJ_EXCEPTIONS__)
+ /* Annotation for EABI unwinding tables. */
+ .fnstart
+#endif
/* Start by setting up a stack */
#ifdef ARM_RDP_MONITOR
@@ -237,6 +241,11 @@ change_back:
#endif
#endif
#endif
+#if defined(__ELF__) && !defined(__USING_SJLJ_EXCEPTIONS__)
+ /* Protect against unhandled exceptions. */
+ .cantunwind
+ .fnend
+#endif
.LC1:
.word __bss_start__
.LC2: