Skip to content

Implement flexible target specification - #16156

Merged
bors merged 7 commits into
rust-lang:masterfrom
emberian:target-spec
Nov 4, 2014
Merged

Implement flexible target specification#16156
bors merged 7 commits into
rust-lang:masterfrom
emberian:target-spec

Conversation

@emberian

Copy link
Copy Markdown
Contributor

See commit message.

@emberian

Copy link
Copy Markdown
ContributorAuthor

Still trying to figure out a bug where executables aren't getting the executable bit set...

@emberian

Copy link
Copy Markdown
ContributorAuthor

Seems to have resolved itself with a rebase ¯_(ツ)_/¯

Comment threadsrc/librustc_back/target/mod.rs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who installs to /etc/rustc?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feature may want to remain unimplemented for now due to some open questions here, but it probably doesn't matter too much.

@huonw

huonw commented Aug 1, 2014

Copy link
Copy Markdown
Contributor

Can you write a run-make test that checks the compiler is correctly searching for, parsing and using external specifications? (E.g. it could run rustc --target=foo-bar-baz --emit=asm ... with a custom target that disables stack checks, and then grep for stack checks.)

@emberian

Copy link
Copy Markdown
ContributorAuthor

Another issue: probably needs to allow specifying target_os instead of taking it from the target triple. I'm not actually sure this is a good idea, though, and it seems MUCH more clear that the target_os comes from the triple name itself. But we'd need to rename "osx" to "darwin", which I feel is almost a lie? Not really sure. Need feedback.

@emberian

Copy link
Copy Markdown
ContributorAuthor

(The RFC specifies taking it from the target)

@emberian

Copy link
Copy Markdown
ContributorAuthor

@huonw how do those docs look?

@emberian

Copy link
Copy Markdown
ContributorAuthor

Hm, glaringly obvious problem: linker should probably include a target triple prefix, for cross compiling. ie, x86_64-unknown-linux-gnu-cc.

@errordeveloper

Copy link
Copy Markdown

@farcaller we should try this with arm-none-eabi

@emberian

Copy link
Copy Markdown
ContributorAuthor

Be warned that this isn't quite working yet. My current status is:

LLVM ERROR: not a number, or does not fit in an unsigned int

@emberian

Copy link
Copy Markdown
ContributorAuthor

(Already fixed I think, still building..)

Comment threadsrc/librustc_back/target/mod.rs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a story for interacting with cargo?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet, no.

@mneumann

Copy link
Copy Markdown
Contributor

When compiling this on DragonFly I run into these problems:

/home/mneumann/rust/src/liblibc/lib.rs:2943:47: 2943:53 error: unresolved import
`types::os::arch::c95::c_uint`. Could not find `arch` in `types::os`.
/home/mneumann/rust/src/liblibc/lib.rs:2943 use types::os::arch::c95
::{c_int, c_uint};
^~~~~~
/home/mneumann/rust/src/liblibc/lib.rs:2965:17: 2965:44 error: unresolved import
`types::os::arch::c95::c_int`. Could not find `arch` in `types::os`.
/home/mneumann/rust/src/liblibc/lib.rs:2965 use types::os::arch::c95
::c_int;
^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mneumann/rust/src/liblibc/lib.rs:2966:17: 2966:49 error: unresolved import
`types::os::arch::posix88::mode_t`. Could not find `arch` in `types::os`.
/home/mneumann/rust/src/liblibc/lib.rs:2966 use types::os::arch::pos
ix88::mode_t;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mneumann/rust/src/liblibc/lib.rs:3209:17: 3209:44 error: unresolved import
`types::os::arch::c95::c_int`. Could not find `arch` in `types::os`.
/home/mneumann/rust/src/liblibc/lib.rs:3209 use types::os::arch::c95
::c_int;
^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mneumann/rust/src/liblibc/lib.rs:150:54: 150:58 error: unresolved import (
maybe you meant `stat::*`?)
/home/mneumann/rust/src/liblibc/lib.rs:150 pub use funcs::posix88::stat_::{chmod
, fstat, mkdir, stat};
^~~~
error: aborting due to 115 previous errors
gmake: *** [x86_64-unknown-dragonfly/stage1/lib/rustlib/x86_64-unknown-dragonfly
/lib/stamp.libc] Error 101

Maybe the target_os is incorrectly determined?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

false => true ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah nevermind, it would be nice to preserve the comments in the source code to this target specification about why this is false

@vadimcn

Copy link
Copy Markdown
Contributor

Rebased, fixed, squashed: https://github.com/vadimcn/rust/tree/flextarget. Passes tests on Windows.
@cmr: Do you want me to submit it?

@aturon

Copy link
Copy Markdown
Contributor

Revived, yay!

Comment threadconfigure Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- $gnu_t=$(to_gnu_triple $t)+ gnu_t=$(to_gnu_triple $t)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, @klutzy is absolutely right! I guess this doesn't break stuff unless LLVM needs to be rebuilt...

@vadimcn

Copy link
Copy Markdown
Contributor

Darn it! What's going on here???

@emberian

Copy link
Copy Markdown
ContributorAuthor

I can't replicate the android failure locally. @alexcrichton do you know what API level the emulators are using?

@alexcrichton

Copy link
Copy Markdown
Member

Looks like #17448, but I think that we're using api version 19 maybe?

Removes all target-specific knowledge from rustc. Some targets have changed
during this, but none of these should be very visible outside of
cross-compilation. The changes make our targets more consistent.
iX86-unknown-linux-gnu is now only available as i686-unknown-linux-gnu. We
used to accept any value of X greater than 1. i686 was released in 1995, and
should encompass the bare minimum of what Rust supports on x86 CPUs.
The only two windows targets are now i686-pc-windows-gnu and
x86_64-pc-windows-gnu.
The iOS target has been renamed from arm-apple-ios to arm-apple-darwin.
A complete list of the targets we accept now:
arm-apple-darwin
arm-linux-androideabi
arm-unknown-linux-gnueabi
arm-unknown-linux-gnueabihf
i686-apple-darwin
i686-pc-windows-gnu
i686-unknown-freebsd
i686-unknown-linux-gnu
mips-unknown-linux-gnu
mipsel-unknown-linux-gnu
x86_64-apple-darwin
x86_64-unknown-freebsd
x86_64-unknown-linux-gnu
x86_64-pc-windows-gnu
Closes#16093
[breaking-change]
bors added a commit that referenced this pull request Nov 4, 2014
@bors
bors merged commit 61aeab4 into rust-lang:masterNov 4, 2014
@vadimcn

Copy link
Copy Markdown
Contributor

@cmr Congrats! :-)

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

13 participants

@emberian@huonw@errordeveloper@mneumann@alexcrichton@bharrisau@vadimcn@brson@rschulman@klutzy@bgamari@aturon@bors