Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing max_atomic_width in avr spec. #76363

Closed
m-ou-se opened this issue Sep 5, 2020 · 1 comment · Fixed by #76364
Closed

Missing max_atomic_width in avr spec. #76363

m-ou-se opened this issue Sep 5, 2020 · 1 comment · Fixed by #76364
Labels
C-bug Category: This is a bug. O-AVR Target: AVR processors (ATtiny, ATmega, etc.)

Comments

@m-ou-se
Copy link
Member

m-ou-se commented Sep 5, 2020

(Moving this here from avr-rust#172)

The avr target now specifies no max_atomic_width in the target spec file, which means it falls back to the pointer size of 16 bits:

    let target = rustc_target::spec::TargetTriple::from_triple("avr-unknown-gnu-atmega328");
    println!("{}", rustc_target::spec::Target::search(&target).unwrap().max_atomic_width());
    // output: 16

This seems incorrect. As far as I know, AVR does not have any atomic operations (especially not 16 bit).

Compiling something for AVR that uses atomics results in linker errors: undefined reference to __sync_val_compare_and_swap_1 undefined reference to __sync_val_compare_and_swap_2, etc.

@jonas-schievink jonas-schievink added C-bug Category: This is a bug. O-AVR Target: AVR processors (ATtiny, ATmega, etc.) labels Sep 5, 2020
@Rahix
Copy link

Rahix commented Sep 6, 2020

I think it would be great to provide implementations for those intrinsics (in compiler-builtins?), gcc seems to have at least some of them as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. O-AVR Target: AVR processors (ATtiny, ATmega, etc.)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants