tests: check wasm compiler_builtins object architecture#156230
tests: check wasm compiler_builtins object architecture#156230Vastargazing wants to merge 1 commit into
Conversation
|
|
This comment has been minimized.
This comment has been minimized.
211904e to
b25f8a1
Compare
| assert!( | ||
| obj_data.starts_with(b"\0asm"), | ||
| "object file `{name}` in compiler_builtins rlib is not a wasm binary \ | ||
| (first bytes: {:02x?}); C compiler-rt fallbacks were built with the wrong \ | ||
| toolchain — see rust-lang/rust#132802", | ||
| &obj_data[..4.min(obj_data.len())] | ||
| ); |
There was a problem hiding this comment.
Reading into an object::File then checking .architecture() would probably be better here
|
Reminder, once the PR becomes ready for a review, use |
b25f8a1 to
962838f
Compare
|
Thanks for the feedback! I've just force-pushed the fixes to the branch. Addresssed everything we discussed: added the module-level docs with links, and broadened the directive to only-wasm to cover other targets. I also flipped the filter to skip only .rmeta so unexpected files will actually trigger a failure now. For the wasm check, i dropped the raw magic bytes and went with object::File::parse + matching on Wasm32/Wasm64. Also cleaned up the misleading assert message about compiler-builtins-c and dropped the trailing eprintln!. Let me know what you think! |
This comment has been minimized.
This comment has been minimized.
962838f to
50ad258
Compare
|
@bors try jobs=test-various* |
This comment has been minimized.
This comment has been minimized.
…ect-arch, r=<try> tests: check wasm compiler_builtins object architecture try-job: test-various*
|
@bors try jobs=test-various* |
This comment has been minimized.
This comment has been minimized.
…ect-arch, r=<try> tests: check wasm compiler_builtins object architecture try-job: test-various*
|
💔 Test for 30c565b failed: CI. Failed job:
|
This comment has been minimized.
This comment has been minimized.
50ad258 to
266e90f
Compare
|
|
Pushed a fix - @rustbot ready |
|
@bors try jobs=test-various |
This comment has been minimized.
This comment has been minimized.
…ect-arch, r=<try> tests: check wasm compiler_builtins object architecture try-job: test-various
|
💔 Test for b9892dc failed: CI. Failed job:
|
This comment has been minimized.
This comment has been minimized.
|
Another small one @rustbot author |
266e90f to
d5d20bf
Compare
|
Reworked the skip logic - instead of listing extensions, now i just skip any member that doesn't parse as an object file (rmeta, bitcode .rcgu.o, etc). Real objects still get the arch check, so host objects would still fail. @rustbot ready |
|
I don't think that's a better solution since if there's a problem reading the entry (e.g. if But that is an interesting point - any idea why (If you can't run locally then to get a more useful output message in CI, you could keep the current version but push the name to a vec if it fails to parse. Then after the loop, print the whole vec and fail if any entries don't match |
Add a run-make test that checks the `.o` members in the prebuilt `libcompiler_builtins` archive for `wasm32-wasip1` are wasm objects. This guards against building wasm compiler-rt fallbacks with the host C toolchain.
d5d20bf to
91d8c56
Compare
|
Found the issue
Went back to the original (If you'd rather keep the @rustbot ready |
Yes please - we'll probably want it at some other point anyway :) Sorry this has had so much back and forth |
View all comments
See #132802
This adds a run-make test for the wasm sysroot regression fixed in #137457
The test checks that the
.omembers in the prebuiltlibcompiler_builtinsrlib forwasm32-wasip1are wasm objects rather thanhost ELF objects. Before that fix, bootstrap could use the host C compiler for
compiler-rt fallbacks on wasm targets and end up embedding host objects into
the wasm sysroot.
I used
wasm32-wasip1because that's the wasm target covered by the existingtests/run-makeCI setup, and the test asserts that it actually saw.omembers in the archive.
Closes: #132802
r? @tgross35