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.


Revised patch checked in. Thanks.

-- Jeff J.

Shaun Jackman wrote:
On 6/1/06, Jeff Johnston <jjohnstn@redhat.com> wrote:

That is no problem, however, I just realized that I missed the fact that
the libc/sys/arm directory needs to be changed as well because the flag
will affect those users that don't disable newlib supplying syscalls.
Since it is a bit more than a minor touch-up, any chance you could post
  another patch with the additional changes to libc/sys/arm?

-- Jeff J.


2006-05-24 Shaun Jackman <sjackman@gmail.com>

    * newlib/configure.host    (newlib_cflags) [arm, thumb, xscale]:
    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.
    * newlib/libc/sys/arm/syscalls.c (kill, exit): Sync with libgloss.
    * newlib/libc/sys/arm/libcfunc.c (abort): Ditto.

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: newlib/libc/sys/arm/libcfunc.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/arm/libcfunc.c,v
retrieving revision 1.2
diff -u -r1.2 libcfunc.c
--- newlib/libc/sys/arm/libcfunc.c    7 Feb 2006 18:44:54 -0000    1.2
+++ newlib/libc/sys/arm/libcfunc.c    2 Jun 2006 16:42:03 -0000
@@ -24,17 +24,6 @@


void -abort (void) -{ -#ifdef ARM_RDI_MONITOR - do_AngelSWI (AngelSWI_Reason_ReportException, - (void *) ADP_Stopped_RunTimeError); -#else - asm ("mov r0,#17\nswi %a0" :: "i" (SWI_Exit)); -#endif -} - -void alarm (void) { } Index: newlib/libc/sys/arm/syscalls.c =================================================================== RCS file: /cvs/src/src/newlib/libc/sys/arm/syscalls.c,v retrieving revision 1.11 diff -u -r1.11 syscalls.c --- newlib/libc/sys/arm/syscalls.c 7 Feb 2006 18:44:54 -0000 1.11 +++ newlib/libc/sys/arm/syscalls.c 2 Jun 2006 16:42:03 -0000 @@ -12,6 +12,7 @@ #include <sys/times.h> #include <errno.h> #include <reent.h> +#include <signal.h> #include <unistd.h> #include "swi.h"

@@ -433,30 +434,34 @@
  return wrap (_swiclose (file));
}

-void
-_exit (int n)
+int
+_kill (int pid, int sig)
{
-  /* FIXME: return code is thrown away.  */
-
+  (void)pid; (void)sig;
#ifdef ARM_RDI_MONITOR
-  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
-  n = n;
}

-int
-_kill (int n, int m)
+void
+_exit (int status)
{
-#ifdef ARM_RDI_MONITOR
-  return do_AngelSWI (AngelSWI_Reason_ReportException,
-              (void *) ADP_Stopped_ApplicationExit);
-#else
-  asm ("swi %a0" :: "i" (SWI_Exit));
-#endif
-  n = n; m = m;
+  /* There is only one SWI for both _exit and _kill. For _exit, call
+     the SWI with the second argument set to -1, an invalid value for
+     signum, so that the SWI handler can distinguish the two calls.
+     Note: The RDI implementation of _kill throws away both its
+     arguments.  */
+  _kill(status, -1);
}

int
Index: newlib/configure.host
===================================================================
RCS file: /cvs/src/src/newlib/configure.host,v
retrieving revision 1.81
diff -u -r1.81 configure.host
--- newlib/configure.host 13 Apr 2006 19:56:23 -0000 1.81
+++ newlib/configure.host 2 Jun 2006 16:43:34 -0000
@@ -514,7 +514,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.
@@ -669,7 +669,7 @@
;;
thumb-*-*)
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.
@@ -700,7 +700,7 @@
;; xscale-*-*)
syscall_dir=syscalls
- newlib_cflags="${newlib_cflags} -DABORT_PROVIDED -DHAVE_GETTIMEOFDAY"
+ newlib_cflags="${newlib_cflags} -DHAVE_GETTIMEOFDAY"
newlib_cflags="${newlib_cflags} -DHAVE_SYSTEM -DHAVE_RENAME"
if [ "x${newlib_may_supply_syscalls}" = "xyes" ] ; then
newlib_cflags="${newlib_cflags} -DARM_RDI_MONITOR"



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


2006-05-24 Shaun Jackman <sjackman@gmail.com>

	* newlib/configure.host	(newlib_cflags) [arm, thumb, xscale]:
	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.
	* newlib/libc/sys/arm/syscalls.c (kill, exit): Sync with libgloss.
	* newlib/libc/sys/arm/libcfunc.c (abort): Ditto.

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: newlib/libc/sys/arm/libcfunc.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/arm/libcfunc.c,v
retrieving revision 1.2
diff -u -r1.2 libcfunc.c
--- newlib/libc/sys/arm/libcfunc.c 7 Feb 2006 18:44:54 -0000 1.2
+++ newlib/libc/sys/arm/libcfunc.c 2 Jun 2006 16:42:03 -0000
@@ -24,17 +24,6 @@
void
-abort (void)
-{
-#ifdef ARM_RDI_MONITOR
- do_AngelSWI (AngelSWI_Reason_ReportException,
- (void *) ADP_Stopped_RunTimeError);
-#else
- asm ("mov r0,#17\nswi %a0" :: "i" (SWI_Exit));
-#endif
-}
-
-void
alarm (void)
{
}
Index: newlib/libc/sys/arm/syscalls.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/arm/syscalls.c,v
retrieving revision 1.11
diff -u -r1.11 syscalls.c
--- newlib/libc/sys/arm/syscalls.c 7 Feb 2006 18:44:54 -0000 1.11
+++ newlib/libc/sys/arm/syscalls.c 2 Jun 2006 16:42:03 -0000
@@ -12,6 +12,7 @@
#include <sys/times.h>
#include <errno.h>
#include <reent.h>
+#include <signal.h>
#include <unistd.h>
#include "swi.h"
@@ -433,30 +434,34 @@
return wrap (_swiclose (file));
}
-void
-_exit (int n)
+int
+_kill (int pid, int sig)
{
- /* FIXME: return code is thrown away. */
- + (void)pid; (void)sig;
#ifdef ARM_RDI_MONITOR
- 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
- n = n;
}
-int
-_kill (int n, int m)
+void
+_exit (int status)
{
-#ifdef ARM_RDI_MONITOR
- return do_AngelSWI (AngelSWI_Reason_ReportException,
- (void *) ADP_Stopped_ApplicationExit);
-#else
- asm ("swi %a0" :: "i" (SWI_Exit));
-#endif
- n = n; m = m;
+ /* There is only one SWI for both _exit and _kill. For _exit, call
+ the SWI with the second argument set to -1, an invalid value for
+ signum, so that the SWI handler can distinguish the two calls.
+ Note: The RDI implementation of _kill throws away both its
+ arguments. */
+ _kill(status, -1);
}
int
Index: newlib/configure.host
===================================================================
RCS file: /cvs/src/src/newlib/configure.host,v
retrieving revision 1.81
diff -u -r1.81 configure.host
--- newlib/configure.host 13 Apr 2006 19:56:23 -0000 1.81
+++ newlib/configure.host 2 Jun 2006 16:43:34 -0000
@@ -514,7 +514,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.
@@ -669,7 +669,7 @@
;;
thumb-*-*)
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.
@@ -700,7 +700,7 @@
;;
xscale-*-*)
syscall_dir=syscalls
- newlib_cflags="${newlib_cflags} -DABORT_PROVIDED -DHAVE_GETTIMEOFDAY"
+ newlib_cflags="${newlib_cflags} -DHAVE_GETTIMEOFDAY"
newlib_cflags="${newlib_cflags} -DHAVE_SYSTEM -DHAVE_RENAME"
if [ "x${newlib_may_supply_syscalls}" = "xyes" ] ; then
newlib_cflags="${newlib_cflags} -DARM_RDI_MONITOR"


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