From 5db066eb5184cc45e7634838b5b0b8c67cb2ae25 Mon Sep 17 00:00:00 2001 From: Danny Holman Date: Wed, 5 Jun 2024 13:47:01 -0500 Subject: libc: create a skeleton libc and build targets Create build targets for a skeleton libc that only includes enough functionality to get a cross compiler running. Signed-off-by: Danny Holman --- libc/arch/i386/crti.s | 14 +++++++++++++ libc/arch/i386/crtn.s | 7 +++++++ libc/arch/i386/include/bits/types.h | 41 +++++++++++++++++++++++++++++++++++++ libc/arch/i386/make.config | 6 ++++++ 4 files changed, 68 insertions(+) create mode 100644 libc/arch/i386/crti.s create mode 100644 libc/arch/i386/crtn.s create mode 100644 libc/arch/i386/include/bits/types.h create mode 100644 libc/arch/i386/make.config (limited to 'libc/arch/i386') diff --git a/libc/arch/i386/crti.s b/libc/arch/i386/crti.s new file mode 100644 index 0000000..906414b --- /dev/null +++ b/libc/arch/i386/crti.s @@ -0,0 +1,14 @@ +.section .init + +.global _init +.type _init, @function +_init: + pushl %ebp + movl %esp, %ebp + +.section .fini + +.global _fini +_fini: + pushl %ebp + movl %esp, %ebp diff --git a/libc/arch/i386/crtn.s b/libc/arch/i386/crtn.s new file mode 100644 index 0000000..447afb1 --- /dev/null +++ b/libc/arch/i386/crtn.s @@ -0,0 +1,7 @@ +.section .init + popl %ebp + ret + +.section .fini + popl %ebp + ret diff --git a/libc/arch/i386/include/bits/types.h b/libc/arch/i386/include/bits/types.h new file mode 100644 index 0000000..99946ff --- /dev/null +++ b/libc/arch/i386/include/bits/types.h @@ -0,0 +1,41 @@ +#ifndef BITS_TYPES_H + +typedef unsigned char __u_char; +typedef unsigned short __u_short; +typedef unsigned int __u_int; +typedef unsigned long __u_long; + +typedef signed char __int8_t; +typedef signed short int __int16_t; +typedef signed int __int32_t; +typedef signed long __int64_t; + +typedef unsigned char __uint8_t; +typedef unsigned short int __uint16_t; +typedef unsigned int __uint32_t; +typedef unsigned long __uint64_t; + +typedef __int8_t __int_least8_t; +typedef __int16_t __int_least16_t; +typedef __int32_t __int_least32_t; +typedef __int64_t __int_least64_t; + +typedef __uint8_t __uint_least8_t; +typedef __uint16_t __uint_least16_t; +typedef __uint32_t __uint_least32_t; +typedef __uint64_t __uint_least64_t; + +typedef __int8_t int8_t; +typedef __int16_t int16_t; +typedef __int32_t int32_t; +typedef __int64_t int64_t; + +typedef __uint8_t uint8_t; +typedef __uint16_t uint16_t; +typedef __uint32_t uint32_t; +typedef __uint64_t uint64_t; + +typedef __int32_t intptr_t; +typedef __uint32_t uintptr_t; + +#endif diff --git a/libc/arch/i386/make.config b/libc/arch/i386/make.config new file mode 100644 index 0000000..25c1254 --- /dev/null +++ b/libc/arch/i386/make.config @@ -0,0 +1,6 @@ +LIBC_ARCH_INCLUDE=$(ARCHDIR)/include +LIBC_ARCH_CFLAGS=-I$(LIBC_ARCH_INCLUDE) +LIBC_ARCH_LDFLAGS= +LIBC_ARCH_LIBS= + +LIBC_ARCH_OBJS= -- cgit v1.2.3