Link newlib

This commit is contained in:
PikalaxALT 2017-12-16 21:43:34 -05:00
parent f95a4a9324
commit 666f5d4e3a
6 changed files with 24 additions and 9373 deletions

View File

@ -98,7 +98,7 @@ $(LIBC) $(LIBM):
make -C newlib
pmd_red.elf: ld_script.ld $(OBJS) $(LIBC) $(LIBM)
$(LD) -T ld_script.ld -Map pmd_red.map -o $@ $(OBJS) $(LIBGCC) # $(LIBC) $(LIBM)
$(LD) -T ld_script.ld -Map pmd_red.map -o $@ $(OBJS) $(LIBC) $(LIBM) $(LIBGCC)
pmd_red.gba: pmd_red.elf
$(OBJCOPY) -O binary --gap-fill 0xFF --pad-to 0xA000000 $< $@

9104
asm/libc.s

File diff suppressed because it is too large Load Diff

View File

@ -1,165 +0,0 @@
.section .rodata
.align 2, 0
.global gUnknown_826FDE4
gUnknown_826FDE4: @ 826FDE4
.byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
.global gUnknown_826FDF4
gUnknown_826FDF4: @ 826FDF4
.byte 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30
.align 2, 0
.global gUnknown_826FE04
gUnknown_826FE04: @ 826FE04
.ascii "Inf"
.align 2, 0
.global gUnknown_826FE08
gUnknown_826FE08: @ 826FE08
.ascii "NaN"
.align 2, 0
.global gUnknown_826FE0C
gUnknown_826FE0C: @ 826FE0C
.ascii "0123456789abcdef"
.space 4
.global gUnknown_826FE20
gUnknown_826FE20: @ 826FE20
.ascii "(null)"
.align 2, 0
.global gUnknown_826FE28
gUnknown_826FE28: @ 826FE28
.ascii "0123456789ABCDEF"
.space 4
.global gUnknown_826FE3C
gUnknown_826FE3C: @ 826FE3C
.ascii "bug in vfprintf: bad base"
.align 2, 0
.global gUnknown_826FE58
gUnknown_826FE58: @ 826FE58
.ascii "0"
.align 2, 0
.global gUnknown_826FE5C
gUnknown_826FE5C: @ 826FE5C
.ascii "."
.align 2, 0
.global gUnknown_826FE60
gUnknown_826FE60: @ 826FE60
.ascii "Infinity"
.space 4
.global gUnknown_826FE6C
gUnknown_826FE6C: @ 826FE6C
.ascii "NaN"
.align 2, 0
.global gUnknown_826FE70
gUnknown_826FE70: @ 826FE70
.ascii "0"
.align 2, 0
.ascii "C"
.align 2, 0
@ locale
.global lconv
lconv: @ 826FE78
.4byte gUnknown_826FEAC, gUnknown_826FEA8
.4byte gUnknown_826FEA8, gUnknown_826FEA8
.4byte gUnknown_826FEA8, gUnknown_826FEA8
.4byte gUnknown_826FEA8, gUnknown_826FEA8
.4byte gUnknown_826FEA8, gUnknown_826FEA8
.4byte 0xffffffff, 0xffffffff
.global gUnknown_826FEA8
gUnknown_826FEA8: @ 826FEA8
.ascii ""
.space 4
.global gUnknown_826FEAC
gUnknown_826FEAC: @ 826FEAC
.ascii "."
.align 2, 0
.global gUnknown_826FEB0
gUnknown_826FEB0: @ 826FEB0
.ascii "C"
@ mprec
.align 2, 0
.global gUnknown_826FEB4
gUnknown_826FEB4: @ 826FEB4
.4byte 5
.4byte 25
.4byte 125
.align 2, 0
.global __mprec_tens
__mprec_tens: @ 826FEC0
.8byte 0x000000003ff00000 @ 1e0
.8byte 0x0000000040240000 @ 1e1
.8byte 0x0000000040590000 @ 1e2
.8byte 0x00000000408f4000 @ 1e3
.8byte 0x0000000040c38800 @ 1e4
.8byte 0x0000000040f86a00 @ 1e5
.8byte 0x00000000412e8480 @ 1e6
.8byte 0x00000000416312d0 @ 1e7
.8byte 0x000000004197d784 @ 1e8
.8byte 0x0000000041cdcd65 @ 1e9
.8byte 0x200000004202a05f @ 1e10
.8byte 0xe800000042374876 @ 1e11
.8byte 0xa2000000426d1a94 @ 1e12
.8byte 0xe540000042a2309c @ 1e13
.8byte 0x1e90000042d6bcc4 @ 1e14
.8byte 0x26340000430c6bf5 @ 1e15
.8byte 0x37e080004341c379 @ 1e16
.8byte 0x85d8a00043763457 @ 1e17
.8byte 0x674ec80043abc16d @ 1e18
.8byte 0x60913d0043e158e4 @ 1e19
.8byte 0x78b58c404415af1d @ 1e20
.8byte 0xd6e2ef50444b1ae4 @ 1e21
.8byte 0x064dd5924480f0cf @ 1e22
.8byte 0xc7e14af644b52d02 @ 1e23
.8byte 0x79d99db444ea7843 @ 1e24
.align 2, 0
.global __mprec_bigtens
__mprec_bigtens: @ 826FF88
.8byte 0x37e080004341c379 @ 1e16
.8byte 0xb5056e174693b8b5 @ 1e32
.8byte 0xe93ff9f54d384f03 @ 1e64
.8byte 0xf9301d325a827748 @ 1e128
.8byte 0x7f73bf3c75154fdd @ 1e256
.align 2, 0
.global __mprec_tinytens
__mprec_tinytens:
.8byte 0x97d889bc3c9cd2b2 @ 1e-16
.8byte 0xd5a8a7333949f623 @ 1e-32
.8byte 0x44f4a73d32a50ffd @ 1e-64
.8byte 0xcf8c979d255bba08 @ 1e-128
.8byte 0x64ac6f430ac80628 @ 1e-256
@ syscalls
.align 2, 0
.global gUnknown_826FFD8
gUnknown_826FFD8: @ 826FFD8
.ascii ":tt"
.byte 0
.align 2, 0
.global gUnknown_826FFDC
gUnknown_826FFDC: @ 826FFDC
.ascii "_sbrk: Heap and stack collision\n"
.byte 0
.align 2, 0 @ don't pad with nop

View File

@ -14,8 +14,18 @@ SECTIONS {
tools/agbcc/lib/libgcc.a:fp-bit.o(.bss);
. = ALIGN(4);
tools/agbcc/lib/libgcc.a:dp-bit.o(.bss);
. = ALIGN(8);
. = ALIGN(4);
newlib/libc.a:syscalls.o(.bss);
. = ALIGN(16);
<EWRAM2>
. = ALIGN(4);
newlib/libc.a:impure.o(.data);
. = ALIGN(4);
newlib/libc.a:locale.o(.data);
. = ALIGN(4);
newlib/libc.a:mallocr_MALLOC.o(.data);
. = ALIGN(4);
gUnknown_203BC04 = .;
. = 0x40000;
}
@ -75,7 +85,6 @@ SECTIONS {
tools/agbcc/lib/libgcc.a:dp-bit.o(.text);
tools/agbcc/lib/libgcc.a:_lshrdi3.o(.text);
tools/agbcc/lib/libgcc.a:_negdi2.o(.text);
/*
newlib/libc.a:memcpy.o(.text);
newlib/libc.a:memset.o(.text);
newlib/libc.a:sprintf.o(.text);
@ -115,46 +124,6 @@ SECTIONS {
newlib/libc.a:libcfunc.o(.text);
newlib/libc.a:lseekr.o(.text);
newlib/libc.a:readr.o(.text);
*/
asm/libc.o(.text.memcpy);
asm/libc.o(.text.memset);
asm/libc.o(.text.sprintf);
asm/libc.o(.text.strcat);
asm/libc.o(.text.strcmp);
asm/libc.o(.text.strcpy);
asm/libc.o(.text.strlen);
asm/libc.o(.text.strncpy);
asm/libc.o(.text.vfprintf);
asm/libc.o(.text.vsprintf);
asm/libc.o(.text.wsetup);
asm/libc.o(.text.dtoa);
asm/libc.o(.text.fflush);
asm/libc.o(.text.findfp);
asm/libc.o(.text.mallocr_FREE);
asm/libc.o(.text.fvwrite);
asm/libc.o(.text.fwalk);
asm/libc.o(.text.locale);
asm/libc.o(.text.makebuf);
asm/libc.o(.text.mallocr_MALLOC);
asm/libc.o(.text.mbtowc_r);
asm/libc.o(.text.memchr);
asm/libc.o(.text.memmove);
asm/libc.o(.text.mlock);
asm/libc.o(.text.mprec);
asm/libc.o(.text.s_isinf);
asm/libc.o(.text.s_isnan);
asm/libc.o(.text.sbrkr);
asm/libc.o(.text.stdio);
asm/libc.o(.text.syscalls);
asm/libc.o(.text.writer);
asm/libc.o(.text.mallocr_CALLOC);
asm/libc.o(.text.closer);
asm/libc.o(.text.errno);
asm/libc.o(.text.fstatr);
asm/libc.o(.text.abort);
asm/libc.o(.text.libcfunc);
asm/libc.o(.text.lseekr);
asm/libc.o(.text.readr);
tools/agbcc/lib/libgcc.a:_udivsi3.o(.text);
} =0
@ -168,15 +137,21 @@ SECTIONS {
src/agb_flash_1m.o(.rodata);
src/agb_flash_mx.o(.rodata);
src/agb_flash_le.o(.rodata);
/*
. = ALIGN(4);
newlib/libc.a:sprintf.o(.rodata);
. = ALIGN(4);
newlib/libc.a:vfprintf.o(.rodata);
. = ALIGN(4);
newlib/libc.a:dtoa.o(.rodata);
. = ALIGN(4);
newlib/libc.a:impure.o(.rodata);
. = ALIGN(4);
newlib/libc.a:locale.o(.rodata);
. = ALIGN(4);
newlib/libc.a:mprec.o(.rodata);
. = ALIGN(4);
newlib/libc.a:syscalls.o(.rodata);
*/
data/libc_data.o(.rodata);
. = ALIGN(4);
data/data_8270000.o(.rodata);
} =0

View File

@ -1,11 +1,11 @@
AS := $(DEVKITARM)/bin/arm-none-eabi-as
ASFLAGS := -mcpu=arm7tdmi
CC1 := ../tools/agbcc/bin/agbcc
override CFLAGS += -O2 -fhex-asm
CC1 := ../tools/agbcc/bin/old_agbcc
override CFLAGS += -O2 -fhex-asm -fno-builtin
CPP := cpp
CPPFLAGS := -I ../tools/agbcc/include -I libc/include -iquote libm/common -D__thumb__ -D__GNUC__ -nostdinc -undef
CPPFLAGS := -I ../tools/agbcc/include -I libc/include -iquote libm/common -D__thumb__ -D__GNUC__ -DARM_RDI_MONITOR -undef -nostdinc
AR := ar
ARFLAGS := "-rc"

View File

@ -1,21 +1,5 @@
.align 2
.include "newlib/libc.a:syscalls.o"
heap_end: @ 2039E18
.space 0x4
monitor_stdin: @ 2039E1C
.space 0x4
monitor_stdout: @ 2039E20
.space 0x4
monitor_stderr: @ 2039E24
.space 0x4
openfiles: @ 2039E28
.space 0xA8
gUnknown_2039ED0: @ 2039ED0
.space 0xFB0
@ -667,43 +651,4 @@ gUnknown_203B4B4: @ 203B4B4
.space 0x4
gUnknown_203B4B8: @ 203B4B8
.space 0x2F0
@ libc
/*
.include "newlib/libc.a:impure.o"
.include "newlib/libc.a:locale.o"
.include "newlib/libc.a:mallocr_MALLOC.o"
*/
_impure_ptr: @ 203B7A8
.space 0x4
__mb_cur_max: @ 203B7AC
.space 0x14
@ libc:stdlib/mallocr_MALLOC
__malloc_av_: @ 203B7C0
.space 0x408
__malloc_trim_threshold: @ 203BBC8
.space 0x4
__malloc_top_pad: @ 203BBCC
.space 0x4
__malloc_sbrk_base: @ 203BBD0
.space 0x4
__malloc_max_sbrked_mem: @ 203BBD4
.space 0x4
__malloc_max_total_mem: @ 203BBD8
.space 0x4
__malloc_current_mallinfo: @ 203BBDC
.space 0x28
gUnknown_203BC04: @ 203BC04 @ main