Skip to content

Missing max_atomic_width in avr spec. #76363

Closed
@m-ou-se

Description

@m-ou-se

(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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.O-AVRTarget: AVR processors (ATtiny, ATmega, etc.)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions