TheDan64 / inkwell

It's a New Kind of Wrapper for Exposing LLVM (Safely)
https://thedan64.github.io/inkwell/
Apache License 2.0
2.38k stars 229 forks source link

MacOS x86_64 fail with Section not found error, seems setting custom section name is broken #396

Open ptitSeb opened 1 year ago

ptitSeb commented 1 year ago

Describe the Bug

We use inkwell on the wasmer project. After an update from the 0.1.0-beta4 to latest 0.1.0, the build on macOS x86_64 is failing. Wasmer create a custom section named __TEXT,wasmer_function and it seems this section is not found durring the link.

This is probably due to this commit https://github.com/TheDan64/inkwell/commit/3917e3207941c1a90f28df4fe08ffdd26de71575

It should be noted that only the x86_64 macOS platform is impacted. All other platform are fine, including ARM64 macOS.

To Reproduce No easy way to reproduce. The log can be found here: https://github.com/wasmerio/wasmer/actions/runs/4053796572/jobs/6993591076 but it's quite a big log.

TheDan64 commented 1 year ago

Any idea what'd be the correct fix? I don't have access to a macOS machine, so I have no way to test

ptitSeb commented 1 year ago

I would limit the new code of the commit to only macos aarch64 (instead of just macos), as the old code was working fine on macos x86_64.

TheDan64 commented 1 year ago

Ok, you're welcome to make that change and test it out if you'd like

ptitSeb commented 1 year ago

Mmmm, I retested and in fact, it break Wasmer both on x86_64 and aarch64. I think the issue is that, in the case of Wasmer, we have __TEXT,wasmer_function, so a section name that already contains a ,, and in that case it should not be added to the name. I'll work on a solution that test if the section name already have a , in it or not