Repository navigation
emitc selfbuild - #2819
Merged
Merged
emitc selfbuild#2819
Conversation
added 2 commits
October 29, 2026 14:26
…oint (#983 follow-up) emit-c-test had been red on main, hidden behind earlier stops (nothing in the battery runs it). Once the whole compiler emitted as C, the C compiler found about 250 errors in these classes, each a C-backend defect, and the C-built compiler then misread its own flags: - a plain enum's discriminant read as `.tag`: an enum with no payloads is its discriminant (enum_tag_text) - method owners matched by substring: `TokenList.len` and `TokenList.new` were taken for List's; owners now match exactly - a field named as a C keyword (`signed`): every member is spelled through cc_member, which escapes C keywords - with_runtime.h disagreed with the runtime (`with_arg_at` takes an isize; `with_vec_get_ptr_es` a byte pointer), and the emitter declared them again: the header follows rt_core and the emitter defers to it - a raw pointer to a fn value was laid out as the {fn_ptr, ctx} pair itself; a `&fn` view, the pair by value, is now read and taken consistently - `==` on an Option, a tuple or a struct was C's `==` on a struct: it is structural (#2137), through the walk map keys compare by; a distinct type compares as its underlying type - `&raw const` of a str rendered the `&str` view, not the address - a local MIR declares as an Option was re-typed from a downcast read through it (`Option[&i32]` became `Option[i32]`); MIR's type wins (D65) - an extern fn's `@[link_name("unlink")]` was ignored: the C called `ci_unlink` - `List.contains` compared elements by their bytes, so a str matched only itself: `["--emit-c"].contains(arg)` was false and the C-built compiler refused every flag; elements compare by their type's `==` :emit-c-test and :emit-c-fixpoint are green: the compiler built from C builds itself to identical C. Tests: test/emit_c/map_get_option_view, test/emit_c/list_contains_by_value; all 37 test/emit_c fixtures pass through C.
…piler, no MSVC paths (#2782) emit-c-test and emit-c-fixpoint compiled the emitted compiler with $LLVM_PREFIX's or the SDK's clang++, falling back to the host's `cc` (`clang++.exe` on Windows), and on Windows targeted *-pc-windows-msvc and linked Visual Studio and Windows Kits library directories. The build runs no host command (Eric, 2026-10-28; Law 8): the C compiler is now `<compiler under test> cc`, its embedded clang driver, sysroot and lld, as the emit-c smoke's is (bs_c_compiler_argv); WITH_EMIT_C_CC or CC is the user's explicit choice. Windows takes the windows-gnu target the real link uses (#1915) and rt.o's import libraries (ws2_32, dbghelp, crypt32). Verified on darwin-arm64: :emit-c-test and :emit-c-fixpoint green. Fixes #2782
Contributor
Author
|
Seed-driven battery GREEN on the stack top 1fbaa5d ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack created with GitHub Stacks CLI • Give Feedback 💬