Rollup merge of #131171 - madsmtm:target-info-avr-env, r=petrochenkov

Fix `target_env` in `avr-unknown-gnu-atmega328`

The target name itself contains GNU, we should probably reflect that as `target_env = "gnu"` as well? Or from my reading of https://github.com/rust-lang/rust/pull/74941#issuecomment-712219034, perhaps not, but then that should probably be documented somewhere?

There's no listed target maintainer, but the target was introduced in https://github.com/rust-lang/rust/pull/74941, so I'll ping the author of that: `@dylanmckay`

Relatedly, I wonder _why_ the recommendation is to [create separate target triples for each AVR](https://github.com/Rahix/avr-hal/tree/main/avr-specs), when `-Ctarget-cpu=...` would suffice, perhaps you could also elaborate on that? Was it just because `-Ctarget-cpu=...` didn't exist back then? If so, now that it does, should we now change the target back to e.g. `avr-unknown-none-gnu`, and require the user to set `-Ctarget-cpu=...` instead?
This commit is contained in:
Jubilee 2024-10-04 14:11:35 -07:00 committed by GitHub
commit ff57e0b24e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -19,6 +19,8 @@ pub(crate) fn target(target_cpu: &'static str, mmcu: &'static str) -> Target {
llvm_target: "avr-unknown-unknown".into(), llvm_target: "avr-unknown-unknown".into(),
pointer_width: 16, pointer_width: 16,
options: TargetOptions { options: TargetOptions {
env: "gnu".into(),
c_int_width: "16".into(), c_int_width: "16".into(),
cpu: target_cpu.into(), cpu: target_cpu.into(),
exe_suffix: ".elf".into(), exe_suffix: ".elf".into(),