-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #60378 - froydnj:apple-target-modifications, r=michaelw…
…oerister conditionally modify darwin targets to macosx targets with versions We need this behavior so that Rust LLVM IR objects match the target triple for Clang LLVM IR objects. This matching then convinces the linker that yes, you really can do cross-language LTO with objects from different compilers. The newly-added tests seem to pass locally on x86_64-unknown-linux-gnu. I haven't done a full test run or tried the new compiler in an cross-language LTO setup yet.
- Loading branch information
Showing
10 changed files
with
157 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// Checks that we leave the target alone MACOSX_DEPLOYMENT_TARGET is unset. | ||
// See issue #60235. | ||
|
||
// compile-flags: -O --target=i686-apple-darwin --crate-type=rlib | ||
// unset-rustc-env:MACOSX_DEPLOYMENT_TARGET | ||
#![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-darwin" | ||
#[no_mangle] | ||
pub extern "C" fn structbool() -> Bool { | ||
Bool { b: true } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// Checks that we leave the target alone when MACOSX_DEPLOYMENT_TARGET is unset. | ||
// See issue #60235. | ||
|
||
// compile-flags: -O --target=x86_64-apple-darwin --crate-type=rlib | ||
// unset-rustc-env:MACOSX_DEPLOYMENT_TARGET | ||
#![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-darwin" | ||
#[no_mangle] | ||
pub extern "C" fn structbool() -> Bool { | ||
Bool { b: true } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters