esp-rs / xtensa-atomic-emulation-trap

An atomic emulation trap handler for non atomic Xtensa targets
Other
4 stars 1 forks source link

Add atomic enabled targets in the Rust compiler? #1

Closed MabezDev closed 1 year ago

MabezDev commented 2 years ago

Using json target definitions is kinda awkward.

What would be the naming convention of such a target?

MabezDev commented 2 years ago

Perhaps instead we should default to using atomic cas in the s2 (perhaps a reference to the trap handler).

Then we can either:

MabezDev commented 2 years ago

Instead I found a better way with the following rustflags.

rustflags = [
# enable the atomic codegen option for Xtensa
"-C", "target-feature=+s32c1i",

# tell the core library have atomics even though it's not specified in the target definition
"--cfg", 'target_has_atomic="8"',
"--cfg", 'target_has_atomic="16"',
"--cfg", 'target_has_atomic="32"',
"--cfg", 'target_has_atomic="ptr"',
]

We should probably do the same for the RISCV atomic emulation trap handler, just to avoid confusion about what the current c3 target is.