This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] libgloss/arm: Remove abort.


I have one comment about the patch. It appears you have changed the non-RDI behavior. Currently, non-RDI abort calls _exit(17) which ends up being a call to _kill(17, -1). In your new scheme, the non-RDI abort will end up calling _kill with some pid and a sig set to SIGABRT. This doesn't match. I believe a simple check for SIGABRT in the non-RDI section of _kill would allow exiting with the previous behavior if that is truly intended.

-- Jeff J.

Shaun Jackman wrote:
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)
{


------------------------------------------------------------------------


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)
{






Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]