Skip to content

nbdd0121/norlit-libc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 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> Implemented
<complex.h> Not supported1
<ctype.h> Implemented
<errno.h> Implemented
<fenv.h> Under consideration
<float.h> Implemented2
<inttypes.h> Implemented
<iso646.h> Implemented
<limits.h> Implemented (ISO C)
<locale.h> Implemented
<math.h> 28/69 (ISO C), 0/6 (POSIX)3
<setjmp.h> Implemented (ISO C) 2/4 (POSIX)4
<signal.h> Stub
<stdalign.h> Implemented
<stdarg.h> Implemented
<stdatomic.h> Freestanding5
<stdbool.h> Implemented
<stddef.h> Implemented
<stdint.h> Implemented
<stdio.h> Implemented (ISO C)6 4/22 (POSIX)
<stdlib.h> Implemented (ISO C)7 4/27 (POSIX)8
<stdnoreturn.h> Implemented
<string.h> Implemented
<tgmath.h> Freestanding9
<threads.h> Not supported10
<time.h> Stub
<uchar.h> Not supported11
<wchar.h> Stub12
<wctype.h> Not supported13

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. Conditional features are not in priority

  2. FLT_ROUND and FLT_EVAL_METHOD are not implemented and will abort when used

  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. remove, rename, tmpfile and tmpnam not supported. POSIX extension to printf and scanf is not yet supported.

  7. system is a stub and will abort on call

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

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

  10. Conditional features are not in priority

  11. Intended, but violate the standard

  12. Intended, but violate the standard

  13. Intended, but violate the standard

About

C11 conforming libc from scratch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages