Fix compilation for 32-bit targets #1050
Merged
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.
Hello, thank you for rusty_v8! Building for the 32-bit
armv7-unknown-linux-musleabihf
target gives the following compilation error due to some assumptions about the
layout of the C++
v8::ScriptCompiler::Source
class:This assert matches the corresponding Rust struct definition
pub struct Source([usize; 8]);
on 64-bit platforms where the size of the fields plus padding mean
sizeof(v8::ScriptCompiler::Source) == 64
.However on 32-bit ARM
sizeof(v8::ScriptCompiler::Source) == 36
butsize_of::<[usize; 8]>() == 32
.This PR updates the layout of the Rust
v8::script_compiler::Source
structto match that of the C++ class and updates the
static_assert
to check that the sizeof the C++ class matches the expected aligned sum of field sizes.
With this change I'm able to build & run a program that links to rusty_v8 on
armv7-unknown-linux-musleabihf, as well as aarch64-unknown-linux-musl, and
x86_64-unknown-linux-musl.