[PATCH] libgloss/arm: Remove abort.
Shaun Jackman
sjackman@gmail.com
Wed May 24 20:37:00 GMT 2006
This patch removes abort(3) from libgloss for the ARM target, using
instead the stdlib definition provided by newlib. It maintains the
previous semantics of abort(3) on RDI by throwing a
ADP_Stopped_RunTimeError error if SIGABRT is passed to kill(2).
My reason for this patch is to remove the need for libgloss to provide abort.
Cheers,
Shaun
2006-05-24 Shaun Jackman <sjackman@gmail.com>
* newlib/configure.host (newlib_cflags): Remove -DABORT_PROVIDED.
* libgloss/arm/syscalls.c (kill) [ARM_RDI_MONITOR]: Use the signal
argument to choose a suitable ADP exception.
* libgloss/arm/libcfunc.c (abort): Remove this function.
Index: newlib/configure.host
===================================================================
RCS file: /cvs/src/src/newlib/configure.host,v
retrieving revision 1.79
diff -u -r1.79 configure.host
--- newlib/configure.host 21 Mar 2006 20:02:13 -0000 1.79
+++ newlib/configure.host 24 May 2006 19:08:41 -0000
@@ -511,7 +513,7 @@
;;
arm-*-*)
syscall_dir=syscalls
- newlib_cflags="${newlib_cflags} -DABORT_PROVIDED -DHAVE_GETTIMEOFDAY"
+ newlib_cflags="${newlib_cflags} -DHAVE_GETTIMEOFDAY"
# If newlib is supplying syscalls, select which debug protocol is being used.
# ARM_RDP_MONITOR selects the Demon monitor.
# ARM_RDI_MONITOR selects the Angel monitor.
Index: libgloss/arm/syscalls.c
===================================================================
RCS file: /cvs/src/src/libgloss/arm/syscalls.c,v
retrieving revision 1.9
diff -u -r1.9 syscalls.c
--- libgloss/arm/syscalls.c 7 Feb 2006 18:46:23 -0000 1.9
+++ libgloss/arm/syscalls.c 24 May 2006 19:08:41 -0000
@@ -13,6 +13,7 @@
#include <sys/times.h>
#include <errno.h>
#include <reent.h>
+#include <signal.h>
#include <unistd.h>
#include "swi.h"
@@ -463,9 +464,15 @@
{
(void)pid; (void)sig;
#ifdef ARM_RDI_MONITOR
- /* Note: Both arguments are thrown away. */
- return do_AngelSWI (AngelSWI_Reason_ReportException,
- (void *) ADP_Stopped_ApplicationExit);
+ /* Note: The pid argument is thrown away. */
+ switch (sig) {
+ case SIGABRT:
+ return do_AngelSWI (AngelSWI_Reason_ReportException,
+ (void *) ADP_Stopped_RunTimeError);
+ default:
+ return do_AngelSWI (AngelSWI_Reason_ReportException,
+ (void *) ADP_Stopped_ApplicationExit);
+ }
#else
asm ("swi %a0" :: "i" (SWI_Exit));
#endif
Index: libgloss/arm/libcfunc.c
===================================================================
RCS file: /cvs/src/src/libgloss/arm/libcfunc.c,v
retrieving revision 1.7
diff -u -r1.7 libcfunc.c
--- libgloss/arm/libcfunc.c 7 Feb 2006 18:46:23 -0000 1.7
+++ libgloss/arm/libcfunc.c 24 May 2006 19:08:41 -0000
@@ -24,18 +24,6 @@
}
#endif /* ARM_RDI_MONITOR */
-void
-abort (void)
-{
- extern void _exit (int n);
-#ifdef ARM_RDI_MONITOR
- do_AngelSWI (AngelSWI_Reason_ReportException,
- (void *) ADP_Stopped_RunTimeError);
-#else
- _exit(17);
-#endif
-}
-
unsigned __attribute__((weak))
alarm (unsigned seconds)
{
-------------- next part --------------
2006-05-24 Shaun Jackman <sjackman@gmail.com>
* newlib/configure.host (newlib_cflags): Remove -DABORT_PROVIDED.
* libgloss/arm/syscalls.c (kill) [ARM_RDI_MONITOR]: Use the signal
argument to choose an ADP exception reason.
* libgloss/arm/libcfunc.c (abort): Remove this function.
Index: newlib/configure.host
===================================================================
RCS file: /cvs/src/src/newlib/configure.host,v
retrieving revision 1.79
diff -u -r1.79 configure.host
--- newlib/configure.host 21 Mar 2006 20:02:13 -0000 1.79
+++ newlib/configure.host 24 May 2006 19:08:41 -0000
@@ -511,7 +513,7 @@
;;
arm-*-*)
syscall_dir=syscalls
- newlib_cflags="${newlib_cflags} -DABORT_PROVIDED -DHAVE_GETTIMEOFDAY"
+ newlib_cflags="${newlib_cflags} -DHAVE_GETTIMEOFDAY"
# If newlib is supplying syscalls, select which debug protocol is being used.
# ARM_RDP_MONITOR selects the Demon monitor.
# ARM_RDI_MONITOR selects the Angel monitor.
Index: libgloss/arm/syscalls.c
===================================================================
RCS file: /cvs/src/src/libgloss/arm/syscalls.c,v
retrieving revision 1.9
diff -u -r1.9 syscalls.c
--- libgloss/arm/syscalls.c 7 Feb 2006 18:46:23 -0000 1.9
+++ libgloss/arm/syscalls.c 24 May 2006 19:08:41 -0000
@@ -13,6 +13,7 @@
#include <sys/times.h>
#include <errno.h>
#include <reent.h>
+#include <signal.h>
#include <unistd.h>
#include "swi.h"
@@ -463,9 +464,15 @@
{
(void)pid; (void)sig;
#ifdef ARM_RDI_MONITOR
- /* Note: Both arguments are thrown away. */
- return do_AngelSWI (AngelSWI_Reason_ReportException,
- (void *) ADP_Stopped_ApplicationExit);
+ /* Note: The pid argument is thrown away. */
+ switch (sig) {
+ case SIGABRT:
+ return do_AngelSWI (AngelSWI_Reason_ReportException,
+ (void *) ADP_Stopped_RunTimeError);
+ default:
+ return do_AngelSWI (AngelSWI_Reason_ReportException,
+ (void *) ADP_Stopped_ApplicationExit);
+ }
#else
asm ("swi %a0" :: "i" (SWI_Exit));
#endif
Index: libgloss/arm/libcfunc.c
===================================================================
RCS file: /cvs/src/src/libgloss/arm/libcfunc.c,v
retrieving revision 1.7
diff -u -r1.7 libcfunc.c
--- libgloss/arm/libcfunc.c 7 Feb 2006 18:46:23 -0000 1.7
+++ libgloss/arm/libcfunc.c 24 May 2006 19:08:41 -0000
@@ -24,18 +24,6 @@
}
#endif /* ARM_RDI_MONITOR */
-void
-abort (void)
-{
- extern void _exit (int n);
-#ifdef ARM_RDI_MONITOR
- do_AngelSWI (AngelSWI_Reason_ReportException,
- (void *) ADP_Stopped_RunTimeError);
-#else
- _exit(17);
-#endif
-}
-
unsigned __attribute__((weak))
alarm (unsigned seconds)
{
More information about the Newlib
mailing list