Skip to content

target-lexicon OS sometimes doesn't match rustc target jsons #78

@sunshowers

Description

@sunshowers

I've been playing around with target-lexicon a bit and it seems like while most of the time it is pretty faithful to the rustc target json, some of the time the result diverges.

For example, i686-linux-android has this rustc target JSON:

$ RUSTC_BOOTSTRAP=1 rustc -Z unstable-options --target=i686-linux-android --print target-spec-json
{
  "arch": "x86",
  "cpu": "pentiumpro",
  "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128",
  "default-uwtable": true,
  "dwarf-version": 2,
  "dynamic-linking": true,
  "env": "gnu",
  "executables": true,
  "features": "+mmx,+sse,+sse2,+sse3,+ssse3",
  "has-rpath": true,
  "is-builtin": true,
  "llvm-target": "i686-linux-android",
  "max-atomic-width": 64,
  "os": "android",
  "position-independent-executables": true,
  "pre-link-args": {
    "gcc": [
      "-Wl,--allow-multiple-definition"
    ]
  },
  "relro-level": "full",
  "stack-probes": {
    "kind": "call"
  },
  "target-family": [
    "unix"
  ],
  "target-pointer-width": "32"
}

However, target-lexicon parses the same triple as having the OS Linux rather than Android.

Somewhat related, for "aarch64-apple-darwin":

  • rustc has "os": "macos"
  • target-lexicon parses this as Darwin

I'm not sure exactly what behavior is desired here but I thought it might be useful to flag this. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions