Implement raise () in libc
The core functionality (i.e., the equivalent of `kill (getpid (), sig);`) was already there in the implementation of `abort ()`. Now, it got factored out to `raise ()` so that others (most importantly, `__aeabi_ldiv0`) can call and link to it as well. Also, removed `LIBC_UNREACHABLE_STUB_FOR` macro, as it is not used anymore. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
@@ -54,19 +54,4 @@ libc_fatal (const char *msg,
|
|||||||
} while (0)
|
} while (0)
|
||||||
#endif /* !LIBC_NDEBUG */
|
#endif /* !LIBC_NDEBUG */
|
||||||
|
|
||||||
/**
|
|
||||||
* Stubs declaration
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unreachable stubs for routines that are never called,
|
|
||||||
* but referenced from third-party libraries.
|
|
||||||
*/
|
|
||||||
#define LIBC_UNREACHABLE_STUB_FOR(...) \
|
|
||||||
extern __VA_ARGS__; \
|
|
||||||
__attr_used___ __VA_ARGS__ \
|
|
||||||
{ \
|
|
||||||
LIBC_UNREACHABLE (); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* !DEFS_H */
|
#endif /* !DEFS_H */
|
||||||
|
|||||||
@@ -31,8 +31,6 @@
|
|||||||
|
|
||||||
#include "jerry-libc-defs.h"
|
#include "jerry-libc-defs.h"
|
||||||
|
|
||||||
LIBC_UNREACHABLE_STUB_FOR (int raise (int sig_no __attr_unused___))
|
|
||||||
|
|
||||||
extern long int syscall_0 (long int syscall_no);
|
extern long int syscall_0 (long int syscall_no);
|
||||||
extern long int syscall_1 (long int syscall_no, long int arg1);
|
extern long int syscall_1 (long int syscall_no, long int arg1);
|
||||||
extern long int syscall_2 (long int syscall_no, long int arg1, long int arg2);
|
extern long int syscall_2 (long int syscall_no, long int arg1, long int arg2);
|
||||||
@@ -92,7 +90,7 @@ abort (void)
|
|||||||
syscall_1 (SYS_close, (long int) stdout);
|
syscall_1 (SYS_close, (long int) stdout);
|
||||||
syscall_1 (SYS_close, (long int) stderr);
|
syscall_1 (SYS_close, (long int) stderr);
|
||||||
|
|
||||||
syscall_2 (SYS_kill, syscall_0 (SYS_getpid), SIGABRT);
|
raise (SIGABRT);
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
@@ -100,6 +98,15 @@ abort (void)
|
|||||||
}
|
}
|
||||||
} /* abort */
|
} /* abort */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a signal to the current process.
|
||||||
|
*/
|
||||||
|
int __attr_used___
|
||||||
|
raise (int sig)
|
||||||
|
{
|
||||||
|
return (int) syscall_2 (SYS_kill, syscall_0 (SYS_getpid), sig);
|
||||||
|
} /* raise */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fopen
|
* fopen
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -31,8 +31,6 @@
|
|||||||
|
|
||||||
#include "jerry-libc-defs.h"
|
#include "jerry-libc-defs.h"
|
||||||
|
|
||||||
LIBC_UNREACHABLE_STUB_FOR (int raise (int sig_no __attr_unused___))
|
|
||||||
|
|
||||||
extern long int syscall_0 (long int syscall_no);
|
extern long int syscall_0 (long int syscall_no);
|
||||||
extern long int syscall_1 (long int syscall_no, long int arg1);
|
extern long int syscall_1 (long int syscall_no, long int arg1);
|
||||||
extern long int syscall_2 (long int syscall_no, long int arg1, long int arg2);
|
extern long int syscall_2 (long int syscall_no, long int arg1, long int arg2);
|
||||||
@@ -92,7 +90,7 @@ abort (void)
|
|||||||
syscall_1 (__NR_close, (long int) stdout);
|
syscall_1 (__NR_close, (long int) stdout);
|
||||||
syscall_1 (__NR_close, (long int) stderr);
|
syscall_1 (__NR_close, (long int) stderr);
|
||||||
|
|
||||||
syscall_2 (__NR_kill, syscall_0 (__NR_getpid), SIGABRT);
|
raise (SIGABRT);
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
@@ -100,6 +98,15 @@ abort (void)
|
|||||||
}
|
}
|
||||||
} /* abort */
|
} /* abort */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a signal to the current process.
|
||||||
|
*/
|
||||||
|
int __attr_used___
|
||||||
|
raise (int sig)
|
||||||
|
{
|
||||||
|
return (int) syscall_2 (__NR_kill, syscall_0 (__NR_getpid), sig);
|
||||||
|
} /* raise */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fopen
|
* fopen
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user