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

Cleanup target files #32

Closed
4 tasks done
Rahix opened this issue Aug 3, 2020 · 6 comments · Fixed by #85
Closed
4 tasks done

Cleanup target files #32

Rahix opened this issue Aug 3, 2020 · 6 comments · Fixed by #85
Assignees

Comments

@Rahix
Copy link
Owner

Rahix commented Aug 3, 2020

Notes to myself about what needs to happen:

@Rahix Rahix self-assigned this Aug 3, 2020
@Rahix Rahix added this to the crates.io Release milestone Sep 21, 2020
@explicite
Copy link
Contributor

@Rahix can you please mark second checkbox?

@explicite
Copy link
Contributor

explicite commented Oct 4, 2020

Looks line in third one we have some additional setting which I cannot add find in our targets.
https://github.com/rust-lang/rust/pull/74941/files#diff-e26bdcc4844624b6b557a83e64e20c0a
I cannot see e.g eh_frame_header or max-atomic-width. Should we support all old and new options or remove legacy from our targets? Please find bellow example for all merged.

{
  "arch": "avr",
  "data-layout": "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8",
  "llvm-target": "avr-unknown-unknown",
  "target-endian": "little",
  "target-pointer-width": "16",
  "linker-flavor": "gcc",
  "os": "unknown",
  "target-env": "",
  "target-vendor": "unknown",
  "target-c-int-width": "16",
  "cpu": "atmega2560",
  "exe-suffix": ".elf",
  "linker": "avr-gcc",
  "dynamic_linking": false,
  "executables": true,
  "linker_is_gnu": true,
  "has_rpath": false,
  "position_independent_executables": false,
  "eh_frame_header": false,
  "max-atomic-width": 8,
  "pre-link-args": {
    "gcc": [
      "-mmcu=atmega2560"
    ]
  },
  
  "post-link-args": {
    "gcc": [
      "-Wl,--gc-sections"
    ]
  },
  "singlethread": false,
  "no-builtins": false,
  "no-default-libraries": false,
  "eh-frame-header": false
}

@Rahix
Copy link
Owner Author

Rahix commented Oct 4, 2020

This command shows the current upstream default target:

rustc --print target-spec-json -Z unstable-options --target avr-unknown-gnu-atmega328

@Rahix
Copy link
Owner Author

Rahix commented Oct 4, 2020

@explicite, I suggest not spending too much time on this now because as I wrote in the last bullet point, ideally I want to move towards autogeneration of these target files.

@explicite
Copy link
Contributor

@Rahix, maybe I can use https://github.com/serde-rs/json and create some trait with default impl for generic. Then I will override per chip? Then magic can be done in build.rs?

@Rahix
Copy link
Owner Author

Rahix commented Oct 6, 2020

@explicite, no the target file must exist before invoking cargo so this can't happen in build.rs. I do want to keep the target files checked into the repo for that reason. My idea was this:

  • A toplevel directory named avr-specs/ (bikeshedding welcome) containing all the target specs we have.
  • There's a small python script named avr-specs/sync-from-upstream.py which runs rustc to retrieve the current upstream spec, patches the few things necessary, and overwrites the files.
  • I'll then run this script from time to time to keep our specs up-to-date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants