Skip to content

wangyangmoc/norlit-libc

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Summary

norlit-libc is a C library for x86 and x64.

norlit-libc is designed to conform to ISO C standard as well as those defined POSIX standard in the standard headers. norlit-libc do not intend to support other POSIX-specific headers, but may create stubs for them since they are not available in freestanding environment.

Header Status
<assert.h> Implemented1
<complex.h> Not supported2
<ctype.h> Implemented
<errno.h> Implemented
<fenv.h> Under consideration
<float.h> Freestanding
<inttypes.h> Implemented
<iso646.h> Freestanding
<limits.h> Freestanding
<locale.h> Implemented
<math.h> 27/69 (ISO C), 0/6 (POSIX)3
<setjmp.h> Implemented (ISO C) 2/4 (POSIX)4
<signal.h> Stub
<stdalign.h> Freestanding
<stdarg.h> Freestanding
<stdatomic.h> Freestanding5
<stdbool.h> Freestanding
<stddef.h> Freestanding
<stdint.h> Freestanding
<stdio.h> 24/46 (ISO C), 3/22 (POSIX)
<stdlib.h> Implemented (ISO C)6 4/27 (POSIX)7
<stdnoreturn.h> Freestanding
<string.h> Implemented
<tgmath.h> Freestanding8
<threads.h> Not supported9
<time.h> Under consideration
<uchar.h> Not supported10
<wchar.h> Not supported11
<wctype.h> Not supported12

TODO List

  • Macros in errno.h and signal.h should be system dependent, extract them to include/sys in some way
  • stdio.h

wchar and uchar

norlit-libc currently has no need for uchar and legacy wchar support. Related functions are defined but not implemented. Here is the list.

  • <uchar.h>, <wchar.h> and <wctype.h>
  • mblen, mbtowc, wctomb
  • mbstowcs, wcstombs
  • From <inttypes.h>: wcstoimax, wcstoumax

Thread-safety and reentrancy

norlit-libc currently has no need for multi-threading, so thread-safe is not concerned. If future support for thread-safety is needed, convert all static variables to thread-local storage or add locks to them. Reentrancy support is also not considered currently.

Locale

norlit-libc currently has no need for locale, so only C/POSIX locale is supported. When implementing norlit-libc, functions use current locale will be redirected to *_l functions by first retrieving locale by uselocale((locale_t)0). *_l will do the job instead. To support multiple locale, simply reimplement all files under src/locale


  1. No debug message is available yet

  2. Conditional features are not in priority

  3. Floating point numbers-related functions may have larger margin of error than expected

  4. Current there is only x86 support

  5. In GCC it is available in freestanding environment, though C11 does not require it

  6. system is a stub and will abort on call

  7. long double <-> string conversion is approximated with double <-> string conversion

  8. In GCC it is available in freestanding environment, though C11 does not require it

  9. Conditional features are not in priority

  10. Intended, but violate the standard

  11. Intended, but violate the standard

  12. Intended, but violate the standard

About

C11 conforming libc from scratch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 99.3%
  • Makefile 0.7%