tinyrlibc icon indicating copy to clipboard operation
tinyrlibc copied to clipboard

Scope of future function implementations

Open gmmyung opened this issue 1 year ago • 3 comments

Hi, I am working on binding against a C library compiled with Newlib headers. This requires implementations of some functions that:

  • requires extern crate alloc such as malloc and free
  • are not part of libc, but part of the Newlib header such as __errno(), __assert_func()
  • are just stubs for non-existent functions such as fopen, printf
  • part of math.h (implementation of those are easy, just re-export the libm functions)

What is the scope of future function implementation in tinyrlibc?

gmmyung avatar Jan 22 '24 13:01 gmmyung

It's not impossible, but you may find it easier to just link newlib.

thejpster avatar Jan 22 '24 14:01 thejpster

Linking with Newlib does work, but offering a Rust version would significantly simplify the process for users. Currently, there's no official release of the GNU RISC-V toolchain, requiring users to either build the entire toolchain (which demands 8 GiB of disk space) or use various third-party prebuilt sources with different configurations. Following that, building Newlib from source with the compiler is necessary. Using Clang and tinyrlibc seems like a more straightforward option for crate user experience.

gmmyung avatar Jan 23 '24 07:01 gmmyung

As long as it still does its original job (linking with the nrf9160 libraries) and it doesn't hit the new cargo feature limit, this seems fine to me.

thejpster avatar Jan 24 '24 20:01 thejpster