target-lexicon icon indicating copy to clipboard operation
target-lexicon copied to clipboard

How should avr-unknown-gnu-atmega328 be parsed?

Open sunfishcode opened this issue 5 years ago • 3 comments

avr-unknown-gnu-atmega328 is a new target in rustc. "atmega328" isn't recognized by LLVM's Triple or GNU autotools so it's unclear how to categorize it. I posted here asking for clarification.

sunfishcode avatar Oct 19 '20 15:10 sunfishcode

The initial description said "This target system is gnu, as it uses the AVR-GCC frontend along with avr-binutils. The target triple ABI is 'atmega328'."

Calling gnu a "system" and putting it in the operating-system position might suggest that gnu is the operating system, however in the language of triples, gnu is already the name of an environment, and the triple format doesn't work well with names that have different meanings in different positions—some triple parsers don't support it at all. Consequently, I think it makes sense to say that gnu is the environment here, with the operating system being unknown.

That leaves the atmega328 field. The guidance is that atmega328 is not a binary format. But we don't currently have anything else in the syntax that can go after an environment.

So my current thinking is that we need to interpret atmega328 as a new syntactic concept in triples, maybe called "environment modifiers", making the full format for "triple" look like this: arch-vendor-os-env-envmodifier-binfmt. In terms of the target-lexicon API, gnu-atmega328 would be represented as a new Environment field, GnuAtmega328.

sunfishcode avatar Feb 16 '21 15:02 sunfishcode