From 59cff2190d44edf9e64c1d8c4cfd5931b2354aaf Mon Sep 17 00:00:00 2001 From: sbird Date: Sat, 16 Apr 2022 19:03:20 +0200 Subject: [PATCH] fix building without NDEBUG on agbcc --- ld_script.txt | 43 ++++++++++++++++++++++++++++++++++++++++--- src/libisagbprn.c | 10 +++++----- src/mystery_gift.c | 4 ++++ 3 files changed, 49 insertions(+), 8 deletions(-) diff --git a/ld_script.txt b/ld_script.txt index d68498a8b..1460c8443 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -20,7 +20,9 @@ SECTIONS { . = 0x1C000; INCLUDE "sym_ewram.ld" - + *libc.a:impure.o(.data); + *libc.a:locale.o(.data); + *libc.a:mallocr.o(.data); . = 0x40000; } @@ -462,6 +464,7 @@ SECTIONS { src/mystery_gift_server.o(.rodata); src/mystery_gift_client.o(.rodata); src/mystery_gift_scripts.o(.rodata); + src/wonder_news.o(.rodata); src/union_room_chat.o(.rodata); src/berry_crush.o(.rodata); src/berry_powder.o(.rodata); @@ -1245,9 +1248,43 @@ SECTIONS { src/librfu_sio32id.o(.rodata); *libgcc.a:_divdi3.o(.rodata); *libgcc.a:_udivdi3.o(.rodata); - *libc.a(.rodata); - *libc.a(.data); + *libc.a:memcpy.o(.rodata); + *libc.a:memset.o(.rodata); + *libc.a:strcmp.o(.rodata); + *libc.a:strcpy.o(.rodata); + *libc.a:impure.o(.rodata); + *libc.a:vsprintf.o(.rodata); + *libc.a:vfprintf.o(.rodata); + *libc.a:wsetup.o(.rodata); + *libc.a:dtoa.o(.rodata); + *libc.a:fflush.o(.rodata); + *libc.a:findfp.o(.rodata); + *libc.a:freer.o(.rodata); + *libc.a:mtrim.o(.rodata); + *libc.a:fvwrite.o(.rodata); + *libc.a:fwalk.o(.rodata); + *libc.a:locale.o(.rodata); + *libc.a:makebuf.o(.rodata); + *libc.a:mallocr.o(.rodata); + *libc.a:mbtowc_r.o(.rodata); + *libc.a:memchr.o(.rodata); + *libc.a:memmove.o(.rodata); + *libc.a:mlock.o(.rodata); + *libc.a:mprec.o(.rodata); + *libc.a:s_isinf.o(.rodata); + *libc.a:s_isnan.o(.rodata); + *libc.a:sbrkr.o(.rodata); + *libc.a:stdio.o(.rodata); + *libc.a:strlen.o(.rodata); *libc.a:syscalls.o(.rodata); + *libc.a:writer.o(.rodata); + *libc.a:callocr.o(.rodata); + *libc.a:closer.o(.rodata); + *libc.a:errno.o(.rodata); + *libc.a:fstatr.o(.rodata); + *libc.a:libcfunc.o(.rodata); + *libc.a:lseekr.o(.rodata); + *libc.a:readr.o(.rodata); src/libisagbprn.o(.rodata); } =0 diff --git a/src/libisagbprn.c b/src/libisagbprn.c index 69c6986ae..7a70cf41f 100644 --- a/src/libisagbprn.c +++ b/src/libisagbprn.c @@ -31,7 +31,7 @@ void AGBPrintFlush1Block(void); void AGBPrintInit(void) { volatile struct AGBPrintStruct *pPrint = (struct AGBPrintStruct *)AGB_PRINT_STRUCT_ADDR; - u16 *pWSCNT = ®_WAITCNT; + vu16 *pWSCNT = ®_WAITCNT; u16 *pProtect = (u16 *)AGB_PRINT_PROTECT_ADDR; u16 nOldWSCNT = *pWSCNT; *pWSCNT = WSCNT_DATA; @@ -57,7 +57,7 @@ static void AGBPutcInternal(const char cChr) void AGBPutc(const char cChr) { - u16 *pWSCNT = ®_WAITCNT; + vu16 *pWSCNT = ®_WAITCNT; u16 nOldWSCNT = *pWSCNT; volatile struct AGBPrintStruct *pPrint; *pWSCNT = WSCNT_DATA; @@ -71,7 +71,7 @@ void AGBPutc(const char cChr) void AGBPrint(const char *pBuf) { volatile struct AGBPrintStruct *pPrint = (struct AGBPrintStruct *)AGB_PRINT_STRUCT_ADDR; - u16 *pWSCNT = ®_WAITCNT; + vu16 *pWSCNT = ®_WAITCNT; u16 nOldWSCNT = *pWSCNT; *pWSCNT = WSCNT_DATA; while (*pBuf) @@ -95,9 +95,9 @@ void AGBPrintf(const char *pBuf, ...) static void AGBPrintTransferDataInternal(u32 bAllData) { LPFN_PRINT_FLUSH lpfnFuncFlush; - u16 *pIME; + vu16 *pIME; u16 nIME; - u16 *pWSCNT; + vu16 *pWSCNT; u16 nOldWSCNT; u16 *pProtect; volatile struct AGBPrintStruct *pPrint; diff --git a/src/mystery_gift.c b/src/mystery_gift.c index 1df6533d9..72fc2b377 100755 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -506,9 +506,13 @@ static void IncrementCardStat(u32 statType) } if (stat == NULL) + { AGB_ASSERT(0); + } else if (++(*stat) > MAX_WONDER_CARD_STAT) + { *stat = MAX_WONDER_CARD_STAT; + } } }