Skip to content
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 netbsd amd64 supprot #26682

Merged
merged 1 commit into from
Jul 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,10 @@ case $CFG_OSTYPE in
CFG_OSTYPE=unknown-openbsd
;;

NetBSD)
CFG_OSTYPE=unknown-netbsd
;;

Darwin)
CFG_OSTYPE=apple-darwin
;;
Expand Down
22 changes: 22 additions & 0 deletions mk/cfg/x86_64-unknown-netbsd.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# x86_64-unknown-netbsd configuration
CC_x86_64-unknown-netbsd=$(CC)
CXX_x86_64-unknown-netbsd=$(CXX)
CPP_x86_64-unknown-netbsd=$(CPP)
AR_x86_64-unknown-netbsd=$(AR)
CFG_LIB_NAME_x86_64-unknown-netbsd=lib$(1).so
CFG_STATIC_LIB_NAME_x86_64-unknown-netbsd=lib$(1).a
CFG_LIB_GLOB_x86_64-unknown-netbsd=lib$(1)-*.so
CFG_LIB_DSYM_GLOB_x86_64-unknown-netbsd=$(1)-*.dylib.dSYM
CFG_JEMALLOC_CFLAGS_x86_64-unknown-netbsd := -I/usr/local/include $(CFLAGS)
CFG_GCCISH_CFLAGS_x86_64-unknown-netbsd := -Wall -Werror -g -fPIC -I/usr/local/include $(CFLAGS)
CFG_GCCISH_LINK_FLAGS_x86_64-unknown-netbsd := -shared -fPIC -g -pthread -lrt
CFG_GCCISH_DEF_FLAG_x86_64-unknown-netbsd := -Wl,--export-dynamic,--dynamic-list=
CFG_LLC_FLAGS_x86_64-unknown-netbsd :=
CFG_INSTALL_NAME_x86_64-unknown-netbsd =
CFG_EXE_SUFFIX_x86_64-unknown-netbsd :=
CFG_WINDOWSY_x86_64-unknown-netbsd :=
CFG_UNIXY_x86_64-unknown-netbsd := 1
CFG_LDPATH_x86_64-unknown-netbsd :=
CFG_RUN_x86_64-unknown-netbsd=$(2)
CFG_RUN_TARG_x86_64-unknown-netbsd=$(call CFG_RUN_x86_64-unknown-netbsd,,$(2))
CFG_GNU_TRIPLE_x86_64-unknown-netbsd := x86_64-unknown-netbsd
1 change: 1 addition & 0 deletions src/compiletest/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const OS_TABLE: &'static [(&'static str, &'static str)] = &[
("ios", "ios"),
("linux", "linux"),
("mingw32", "windows"),
("netbsd", "netbsd"),
("openbsd", "openbsd"),
("win32", "windows"),
("windows", "windows"),
Expand Down
2 changes: 1 addition & 1 deletion src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2023,7 +2023,7 @@ The following configurations must be defined by the implementation:
as a configuration itself, like `unix` or `windows`.
* `target_os = "..."`. Operating system of the target, examples include
`"windows"`, `"macos"`, `"ios"`, `"linux"`, `"android"`, `"freebsd"`, `"dragonfly"`,
`"bitrig"` or `"openbsd"`.
`"bitrig"` , `"openbsd"` or `"netbsd"`.
* `target_pointer_width = "..."`. Target pointer width in bits. This is set
to `"32"` for targets with 32-bit pointers, and likewise set to `"64"` for
64-bit pointers.
Expand Down
11 changes: 7 additions & 4 deletions src/etc/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ def scrub(b):
download_unpack_base = os.path.join(download_dir_base, "unpack")

snapshot_files = {
"bitrig": ["bin/rustc"],
"dragonfly": ["bin/rustc"],
"freebsd": ["bin/rustc"],
"linux": ["bin/rustc"],
"macos": ["bin/rustc"],
"winnt": ["bin/rustc.exe"],
"freebsd": ["bin/rustc"],
"dragonfly": ["bin/rustc"],
"bitrig": ["bin/rustc"],
"netbsd": ["bin/rustc"],
"openbsd": ["bin/rustc"],
"winnt": ["bin/rustc.exe"],
}

winnt_runtime_deps_32 = ["libgcc_s_dw2-1.dll", "libstdc++-6.dll"]
Expand Down Expand Up @@ -103,6 +104,8 @@ def get_kernel(triple):
return "dragonfly"
if os_name == "bitrig":
return "bitrig"
if os_name == "netbsd":
return "netbsd"
if os_name == "openbsd":
return "openbsd"
return "linux"
Expand Down
28 changes: 18 additions & 10 deletions src/liblibc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,7 @@ pub mod types {
}
}

#[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
#[cfg(any(target_os = "bitrig", target_os = "netbsd", target_os ="openbsd"))]
pub mod os {
pub mod common {
pub mod posix01 {
Expand Down Expand Up @@ -1351,7 +1351,7 @@ pub mod types {
pub __unused7: *mut c_void,
}

#[cfg(target_os = "openbsd")]
#[cfg(any(target_os = "netbsd", target_os="openbsd"))]
#[repr(C)]
#[derive(Copy, Clone)] pub struct glob_t {
pub gl_pathc: c_int,
Expand Down Expand Up @@ -4323,7 +4323,7 @@ pub mod consts {
}
}

#[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
#[cfg(any(target_os = "bitrig", target_os = "netbsd", target_os = "openbsd"))]
pub mod os {
pub mod c95 {
use types::os::arch::c95::{c_int, c_uint};
Expand Down Expand Up @@ -5568,6 +5568,7 @@ pub mod funcs {
target_os = "freebsd",
target_os = "dragonfly",
target_os = "bitrig",
target_os = "netbsd",
target_os = "openbsd",
target_os = "nacl"))]
pub mod posix88 {
Expand All @@ -5584,6 +5585,7 @@ pub mod funcs {
target_os = "freebsd",
target_os = "dragonfly",
target_os = "bitrig",
target_os = "netbsd",
target_os = "openbsd",
target_os = "android",
target_os = "ios",
Expand All @@ -5602,6 +5604,7 @@ pub mod funcs {
target_os = "freebsd",
target_os = "dragonfly",
target_os = "bitrig",
target_os = "netbsd",
target_os = "openbsd",
target_os = "android",
target_os = "ios",
Expand Down Expand Up @@ -5889,6 +5892,7 @@ pub mod funcs {
target_os = "freebsd",
target_os = "dragonfly",
target_os = "bitrig",
target_os = "netbsd",
target_os = "openbsd",
target_os = "nacl"))]
pub mod posix01 {
Expand All @@ -5901,6 +5905,7 @@ pub mod funcs {
target_os = "freebsd",
target_os = "dragonfly",
target_os = "bitrig",
target_os = "netbsd",
target_os = "openbsd",
target_os = "android",
target_os = "ios",
Expand Down Expand Up @@ -6019,16 +6024,17 @@ pub mod funcs {
}


#[cfg(any(target_os = "windows",
target_os = "linux",
target_os = "android",
target_os = "macos",
#[cfg(any(target_os = "android",
target_os = "bitrig",
target_os = "dragonfly",
target_os = "ios",
target_os = "freebsd",
target_os = "dragonfly",
target_os = "bitrig",
target_os = "linux",
target_os = "macos",
target_os = "nacl",
target_os = "netbsd",
target_os = "openbsd",
target_os = "nacl"))]
target_os = "windows"))]
pub mod posix08 {
pub mod unistd {
}
Expand Down Expand Up @@ -6115,6 +6121,7 @@ pub mod funcs {
target_os = "freebsd",
target_os = "dragonfly",
target_os = "bitrig",
target_os = "netbsd",
target_os = "openbsd"))]
pub mod bsd44 {
use types::common::c95::{c_void};
Expand Down Expand Up @@ -6192,6 +6199,7 @@ pub mod funcs {
#[cfg(any(target_os = "freebsd",
target_os = "dragonfly",
target_os = "bitrig",
target_os = "netbsd",
target_os = "openbsd"))]
pub mod extra {
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_back/arm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs
-a:0:64-n32".to_string()
}

abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig | abi::OsOpenbsd => {
abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig | abi::OsOpenbsd | abi::OsNetbsd => {
"e-p:32:32:32\
-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
-f32:32:32-f64:64:64\
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_back/mips.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs
-a:0:64-n32".to_string()
}

abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig | abi::OsOpenbsd => {
abi::OsBitrig | abi::OsDragonfly | abi::OsFreebsd | abi::OsNetbsd | abi::OsOpenbsd => {
"E-p:32:32:32\
-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
-f32:32:32-f64:64:64\
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_back/mipsel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs
-a:0:64-n32".to_string()
}

abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig | abi::OsOpenbsd => {
abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig | abi::OsOpenbsd | abi::OsNetbsd => {
"e-p:32:32:32\
-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
-f32:32:32-f64:64:64\
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_back/target/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ mod dragonfly_base;
mod freebsd_base;
mod linux_base;
mod openbsd_base;
mod netbsd_base;
mod windows_base;
mod windows_msvc_base;

Expand Down Expand Up @@ -368,6 +369,7 @@ impl Target {

x86_64_unknown_bitrig,
x86_64_unknown_openbsd,
x86_64_unknown_netbsd,

x86_64_apple_darwin,
i686_apple_darwin,
Expand Down
32 changes: 32 additions & 0 deletions src/librustc_back/target/netbsd_base.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use target::TargetOptions;
use std::default::Default;

pub fn opts() -> TargetOptions {
TargetOptions {
linker: "cc".to_string(),
dynamic_linking: true,
executables: true,
morestack: false,
linker_is_gnu: true,
has_rpath: 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
// libraries which follow this flag. Thus, use it before
// specifying libraries to link to.
"-Wl,--as-needed".to_string(),
),
position_independent_executables: true,
.. Default::default()
}
}
29 changes: 29 additions & 0 deletions src/librustc_back/target/x86_64_unknown_netbsd.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use target::Target;

pub fn target() -> Target {
let mut base = super::netbsd_base::opts();
base.pre_link_args.push("-m64".to_string());

Target {
data_layout: "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\
f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\
s0:64:64-f80:128:128-n8:16:32:64-S128".to_string(),
llvm_target: "x86_64-unknown-netbsd".to_string(),
target_endian: "little".to_string(),
target_pointer_width: "64".to_string(),
arch: "x86_64".to_string(),
target_os: "netbsd".to_string(),
target_env: "".to_string(),
options: base,
}
}
2 changes: 1 addition & 1 deletion src/librustc_back/x86.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os)
"e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string()
}

abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig | abi::OsOpenbsd => {
abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig | abi::OsOpenbsd | abi::OsNetbsd => {
"e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string()
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_back/x86_64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs
s0:64:64-f80:128:128-n8:16:32:64-S128".to_string()
}

abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig | abi::OsOpenbsd => {
abi::OsBitrig | abi::OsDragonfly | abi::OsFreebsd | abi::OsNetbsd | abi::OsOpenbsd => {
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\
f32:32:32-f64:64:64-v64:64:64-v128:128:128-a:0:64-\
s0:64:64-f80:128:128-n8:16:32:64-S128".to_string()
Expand Down
1 change: 1 addition & 0 deletions src/librustdoc/flock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ mod imp {

#[cfg(any(target_os = "dragonfly",
target_os = "bitrig",
target_os = "netbsd",
target_os = "openbsd"))]
mod os {
use libc;
Expand Down
2 changes: 2 additions & 0 deletions src/libstd/dynamic_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ mod tests {
target_os = "freebsd",
target_os = "dragonfly",
target_os = "bitrig",
target_os = "netbsd",
target_os = "openbsd"))]
fn test_errors_do_not_crash() {
// Open /dev/null as a library to get an error, and make sure
Expand All @@ -179,6 +180,7 @@ mod tests {
target_os = "freebsd",
target_os = "dragonfly",
target_os = "bitrig",
target_os = "netbsd",
target_os = "openbsd"))]
mod dl {
use prelude::v1::*;
Expand Down
12 changes: 12 additions & 0 deletions src/libstd/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ pub mod consts {
/// - freebsd
/// - dragonfly
/// - bitrig
/// - netbsd
/// - openbsd
/// - android
/// - windows
Expand Down Expand Up @@ -759,6 +760,17 @@ mod os {
pub const EXE_EXTENSION: &'static str = "";
}

#[cfg(target_os = "netbsd")]
mod os {
pub const FAMILY: &'static str = "unix";
pub const OS: &'static str = "netbsd";
pub const DLL_PREFIX: &'static str = "lib";
pub const DLL_SUFFIX: &'static str = ".so";
pub const DLL_EXTENSION: &'static str = "so";
pub const EXE_SUFFIX: &'static str = "";
pub const EXE_EXTENSION: &'static str = "";
}

#[cfg(target_os = "openbsd")]
mod os {
pub const FAMILY: &'static str = "unix";
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/net/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ mod tests {

// FIXME: re-enabled bitrig/openbsd tests once their socket timeout code
// no longer has rounding errors.
#[cfg_attr(any(target_os = "bitrig", target_os = "openbsd"), ignore)]
#[cfg_attr(any(target_os = "bitrig", target_os = "netbsd", target_os = "openbsd"), ignore)]
#[test]
fn timeouts() {
let addr = next_test_ip4();
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/net/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,9 @@ mod tests {
assert_eq!(format!("{:?}", udpsock), compare);
}

// FIXME: re-enabled bitrig/openbsd tests once their socket timeout code
// FIXME: re-enabled bitrig/openbsd/netbsd tests once their socket timeout code
// no longer has rounding errors.
#[cfg_attr(any(target_os = "bitrig", target_os = "openbsd"), ignore)]
#[cfg_attr(any(target_os = "bitrig", target_os = "netbsd", target_os = "openbsd"), ignore)]
#[test]
fn timeouts() {
let addr = next_test_ip4();
Expand Down
1 change: 1 addition & 0 deletions src/libstd/os/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#[cfg(target_os = "linux")] pub mod linux;
#[cfg(target_os = "macos")] pub mod macos;
#[cfg(target_os = "nacl")] pub mod nacl;
#[cfg(target_os = "netbsd")] pub mod netbsd;
#[cfg(target_os = "openbsd")] pub mod openbsd;

pub mod raw;
Loading