Closed ee7 closed 3 months ago
There's nothing wrong with that code; it's intentional that we use the emulation where it's not supported in hardware, and it still performs well there; the emulation is not actually particularly slow.
Feel free to detect x86 and add the flag in the meson build.
With:
or:
running
dev build
by default produces about 2200 lines of-Watomic-alignment
warnings, like:I added
-Wno-atomic-alignment
locally when using Clang, but we should either do that in the repo, or otherwise resolve these warnings.Some context:
https://github.com/crashappsec/libcon4m/blob/b4fdc8e2e70b0ef18a554562702e2db1e0c9aff0/include/hatrack/hatomic.h#L26-L35
https://github.com/crashappsec/libcon4m/blob/b4fdc8e2e70b0ef18a554562702e2db1e0c9aff0/include/hatrack/hatomic.h#L40-L50
https://github.com/crashappsec/libcon4m/blob/b4fdc8e2e70b0ef18a554562702e2db1e0c9aff0/src/quark/x86_64.s#L6-L19
Where my understanding of the rationale for the last file was, from my Slack messages in January:
cmpxchg16b
isn't technically available on every x86_64 CPU, but the oldest AMD CPU that supports it fully (Phenom X3, K10) is from around 2008.__atomic_compare_exchange_16
tocmpxchg16b
.-march=x86-64-v3
we should see thecmpxchg16b
.__atomic_compare_exchange_16
is supposed to be defined across all sizes, but musl doesn't define it for 128-bit ints.cmpxchg16b
.