Skip to content

LLVM 18 no longer emits atomic load/store machine code for targets without s32c1i (LLVM-408) #105

Closed
@MabezDev

Description

@MabezDev

Checklist

  • Checked the issue tracker for similar issues to ensure this is not a duplicate
  • Read the documentation to confirm the issue is not addressed there and your configuration is set correctly
  • Tested with the latest version to ensure the issue hasn't been fixed

How often does this bug occurs?

often

Expected behavior

Atomic load/stores to function on the esp32s2

Actual behavior (suspected bug)

We sometimes get linker errors on the s2: https://github.com/esp-rs/esp-hal/actions/runs/11518396724/job/32065069522, in the Rust target we set max atomic width to 32, but in here it gets set to 0:

if (Subtarget.hasS32C1I()) {
setMaxAtomicSizeInBitsSupported(32);
setMinCmpXchgSizeInBits(32);
} else {
setMaxAtomicSizeInBitsSupported(0);
}
.

This heavily relates to LLVM-175 and we should now take the time to implement it and follow what the RISCV backend does:

if (Subtarget.hasStdExtA()) {
setMaxAtomicSizeInBitsSupported(Subtarget.getXLen());
setMinCmpXchgSizeInBits(32);
} else if (Subtarget.hasForcedAtomics()) {
setMaxAtomicSizeInBitsSupported(Subtarget.getXLen());
} else {
setMaxAtomicSizeInBitsSupported(0);
}

Error logs or terminal output

No response

Steps to reproduce the behavior

  1. Clone esp-hal
  2. run cargo xtask run-example examples esp32s2 embassy_usb_serial in the root
  3. Look at linker errors

Project release version

latest 18 release branch

System architecture

Intel/AMD 64-bit (modern PC, older Mac)

Operating system

Linux

Operating system version

Gentoo

Shell

ZSH

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions