summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2020-05-22 13:07:27 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2020-05-22 13:07:27 -0400
commitf082c752ff145f7e1ade13fbb83e46904160896f (patch)
tree76dee13e1db8b69c805430f9b93bdad85aa83b7e
parent08c3453ffb413262818b4960c68ee94f4b6a5eea (diff)
Split out stdlib .exception sections
-rw-r--r--arm9/arm9.lcf18
-rw-r--r--arm9/asm/libc.s246
-rw-r--r--arm9/asm/libmwcc.s28
-rw-r--r--arm9/data/rom2.s261
4 files changed, 285 insertions, 268 deletions
diff --git a/arm9/arm9.lcf b/arm9/arm9.lcf
index 09e9fbc4..69bab74d 100644
--- a/arm9/arm9.lcf
+++ b/arm9/arm9.lcf
@@ -548,6 +548,19 @@ SECTIONS {
/* MWCC library */
libmwcc.o (.text)
+ . = ALIGN(4);
+ /* Exception */
+ libc.o (.exception)
+ libmwcc.o (.exception)
+
+ . = ALIGN(4);
+ SDK_STATIC_ETABLE_START = .;
+ EXCEPTION
+ SDK_STATIC_ETABLE_END = .;
+
+ . = ALIGN(4);
+ // * (.init)
+ . = ALIGN(4);
/* Text data */
rom2.o (.rodata)
string_util.o (.rodata)
@@ -560,6 +573,11 @@ SECTIONS {
FS_overlay.o (.rodata)
rom2_3.o (.rodata)
libmwcc.o (.rodata)
+ . = ALIGN(4);
+
+ SDK_STATIC_SINIT_START = .;
+ WRITEW 0;
+ SDK_STATIC_SINIT_END = .;
. = ALIGN(32);
SDK_STATIC_TEXT_END = .;
diff --git a/arm9/asm/libc.s b/arm9/asm/libc.s
index 1a35cc19..6a8f7a5d 100644
--- a/arm9/asm/libc.s
+++ b/arm9/asm/libc.s
@@ -13955,3 +13955,249 @@ strnicmp: ; 0x020E9B38
bx r12
.balign 4
_020E9B40: .word stricmp
+
+ .section .exception
+ ; 0x020EC710
+ .global UNK_020EC710
+UNK_020EC710: ; 0x020EC710
+ .byte 0x20, 0xFF, 0x09, 0x60
+ .byte 0x00, 0x00, 0x00, 0x00
+
+ .global UNK_020EC718
+UNK_020EC718: ; 0x020EC718
+ .byte 0x00, 0xFF, 0x01, 0xB0
+ .byte 0x00, 0x00, 0x00, 0x00
+
+ .global UNK_020EC720
+UNK_020EC720: ; 0x020EC720
+ .byte 0x00, 0xFF, 0x01, 0xD0
+ .byte 0x00, 0x00, 0x00, 0x00
+
+ .global UNK_020EC728
+UNK_020EC728: ; 0x020EC728
+ .byte 0x20, 0xFF, 0x09, 0x60
+ .byte 0x00, 0x00, 0x00, 0x00
+
+ .global UNK_020EC730
+UNK_020EC730: ; 0x020EC730
+ .byte 0x20, 0xFF, 0x11, 0x68
+ .byte 0x00, 0x00, 0x00, 0x00
+
+ .global UNK_020EC738
+UNK_020EC738: ; 0x020EC738
+ .byte 0x20, 0xFF, 0x01, 0xB8
+ .byte 0x00, 0x00, 0x00, 0x00
+
+ .global UNK_020EC740
+UNK_020EC740: ; 0x020EC740
+ .byte 0x00, 0xFF, 0x05, 0x20
+ .byte 0x00, 0x00, 0x00, 0x00
+
+ .global UNK_020EC748
+UNK_020EC748: ; 0x020EC748
+ .word abort
+ .short 37
+ .word 0x00100000
+ .word exit
+ .short 77
+ .word 0x00100100
+ .word __exit
+ .short 297
+ .word 0x00200300
+ .word nan
+ .short 25
+ .word 0x00000000
+ .word __flush_line_buffered_output_files
+ .short 141
+ .word 0x00403F00
+ .word __flush_all
+ .short 105
+ .word 0x00403F00
+ .word __msl_assertion_failed
+ .short 61
+ .word 0x00200100
+ .word __load_buffer
+ .short 141
+ .word 0x00200700
+ .word __flush_buffer
+ .short 137
+ .word 0x00200300
+ .word fread
+ .short 269
+ .word 0x00407F00
+ .word __fread
+ .short 841
+ .word 0x00507F00
+ .word __fwrite
+ .short 689
+ .word 0x0060FF00
+ .word fclose
+ .short 117
+ .word 0x00200300
+ .word fflush
+ .short 233
+ .word 0x00100100
+ .word ftell
+ .short 285
+ .word 0x00300F00
+ .word _fseek
+ .short 489
+ .word 0x00400320
+ .word fseek
+ .short 301
+ .word 0x00403F00
+ .word rewind
+ .short 37
+ .word 0x00100100
+ .word mbtowc
+ .short 29
+ .word 0x00100000
+ .word wctomb
+ .short 29
+ .word 0x00100000
+ .word mbstowcs
+ .short 137
+ .word 0x00301F00
+ .word wcstombs
+ .short 121
+ .word 0x00403F00
+ .word memset
+ .short 21
+ .word 0x00100100
+ .word long2str
+ .short 589
+ .word 0x0090FF20
+ .word longlong2str
+ .short 737
+ .word 0x00A0FF20
+ .word double2hex
+ .short 1245
+ .word 0x00F07F20
+ .word float2str
+ .short 1893
+ .word 0x00C0FF20
+ .word __pformatter
+ .short 2084
+ .word UNK_020EC710
+ .word __FileWrite
+ .short 45
+ .word 0x00200300
+ .word __StringWrite
+ .short 69
+ .word 0x00200300
+ .word printf
+ .short 281
+ .word 0x00300120
+ .word vsnprintf
+ .short 105
+ .word 0x00300300
+ .word snprintf
+ .short 41
+ .word 0x00300020
+ .word sprintf
+ .short 45
+ .word 0x00300020
+ .word qsort
+ .short 357
+ .word 0x0070FF00
+ .word __sformatter
+ .short 3412
+ .word UNK_020EC718
+ .word vsscanf
+ .short 85
+ .word 0x00200000
+ .word sscanf
+ .short 41
+ .word 0x00300020
+ .word raise
+ .short 305
+ .word 0x00200300
+ .word __strtold
+ .short 4684
+ .word UNK_020EC720
+ .word strtold
+ .short 225
+ .word 0x00500F00
+ .word atod
+ .short 17
+ .word 0x00000000
+ .word __strtoul
+ .short 1001
+ .word 0x0060FF00
+ .word __strtoull
+ .short 1101
+ .word 0x0080FF00
+ .word strtoul
+ .short 153
+ .word 0x00600300
+ .word strtold2
+ .short 201
+ .word 0x00600300
+ .word atol
+ .short 21
+ .word 0x00000000
+ .word wmemcpy
+ .short 17
+ .word 0x00000000
+ .word long2str_wide
+ .short 593
+ .word 0x0090FF20
+ .word longlong2str_wide
+ .short 741
+ .word 0x00A0FF20
+ .word double2hex_wide
+ .short 921
+ .word 0x00F07F20
+ .word float2str_wide
+ .short 1612
+ .word UNK_020EC728
+ .word __wpformatter
+ .short 2288
+ .word UNK_020EC730
+ .word __wStringWrite
+ .short 65
+ .word 0x00200300
+ .word swprintf
+ .short 41
+ .word 0x00300020
+ .word vswprintf
+ .short 113
+ .word 0x00300300
+ .word __ieee754_pow
+ .short 4488
+ .word UNK_020EC738
+ .word frexp
+ .short 189
+ .word 0x00300120
+ .word ldexp
+ .short 589
+ .word 0x00300120
+ .word pow
+ .short 13
+ .word 0x00000000
+ .word __rounddec
+ .short 65
+ .word 0x00200300
+ .word __ull2dec
+ .short 205
+ .word 0x0050FF00
+ .word __timesdec
+ .short 389
+ .word 0x00D0FF00
+ .word __str2dec
+ .short 157
+ .word 0x00100000
+ .word __two_exp
+ .short 901
+ .word 0x00B00300
+ .word __num2dec_internal
+ .short 385
+ .word 0x00E01F00
+ .word __num2dec_internal2
+ .short 169
+ .word 0x00200300
+ .word __dec2num
+ .short 1572
+ .word UNK_020EC740
+ .word scalbn
+ .short 45
diff --git a/arm9/asm/libmwcc.s b/arm9/asm/libmwcc.s
index 8afb6fe6..c9ac924c 100644
--- a/arm9/asm/libmwcc.s
+++ b/arm9/asm/libmwcc.s
@@ -3102,15 +3102,11 @@ __close_console: ; 0x020EC68C
mov r0, #0x0
bx lr
- .section .rodata
-__static_initializers:
- .word 0
-
- .section .text
+ .extern SDK_STATIC_SINIT_START
arm_func_start __call_static_initializers
__call_static_initializers: ; 0x020EC694
stmdb sp!, {r4,lr}
- ldr r4, _020EC6BC ; =__static_initializers
+ ldr r4, _020EC6BC ; =SDK_STATIC_SINIT_START
b _020EC6A8
_020EC6A0:
blx r0
@@ -3122,7 +3118,7 @@ _020EC6A8:
bne _020EC6A0
ldmia sp!, {r4,pc}
.balign 4
-_020EC6BC: .word __static_initializers
+_020EC6BC: .word SDK_STATIC_SINIT_START
arm_func_start __destroy_global_chain
__destroy_global_chain: ; 0x020EC6C0
@@ -3153,3 +3149,21 @@ _ExitProcess: ; 0x020EC704
bx r12
.balign 4
_020EC70C: .word sys_exit
+
+ .section .exception
+ .word 0x00200100
+ .word __read_console
+ .short 81
+ .word 0x00300F00
+ .word __write_console
+ .short 53
+ .word 0x00200700
+ .word __call_static_initializers
+ .short 45
+ .word 0x00100100
+ .word __destroy_global_chain
+ .short 69
+ .word 0x00200300
+ .word _ExitProcess
+ .short 13
+ .word 0x00000000
diff --git a/arm9/data/rom2.s b/arm9/data/rom2.s
index 4a93ec17..5cdb9ae0 100644
--- a/arm9/data/rom2.s
+++ b/arm9/data/rom2.s
@@ -4,267 +4,6 @@
.section .rodata
- ; 0x020EC710
- .global UNK_020EC710
-UNK_020EC710: ; 0x020EC710
- .byte 0x20, 0xFF, 0x09, 0x60
- .byte 0x00, 0x00, 0x00, 0x00
-
- .global UNK_020EC718
-UNK_020EC718: ; 0x020EC718
- .byte 0x00, 0xFF, 0x01, 0xB0
- .byte 0x00, 0x00, 0x00, 0x00
-
- .global UNK_020EC720
-UNK_020EC720: ; 0x020EC720
- .byte 0x00, 0xFF, 0x01, 0xD0
- .byte 0x00, 0x00, 0x00, 0x00
-
- .global UNK_020EC728
-UNK_020EC728: ; 0x020EC728
- .byte 0x20, 0xFF, 0x09, 0x60
- .byte 0x00, 0x00, 0x00, 0x00
-
- .global UNK_020EC730
-UNK_020EC730: ; 0x020EC730
- .byte 0x20, 0xFF, 0x11, 0x68
- .byte 0x00, 0x00, 0x00, 0x00
-
- .global UNK_020EC738
-UNK_020EC738: ; 0x020EC738
- .byte 0x20, 0xFF, 0x01, 0xB8
- .byte 0x00, 0x00, 0x00, 0x00
-
- .global UNK_020EC740
-UNK_020EC740: ; 0x020EC740
- .byte 0x00, 0xFF, 0x05, 0x20
- .byte 0x00, 0x00, 0x00, 0x00
-
- .global UNK_020EC748
-UNK_020EC748: ; 0x020EC748
- .word abort
- .short 37
- .word 0x00100000
- .word exit
- .short 77
- .word 0x00100100
- .word __exit
- .short 297
- .word 0x00200300
- .word nan
- .short 25
- .word 0x00000000
- .word __flush_line_buffered_output_files
- .short 141
- .word 0x00403F00
- .word __flush_all
- .short 105
- .word 0x00403F00
- .word __msl_assertion_failed
- .short 61
- .word 0x00200100
- .word __load_buffer
- .short 141
- .word 0x00200700
- .word __flush_buffer
- .short 137
- .word 0x00200300
- .word fread
- .short 269
- .word 0x00407F00
- .word __fread
- .short 841
- .word 0x00507F00
- .word __fwrite
- .short 689
- .word 0x0060FF00
- .word fclose
- .short 117
- .word 0x00200300
- .word fflush
- .short 233
- .word 0x00100100
- .word ftell
- .short 285
- .word 0x00300F00
- .word _fseek
- .short 489
- .word 0x00400320
- .word fseek
- .short 301
- .word 0x00403F00
- .word rewind
- .short 37
- .word 0x00100100
- .word mbtowc
- .short 29
- .word 0x00100000
- .word wctomb
- .short 29
- .word 0x00100000
- .word mbstowcs
- .short 137
- .word 0x00301F00
- .word wcstombs
- .short 121
- .word 0x00403F00
- .word memset
- .short 21
- .word 0x00100100
- .word long2str
- .short 589
- .word 0x0090FF20
- .word longlong2str
- .short 737
- .word 0x00A0FF20
- .word double2hex
- .short 1245
- .word 0x00F07F20
- .word float2str
- .short 1893
- .word 0x00C0FF20
- .word __pformatter
- .short 2084
- .word UNK_020EC710
- .word __FileWrite
- .short 45
- .word 0x00200300
- .word __StringWrite
- .short 69
- .word 0x00200300
- .word printf
- .short 281
- .word 0x00300120
- .word vsnprintf
- .short 105
- .word 0x00300300
- .word snprintf
- .short 41
- .word 0x00300020
- .word sprintf
- .short 45
- .word 0x00300020
- .word qsort
- .short 357
- .word 0x0070FF00
- .word __sformatter
- .short 3412
- .word UNK_020EC718
- .word vsscanf
- .short 85
- .word 0x00200000
- .word sscanf
- .short 41
- .word 0x00300020
- .word raise
- .short 305
- .word 0x00200300
- .word __strtold
- .short 4684
- .word UNK_020EC720
- .word strtold
- .short 225
- .word 0x00500F00
- .word atod
- .short 17
- .word 0x00000000
- .word __strtoul
- .short 1001
- .word 0x0060FF00
- .word __strtoull
- .short 1101
- .word 0x0080FF00
- .word strtoul
- .short 153
- .word 0x00600300
- .word strtold2
- .short 201
- .word 0x00600300
- .word atol
- .short 21
- .word 0x00000000
- .word wmemcpy
- .short 17
- .word 0x00000000
- .word long2str_wide
- .short 593
- .word 0x0090FF20
- .word longlong2str_wide
- .short 741
- .word 0x00A0FF20
- .word double2hex_wide
- .short 921
- .word 0x00F07F20
- .word float2str_wide
- .short 1612
- .word UNK_020EC728
- .word __wpformatter
- .short 2288
- .word UNK_020EC730
- .word __wStringWrite
- .short 65
- .word 0x00200300
- .word swprintf
- .short 41
- .word 0x00300020
- .word vswprintf
- .short 113
- .word 0x00300300
- .word __ieee754_pow
- .short 4488
- .word UNK_020EC738
- .word frexp
- .short 189
- .word 0x00300120
- .word ldexp
- .short 589
- .word 0x00300120
- .word pow
- .short 13
- .word 0x00000000
- .word __rounddec
- .short 65
- .word 0x00200300
- .word __ull2dec
- .short 205
- .word 0x0050FF00
- .word __timesdec
- .short 389
- .word 0x00D0FF00
- .word __str2dec
- .short 157
- .word 0x00100000
- .word __two_exp
- .short 901
- .word 0x00B00300
- .word __num2dec_internal
- .short 385
- .word 0x00E01F00
- .word __num2dec_internal2
- .short 169
- .word 0x00200300
- .word __dec2num
- .short 1572
- .word UNK_020EC740
- .word scalbn
- .short 45
- .word 0x00200100
- .word __read_console
- .short 81
- .word 0x00300F00
- .word __write_console
- .short 53
- .word 0x00200700
- .word __call_static_initializers
- .short 45
- .word 0x00100100
- .word __destroy_global_chain
- .short 69
- .word 0x00200300
- .word _ExitProcess
- .short 13
- .word 0x00000000
-
.global UNK_020ECAC0
UNK_020ECAC0: ; 0x020ECAC0
.byte 0x0A, 0x00, 0x00, 0x00