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

Add i686-unknown-openbsd target. #38086

Merged
merged 3 commits into from Dec 4, 2016
Jump to file or symbol
Failed to load files and symbols.
+9 −1
Diff settings

Always

Just for now

Viewing a subset of changes. View all
Prev

OpenBSD under x86 has particular ABI for returning a struct.

It is like OSX or Windows: small structs are returned as integers.
  • Loading branch information...
semarie committed Dec 3, 2016
commit 6774e7aa92f5866657f778f08261c0fe219f01a8
@@ -302,6 +302,9 @@ pub struct TargetOptions {
pub staticlib_suffix: String,
/// OS family to use for conditional compilation. Valid options: "unix", "windows".
pub target_family: Option<String>,
/// Whether the target toolchain is like OpenBSD's.
/// Only useful for compiling against OpenBSD, for configuring abi when returning a struct.
pub is_like_openbsd: bool,
/// Whether the target toolchain is like OSX's. Only useful for compiling against iOS/OS X, in
/// particular running dsymutil and some other stuff like `-dead_strip`. Defaults to false.
pub is_like_osx: bool,
@@ -406,6 +409,7 @@ impl Default for TargetOptions {
staticlib_prefix: "lib".to_string(),
staticlib_suffix: ".a".to_string(),
target_family: None,
is_like_openbsd: false,
is_like_osx: false,
is_like_solaris: false,
is_like_windows: false,
@@ -572,6 +576,7 @@ impl Target {
key!(staticlib_prefix);
key!(staticlib_suffix);
key!(target_family, optional);
key!(is_like_openbsd, bool);
key!(is_like_osx, bool);
key!(is_like_solaris, bool);
key!(is_like_windows, bool);
@@ -733,6 +738,7 @@ impl ToJson for Target {
target_option_val!(staticlib_prefix);
target_option_val!(staticlib_suffix);
target_option_val!(target_family);
target_option_val!(is_like_openbsd);
target_option_val!(is_like_osx);
target_option_val!(is_like_solaris);
target_option_val!(is_like_windows);
@@ -17,6 +17,7 @@ pub fn opts() -> TargetOptions {
executables: true,
linker_is_gnu: true,
has_rpath: true,
is_like_openbsd: true,
pre_link_args: vec![
// GNU-style linkers will use this to omit linking to libraries
// which don't actually fulfill any relocations, but only for
@@ -25,7 +25,8 @@ pub fn compute_abi_info(ccx: &CrateContext, fty: &mut FnType) {
// http://www.angelcode.com/dev/callconv/callconv.html
// Clang's ABI handling is in lib/CodeGen/TargetInfo.cpp
let t = &ccx.sess().target.target;
if t.options.is_like_osx || t.options.is_like_windows {
if t.options.is_like_osx || t.options.is_like_windows
|| t.options.is_like_openbsd {
match llsize_of_alloc(ccx, fty.ret.ty) {
1 => fty.ret.cast = Some(Type::i8(ccx)),
2 => fty.ret.cast = Some(Type::i16(ccx)),
ProTip! Use n and p to navigate between commits in a pull request.