This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Allow use of <atomic> in baremetal systems when threading is disabled.
AbandonedPublic

Authored by ldionne on Nov 12 2018, 5:18 PM.

Details

Summary

This will allow embedded projects that provide their own threading library to use the <atomic> library.

Diff Detail

Event Timeline

itessier created this revision.Nov 12 2018, 5:18 PM

Should we just remove the no thread check in <atomic> instead?

itessier updated this revision to Diff 173794.Nov 12 2018, 5:24 PM
ldionne requested changes to this revision.Nov 13 2018, 8:28 AM

I strongly feel like this should be part of a Freestanding effort with an overarching design. I haven't seen any of this yet.

So: I want this, but I want to know (and agree on) how we're going to do the rest, too.

This revision now requires changes to proceed.Nov 13 2018, 8:28 AM
jfb requested changes to this revision.EditedNov 13 2018, 9:48 AM

I strongly feel like this should be part of a Freestanding effort with an overarching design. I haven't seen any of this yet.

So: I want this, but I want to know (and agree on) how we're going to do the rest, too.

I absolutely agree. The C++ committee has an ongoing effort to define "freestanding" better, and atomic is tentatively part of this. In particular, you really have to figure out what to do with atomics which aren't lock-free, you can't just turn it on without a rationale.

I don't think we want to move forward with this without being close to what the committee is doing, otherwise "baremetal" will just be some odd duckling.

This will allow embedded projects that provide their own threading library to use the <atomic> library.

These projects should provide atomics through the compiler's builtins. Is that what they do? Do you have details? Are there testbots to ensure we don't break that configuration?

I absolutely agree. The C++ committee has an ongoing effort to define "freestanding" better, and atomic is tentatively part of this. In particular, you really have to figure out what to do with atomics which aren't lock-free, you can't just turn it on without a rationale.

Ah, I didn't know there was a freestanding effort, thanks for that info.

These projects should provide atomics through the compiler's builtins. Is that what they do? Do you have details? Are there testbots to ensure we don't break that configuration?

This is for our C++ firmware that already uses std::atomic. We were using libstdc++ (where <atomic> can be used on its own), but have switched to libc++.

If we're not moving forward with this patch, can it be abandoned? I'd like to clean up the libc++ review queue.

ldionne commandeered this revision.Sep 7 2023, 8:08 AM
ldionne edited reviewers, added: itessier; removed: ldionne.

[Github PR transition cleanup]

Commandeering to close per the above.

Herald added a project: Restricted Project. · View Herald TranscriptSep 7 2023, 8:08 AM
ldionne abandoned this revision.Sep 7 2023, 8:08 AM