From 97ba4c95d00108ac79c86d2bbc6834b1fef008a2 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Thu, 25 Apr 2019 16:04:37 -0400 Subject: 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. --- src/test/codegen/i686-macosx-deployment-target.rs | 26 ++++++++++++++++++++++ .../codegen/x86_64-macosx-deployment-target.rs | 26 ++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 src/test/codegen/i686-macosx-deployment-target.rs create mode 100644 src/test/codegen/x86_64-macosx-deployment-target.rs (limited to 'src/test/codegen') 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 } +} -- cgit 1.4.1-3-g733a5