Skip to content

ESP32 does not support 64-bit atomics #134

Description

@jamieparkinson

Hi,

The recent addition of BigInt64 support is great, but unfortunately this combined with Atomics throws some linker errors which I believe are due to the lack of support for 64-bit atomics on the xtensa/esp32 architecture.

Steps to reproduce

  • Perform an Atomic operation on BigInt64Array element:
const arr = new BigInt64Array(1);
arr[0] = 1;
Atomics.add(a, 0, 1);
  • Try to compile/run it:
mcconfig -d -m -p esp32
  • Observe errors at the linking stage:
...
xs_esp32.a(xsAtomics.c.o): In function `fx_Atomics_or':
xs/sources/xsAtomics.c:180: undefined reference to `__atomic_fetch_add_8'
...

The _8 (8 for 8 bytes in a 64-bit type) suffix is generated by GCC at compile time to be resolved later on by a user-provided implementation: I wonder if providing this in one of the platform files is the right way to go? Even if the implementation isn't truly atomic.

I do think I've understood this issue correctly but would be thrilled to hear that in fact I'm missing something - thank you!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions