diff options
| author | Nathan Froyd <froydnj@gmail.com> | 2019-04-25 16:04:37 -0400 |
|---|---|---|
| committer | Nathan Froyd <froydnj@gmail.com> | 2019-05-07 11:09:39 -0400 |
| commit | 97ba4c95d00108ac79c86d2bbc6834b1fef008a2 (patch) | |
| tree | e97c529909fc61ee6f92455f465ece967cd30206 /src/test/codegen | |
| parent | 1516087ca91f0aa8c9f4f8cb0aa6ff48862043c4 (diff) | |
| download | rust-97ba4c95d00108ac79c86d2bbc6834b1fef008a2.tar.gz rust-97ba4c95d00108ac79c86d2bbc6834b1fef008a2.zip | |
choose a more specific LLVM target on OS X when necessary
This behavior matches clang's behavior, and makes cross-language LTO possible. Fixes #60235.
Diffstat (limited to 'src/test/codegen')
| -rw-r--r-- | src/test/codegen/i686-macosx-deployment-target.rs | 26 | ||||
| -rw-r--r-- | src/test/codegen/x86_64-macosx-deployment-target.rs | 26 |
2 files changed, 52 insertions, 0 deletions
diff --git a/src/test/codegen/i686-macosx-deployment-target.rs b/src/test/codegen/i686-macosx-deployment-target.rs new file mode 100644 index 00000000000..dad376d6677 --- /dev/null +++ b/src/test/codegen/i686-macosx-deployment-target.rs @@ -0,0 +1,26 @@ +// +// Checks that we correctly modify the target when MACOSX_DEPLOYMENT_TARGET is set. +// See issue #60235. + +// compile-flags: -O --target=i686-apple-darwin --crate-type=rlib +// rustc-env:MACOSX_DEPLOYMENT_TARGET=10.9 +#![feature(no_core, lang_items)] +#![no_core] + +#[lang="sized"] +trait Sized { } +#[lang="freeze"] +trait Freeze { } +#[lang="copy"] +trait Copy { } + +#[repr(C)] +pub struct Bool { + b: bool, +} + +// CHECK: target triple = "i686-apple-macosx10.9.0" +#[no_mangle] +pub extern "C" fn structbool() -> Bool { + Bool { b: true } +} diff --git a/src/test/codegen/x86_64-macosx-deployment-target.rs b/src/test/codegen/x86_64-macosx-deployment-target.rs new file mode 100644 index 00000000000..8e291b7b298 --- /dev/null +++ b/src/test/codegen/x86_64-macosx-deployment-target.rs @@ -0,0 +1,26 @@ +// +// Checks that we correctly modify the target when MACOSX_DEPLOYMENT_TARGET is set. +// See issue #60235. + +// compile-flags: -O --target=x86_64-apple-darwin --crate-type=rlib +// rustc-env:MACOSX_DEPLOYMENT_TARGET=10.9 +#![feature(no_core, lang_items)] +#![no_core] + +#[lang="sized"] +trait Sized { } +#[lang="freeze"] +trait Freeze { } +#[lang="copy"] +trait Copy { } + +#[repr(C)] +pub struct Bool { + b: bool, +} + +// CHECK: target triple = "x86_64-apple-macosx10.9.0" +#[no_mangle] +pub extern "C" fn structbool() -> Bool { + Bool { b: true } +} |
