Repository navigation
wasi-libc: Deduplicate sources and headers with regards to upstream musl - #22905
Conversation
|
I should note that the way we have things set up right now with regards to List of headers from generic-musl infecting wasm32-wasi-musl |
andrewrk
left a comment
There was a problem hiding this comment.
I love it!
I don't consider the "infecting" thing to be a problem worth solving, because it's not going to break anything that otherwise compiles correctly directly against the libc in question, and I think the failure mode of accidentally importing something extra is not a realistic thing to worry about.
…usl. Unfortunately some duplicate files must remain in lib/libc/wasi/libc-top-half because they include internal headers *in the same directory* which have edits relative to upstream musl. Because C is an amazing language, there is no way to make it so that e.g. upstream musl's src/stdio/fputc.c includes wasi-libc's src/stdio/putc.h instead of the upstream putc.h. The preprocessor always searches the current directory first for quote includes. Anyway, this still takes us from 2.9M to 1.4M for the combination of lib/libc/wasi and lib/libc/include/wasm-wasi-musl, so I still call it a win.
Unfortunately some duplicate files must remain in
lib/libc/wasi/libc-top-halfbecause they include internal headers in the same directory which have edits relative to upstream musl. Because C is an amazing language, there is no way to make it so that e.g. upstream musl'ssrc/stdio/fputc.cincludes wasi-libc'ssrc/stdio/putc.hinstead of the upstreamputc.h. The preprocessor always searches the current directory first for quote includes.Anyway, this still takes us from 2.9M to 1.4M for the combination of
lib/libc/wasiandlib/libc/include/wasm-wasi-musl, so I still call it a win.Updated instructions will follow soon on the wiki page.