Skip to content
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

Failure to use atomics with arm-linux-musleabi target #14889

Open
link2xt opened this issue Mar 12, 2023 · 1 comment
Open

Failure to use atomics with arm-linux-musleabi target #14889

link2xt opened this issue Mar 12, 2023 · 1 comment
Labels
arch-arm 32-bit ARM bug Observed behavior contradicts documented or intended behavior os-linux
Milestone

Comments

@link2xt
Copy link

link2xt commented Mar 12, 2023

Zig Version

0.11.0-dev.1928+3169f0529

Steps to Reproduce and Observed Behavior

Create file atom.c:

#include <stdatomic.h>

int main() {
        _Atomic int val;
        atomic_fetch_add_explicit(&val, 1, memory_order_relaxed);
        return 0;
}

Run

$ zig cc atom.c -target arm-linux-musleabi

This results in an error

LLD Link... ld.lld: error: undefined symbol: __atomic_fetch_add_4

I also tried to use -target thumb-linux-musleabi, but it resulted in segmentation fault even without atomics and I filed another bugreport #14891.

Same with Zig 0.10.1.

The problem actually occurs when attempting to compile OpenSSL: openssl/openssl#20490

Expected Behavior

Atomic operations from https://github.com/ziglang/zig/blob/master/lib/compiler_rt/atomics.zig should be available on 32-bit ARM.

@link2xt
Copy link
Author

link2xt commented Mar 13, 2023

Note: building with zig cc atom.c -target arm-linux-musleabihf works, no idea why.
Using it here for now: deltachat/deltachat-core-rust#4155
But it is not obvious how and why "hf" (hard float) affects atomics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-arm 32-bit ARM bug Observed behavior contradicts documented or intended behavior os-linux
Projects
None yet
Development

No branches or pull requests

2 participants