Reimplement crt0 code in Zig for vendored libcs #23875
Labels
enhancement
Solving this issue will likely involve adding new logic or components to the codebase.
libc
Issues related to libzigc and Zig's vendored libc code.
os-freebsd
os-linux
os-netbsd
os-wasi
os-windows
Milestone
SLoC for crt0 code in some of the libcs we vendor:
(glibc is a bit harder to quantify because its organization is incredibly horrible, which results in us having a bunch of probably unnecessary code in
lib/libc/glibc
. I would be surprised if it's actually more than 2-3k lines of necessary crt0 code after pruning.)This is really not a lot of code, so rewriting it in Zig would make a lot of sense, and would make progress towards #16270.
A secondary benefit would be finding any areas of the language that make writing this sort of code harder than it should be. In that regard, I can list these upfront:
__attribute__((common))
) semantics. @jacobly0 suggested modeling this with@extern
and a newstd.builtin.GlobalLinkage.common
tag. A separate proposal needs to be typed up for this.dlclose
a dynamic loaded library which has atexit function calls #17908. While it's technically possible to emit these in Zig today, Proposal: Ability to append functions to.init_array
/.fini_array
#23574 would make doing so nicer and less error-prone.The text was updated successfully, but these errors were encountered: