Open ytoml opened 2 years ago
For what it's worth, I'm using Inkwell on an ARM Macbook (M1 Max) + LLVM 14 without any issues, so I don't think it's fundamentally broken!
(Inkwell commit 40d7ba0d387819140ca85c9bbf14ccdbd199ceee, according to my Cargo.lock
)
Nice to hear that!
However actually, while using inkwell
as an dependency of some app it doesn' raise any issue for me, either.
I encountered this failures during test of inkwell
itself.
Is inkwell
's tests (feature llvm14-0
) passing on your machine?
Ah, I see what you mean! I'm seeing the same error that you do when running the test suite (on 40d7ba0d387819140ca85c9bbf14ccdbd199ceee)
cargo test --all --target=aarch64-apple-darwin --features=llvm14-0
LLVM ERROR: Global variable 'gv' has an invalid section specifier 'test': mach-o section specifier requires a segment and section separated by a comma.
test test_module::test_linking_modules ... error: test failed, to rerun pass '--test all'
Caused by:
process didn't exit successfully: `/Users/mkeeter/code/inkwell/target/aarch64-apple-darwin/debug/deps/all-44f4c164f6890d24` (signal: 6, SIGABRT: process abort signal)
I could fix this aborting error with modification to test_section_iterator()
and test_section_contains_nul()
in test/all/test_object_file.rs
like:
#[cfg(target_os = "macos")]
const SECTION_SPEC: &str = "segmentTest,test";
#[cfg(not(target_os = "macos"))]
const SECTION_SPEC: &str = "test";
/*
omit
*/
let gv = module.add_global(/*omit*/);
gv.set_initializer(/*omit*/);
gv.set_section(Some(SECTION_SPEC));
just adding segmet specifier to string passed to set_section
, as error message complains.
With fix above (and adding target triple for arm at test_default_triple()
in test/all/test_targts.rs ), I have 2 test failure on macOS(aarch64) with:
test_section_iterator()
, it's same as previous comment:
Also, I encountered test failure with:
thread 'test_object_file::test_section_iterator' panicked at 'assertion failed: `(left == right)` left: `4`, right: `1`', tests/all/test_object_file.rs:123:21
when I run test on Linux on lima VM instance(aarch64).
It complains that section D
for void returning funcition type has 4 bytes.
test_symbol_iterator()
because symbol names are modified like from a
to _a
and match arms miss it. For this, we can easily fixing matching arms but then another problem occurs with symbol size:
thread 'main' panicked at 'assertion failed: `(left == right)`
left: `0`,
right: `1`', tests/all/test_object_file.rs:183:21
It complains that symbol _a
(a
) has zero size. This behavior occurs only for this _a
of i8_type
(if assertion for _a
is commented out, this test passes).
This symbol size issue doesn't appear on Linux, thus it seems to bemach-o
specific behavior.
This bug is still present
I will try to fix it
Still a problem
The fix seems to be, at least for LLVM 15 zstd issue, to include the following in ~/.cargo/config.toml
:
[build]
rustflags = ["-L", "/opt/homebrew/lib/"]
The fix seems to be, at least for LLVM 15 zstd issue, to include the following in
~/.cargo/config.toml
:[build] rustflags = ["-L", "/opt/homebrew/lib/"]
Seems to work for llvm18-0
version as well.
When I was developing https://github.com/TheDan64/inkwell/pull/344, I first worked on my macOS with Apple M1 host machine, and have run the test with:
(only
llvm14-0
feature is tested since PR above doesn't affect any other features) but it fails with SIGABRT from:Also, I encountered test failure with:
when I run test on Linux on lima VM instance(aarch64). I don't know much about sections now and not have any idea about the exact reason why this failure occurs (and why it doesn' appear on x86_64 Linux)...
And, is there any plan to support ARM platforms?