From ad6ebf3e9ca17c8f0cc7c92de5009ba2e6c3360d Mon Sep 17 00:00:00 2001 From: shibbo Date: Tue, 29 Oct 2024 18:47:34 -0400 Subject: [PATCH] more `MSL` linking --- configure.py | 14 +++++++------- src/MSL_C/abort_exit_ppc_eabi.c | 3 ++- src/MSL_C/math_api.c | 3 ++- src/MSL_C/mbstring.c | 3 ++- src/MSL_C/mem.c | 3 ++- src/MSL_C/printf.c | 3 ++- src/MSL_C/scanf.c | 3 ++- src/MSL_C/strtold.c | 3 ++- src/MSL_C/uart_console_io_gcn.c | 9 +++------ src/MSL_C/wprintf.c | 3 ++- 10 files changed, 26 insertions(+), 21 deletions(-) diff --git a/configure.py b/configure.py index a26b103e5..38d964876 100644 --- a/configure.py +++ b/configure.py @@ -2783,11 +2783,11 @@ def JSysLib(lib_name: str, objects: List[Object]) -> Dict[str, Any]: Object(Matching, "MSL_C/FILE_POS.c"), Object(Matching, "MSL_C/float.c"), Object(NonMatching, "MSL_C/locale.c"), - Object(NonMatching, "MSL_C/mbstring.c"), - Object(NonMatching, "MSL_C/mem.c"), - Object(NonMatching, "MSL_C/mem_funcs.c"), - Object(NonMatching, "MSL_C/math_api.c"), - Object(NonMatching, "MSL_C/misc_io.c"), + Object(Matching, "MSL_C/mbstring.c"), + Object(Matching, "MSL_C/mem.c"), + Object(Matching, "MSL_C/mem_funcs.c"), + Object(Matching, "MSL_C/math_api.c"), + Object(Matching, "MSL_C/misc_io.c"), Object(NonMatching, "MSL_C/printf.c"), Object(NonMatching, "MSL_C/scanf.c"), Object(Matching, "MSL_C/signal.c"), @@ -2798,8 +2798,8 @@ def JSysLib(lib_name: str, objects: List[Object]) -> Dict[str, Any]: Object(NonMatching, "MSL_C/wprintf.c"), Object(Matching, "MSL_C/wstring.c"), Object(Matching, "MSL_C/wchar_io.c"), - Object(NonMatching, "MSL_C/uart_console_io_gcn.c"), - Object(NonMatching, "MSL_C/abort_exit_ppc_eabi.c"), + Object(Matching, "MSL_C/uart_console_io_gcn.c"), + Object(Matching, "MSL_C/abort_exit_ppc_eabi.c"), Object(Matching, "MSL_C/math_sun.c"), Object(Matching, "MSL_C/extras.c"), Object(Matching, "MSL_C/MSL_Common_Embedded/Math/Double_precision/e_acos.c"), diff --git a/src/MSL_C/abort_exit_ppc_eabi.c b/src/MSL_C/abort_exit_ppc_eabi.c index 3fd110805..be16a9875 100644 --- a/src/MSL_C/abort_exit_ppc_eabi.c +++ b/src/MSL_C/abort_exit_ppc_eabi.c @@ -1,4 +1,5 @@ #include +#pragma exceptions on int raise(int); int exit(int); @@ -10,4 +11,4 @@ void abort(void) { raise(1); __aborting = 1; exit(1); -} \ No newline at end of file +} diff --git a/src/MSL_C/math_api.c b/src/MSL_C/math_api.c index 57af5464d..7bfff32cf 100644 --- a/src/MSL_C/math_api.c +++ b/src/MSL_C/math_api.c @@ -1,4 +1,5 @@ #include "math_api.h" +#pragma exceptions on int __fpclassifyf(float f) { int val = (*(int*)&f); @@ -52,4 +53,4 @@ int __fpclassifyd(double dbl) { } return 4; -} \ No newline at end of file +} diff --git a/src/MSL_C/mbstring.c b/src/MSL_C/mbstring.c index 934671f95..1ac603ce0 100644 --- a/src/MSL_C/mbstring.c +++ b/src/MSL_C/mbstring.c @@ -1,6 +1,7 @@ #include "mbstring.h" #include "locale.h" #include +#pragma exceptions on int mbtowc(wchar_t *pDest, const char *s, size_t num) { return _current_locale.ctype_cmpt_ptr->decode_mb(pDest, s, num); @@ -106,4 +107,4 @@ size_t wcstombs(char *pSrc, const wchar_t *pwcs, size_t n) { } return chars_written; -} \ No newline at end of file +} diff --git a/src/MSL_C/mem.c b/src/MSL_C/mem.c index 20dabf0b1..2cf8a17ca 100644 --- a/src/MSL_C/mem.c +++ b/src/MSL_C/mem.c @@ -1,6 +1,7 @@ #include #include "mem_funcs.h" #include "string_api.h" +#pragma exceptions on void* memmove(void *pDest, const void *pSource, size_t num) { const char* cur; @@ -79,4 +80,4 @@ int memcmp(const void *pSource1, const void *pSource2, size_t num) { } return 0; -} \ No newline at end of file +} diff --git a/src/MSL_C/printf.c b/src/MSL_C/printf.c index e868dcb16..0ddd132e6 100644 --- a/src/MSL_C/printf.c +++ b/src/MSL_C/printf.c @@ -5,6 +5,7 @@ #include #include "ansi_fp.h" #include "wchar_io.h" +#pragma exceptions on #define LDBL_MANT_DIG 24 #define LDBL_MAX_EXP 128 @@ -1381,4 +1382,4 @@ int sprintf(char *s, const char *format, ...) { va_list args; va_start(args, format); return vsnprintf(s, 0xFFFFFFFF, format, args); -} \ No newline at end of file +} diff --git a/src/MSL_C/scanf.c b/src/MSL_C/scanf.c index a04c3f6dd..000e86025 100644 --- a/src/MSL_C/scanf.c +++ b/src/MSL_C/scanf.c @@ -3,6 +3,7 @@ #include "va_list.h" #include #include +#pragma exceptions on enum argument_options { normal_argument, @@ -804,4 +805,4 @@ int sscanf(const char *s, const char *pFormat, ...) { va_list args; va_start(args, pFormat); return vsscanf(s, pFormat, args); -} \ No newline at end of file +} diff --git a/src/MSL_C/strtold.c b/src/MSL_C/strtold.c index a76e48c75..3d51b4855 100644 --- a/src/MSL_C/strtold.c +++ b/src/MSL_C/strtold.c @@ -4,6 +4,7 @@ #include #include #include "mem.h" +#pragma exceptions on extern double nan(const char *); extern double __dec2num(const decimal *); @@ -624,4 +625,4 @@ long double __strtold(int max_width, int (*ReadProc)(void *, int, int), void* Re return result; } -} \ No newline at end of file +} diff --git a/src/MSL_C/uart_console_io_gcn.c b/src/MSL_C/uart_console_io_gcn.c index be9312947..a1bd46553 100644 --- a/src/MSL_C/uart_console_io_gcn.c +++ b/src/MSL_C/uart_console_io_gcn.c @@ -1,12 +1,13 @@ #include "size_t.h" #include "UART.h" #include +#pragma exceptions on int __TRK_write_console(unsigned long, unsigned char *, size_t *, void *); typedef void (* __idle_proc) (void); -UARTError __init_uart_console(void) { +static UARTError __init_uart_console(void) { UARTError err = kUARTNoError; static int initialized = 0; @@ -19,11 +20,7 @@ UARTError __init_uart_console(void) { } return err; -} -/* this is somewhere else */ -int __read_console(unsigned long handle, unsigned char *buffer, size_t *count, __idle_proc) { - return 0; } int __write_console(unsigned long handle, unsigned char *buffer, size_t *count, void *ref) { @@ -44,4 +41,4 @@ int __write_console(unsigned long handle, unsigned char *buffer, size_t *count, int __close_console(unsigned long handle) { return 0; -} \ No newline at end of file +} diff --git a/src/MSL_C/wprintf.c b/src/MSL_C/wprintf.c index d7ad4c5ab..3a55c7189 100644 --- a/src/MSL_C/wprintf.c +++ b/src/MSL_C/wprintf.c @@ -8,6 +8,7 @@ #include "wmem.h" #include "wstring.h" #include "va_list.h" +#pragma exceptions on #define LDBL_MANT_DIG 24 #define LDBL_MAX_EXP 128 @@ -1364,4 +1365,4 @@ int vswprintf(wchar_t *s, size_t n, const wchar_t *format, va_list arg) { } return count; -} \ No newline at end of file +}