- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Size saving opportunity in glibc include directories #21258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Sounds a bit like https://github.com/ziglang/universal-headers? |
Not exactly. The idea there is to have a single set of headers to cover everything. Here I'm just talking about merging headers for targets when they're literally identical already. |
Looks like we can delete somewhere in the ballpark of ~550 headers by doing this, which takes |
Note to self, these groups of directories can be merged:
|
Correction: 616 headers can be removed, for a size reduction from 2.9M to 1.2M. |
Semi-related: |
…able. Manual patches: * lib/libc/include/csky-linux-gnu/gnu/{lib-names,stubs}.h * lib/libc/include/powerpc-linux-gnu/bits/long-double.h Takes lib/libc/include from 115.5 MB to 113.4 MB. Closes ziglang#21258.
Right now, we have a directory for each glibc-based target triple under
lib/libc/include
. But if you do a recursive diff between many (all?) of the related ones (riscv32-linux-gnu
vsriscv64-linux-gnu
,arm-linux-gnueabi
vsarm-linux-gnueabihf
, and so on), it becomes apparent that the only difference is the presence of the appropriatelib-names-<abi>.h
andstubs-<abi>.h
headers. The appropriate version of this header is picked by thelib-names.h
andstubs.h
files based on preprocessor defines.Also, we already have a bunch of logic for picking the right paths based on target info:
zig/src/glibc.zig
Lines 416 to 663 in e084c46
Given these facts, I think we could enhance
process_headers.zig
to exploit this knowledge and merge these include directories together (while asserting for safety that there are no actual diffs between them). Then we'd just updatesrc/glibc.zig
to have very slightly smarter include directory selection.The text was updated successfully, but these errors were encountered: