-
Notifications
You must be signed in to change notification settings - Fork 62
Mac compatibility #128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Mac compatibility #128
Conversation
…cos wasmtime ci test to match ubuntu
Ok my attempt to pack the wasmtime-cli into the dev deps failed on CI but worked locally. If you're onboard with this approach I can probably duplicate the wasm test on linux latest to run on mac just changing things in the test.yaml |
Hm, not sure I love this. I would rather modify wasm32.s. But that is not going to keep the file size constant in perpetuity, unfortunately. First things first: have you tried regenerating the wasm32.o with llvm-mc from the most recent LLVM release? Maybe that would fix the macos issues transparently? At least doing it today with LLVM 19.1.7 already produces a 426-byte file (on linux.) If its alignment and not size issue, then could approach this by adding a custom section directly from the input file, but that unfortunately does not guarantee any particular "alignment" for the file... |
I tried llvm 19 and 20 installed via homebrew with I just pushed a change putting a fill into wasm32.s. Which definitely adds more maintenance burden, I could add a test to check the checked in object size but that still requires tuning the fill if things change. The only other things that come to mind are:
|
Closes #127
On mac with xcode apple clang is available but
llvm-ar
is not. Whatever version ofar
mac comes with adds newline bytes to pad out thewasm32.o
but that isn't parsed correctly downstream which leads to thellvm: section too large
error.The solution in this PR is to add a
.pad
section with 12 bytes of zeros to bring the.o
to 408 bytes. Then ifllvm-ar
is not detected when clang is we use this padded version. An alternative is to just always use this padded version but I didn't check this anywhere else besides Mac so uncertain if different padding schemes would be unhappy with 408 bytes.Extra Details
Padded version created via this command since copyobj seemed to not play nice with wasm. Empty.bin just 12 bytes of zeros to make the math work.
wasm-custom-section psm/src/arch/wasm32_pad.o add .pad < empty.bin
I assume you'll want to verify I didn't do anything weird on the object yourself but here were my local comparisons