That seems like a heavier hammer than just keeping everything the same but
overriding the symbols / wrapping them for your project? Why not just keep
the symbol names as they are, but wrap them separately, using compiler
flags/#define's?  I haven't wrapped stuff in a while so maybe I'm missing
something but `--wrap` worked well for me historically.

On Mon, Aug 14, 2023 at 5:35 AM Steve Fan <stevefan1...@gmail.com> wrote:

> I want to implement a compressed, read-only header manifest embedded
> directly into the compiler itself. This way I can have one single static
> binary to run everywhere without headers.
>
> I want to see if we can wrap the C file manipulation API with a custom TCC
> flavor, i.e. open to be tcc_open_impl, read to be tcc_read_impl, lseek to
> be tcc_lseek_impl, and basically replace
> (fopen|fread|fwrite|fclose|fseek|fdopen|fprint|ftell|) to tcc_<$1>_impl.
> And then let the user how it is implemented using a new config def like
> CONFIG_TCC_FS_USER (and by default substitute to the equivalent C library
> call)
>
> I need this because mere header substitution still has edge cases. I
> speculate that Clang will replace those symbols with an inline direct
> system call so my C preprocessor definition hack didn't work on optimized
> code. On debug-mode, this works surprisingly well.
>
> Having said that, I emulated the C file manipulation functions using Rust
> with a lightweight VFS layer, embedding the headers with compressed source
> text and deflated them in runtime on demand (via some macro magic in Rust),
> and it is working amazing well on Windows for both debug and release mode,
> although I just came across the weird problem in the previous paragraph on
> Linux for release mode.
>
> Stefan
> _______________________________________________
> Tinycc-devel mailing list
> Tinycc-devel@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
>
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to