mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
bitrig integration
This commit is contained in:
parent
e29f420255
commit
cd8f31759f
22
configure
vendored
22
configure
vendored
@ -374,6 +374,10 @@ case $CFG_OSTYPE in
|
||||
CFG_OSTYPE=unknown-dragonfly
|
||||
;;
|
||||
|
||||
Bitrig)
|
||||
CFG_OSTYPE=unknown-bitrig
|
||||
;;
|
||||
|
||||
OpenBSD)
|
||||
CFG_OSTYPE=unknown-openbsd
|
||||
;;
|
||||
@ -747,6 +751,13 @@ then
|
||||
CFG_ENABLE_CLANG=1
|
||||
fi
|
||||
|
||||
# Force bitrig to build with clang; gcc doesn't like us there
|
||||
if [ $CFG_OSTYPE = unknown-bitrig ]
|
||||
then
|
||||
step_msg "on Bitrig, forcing use of clang"
|
||||
CFG_ENABLE_CLANG=1
|
||||
fi
|
||||
|
||||
if [ -z "$CFG_ENABLE_CLANG" -a -z "$CFG_GCC" ]
|
||||
then
|
||||
err "either clang or gcc is required"
|
||||
@ -1106,11 +1117,12 @@ then
|
||||
msg "git: submodule status"
|
||||
"${CFG_GIT}" submodule status --recursive
|
||||
|
||||
msg "git: submodule clobber"
|
||||
"${CFG_GIT}" submodule foreach --recursive git clean -dxf
|
||||
need_ok "git failed"
|
||||
"${CFG_GIT}" submodule foreach --recursive git checkout .
|
||||
need_ok "git failed"
|
||||
# don't clobber so that our patches won't get removed
|
||||
#msg "git: submodule clobber"
|
||||
#"${CFG_GIT}" submodule foreach --recursive git clean -dxf
|
||||
#need_ok "git failed"
|
||||
#"${CFG_GIT}" submodule foreach --recursive git checkout .
|
||||
#need_ok "git failed"
|
||||
|
||||
cd ${CFG_BUILD_DIR}
|
||||
fi
|
||||
|
26
mk/cfg/x86_64-unknown-bitrig.mk
Normal file
26
mk/cfg/x86_64-unknown-bitrig.mk
Normal file
@ -0,0 +1,26 @@
|
||||
# x86_64-unknown-bitrig-elf configuration
|
||||
CC_x86_64-unknown-bitrig=$(CC)
|
||||
CXX_x86_64-unknown-bitrig=$(CXX)
|
||||
CPP_x86_64-unknown-bitrig=$(CPP)
|
||||
AR_x86_64-unknown-bitrig=$(AR)
|
||||
CFG_LIB_NAME_x86_64-unknown-bitrig=lib$(1).so
|
||||
CFG_STATIC_LIB_NAME_x86_64-unknown-bitrig=lib$(1).a
|
||||
CFG_LIB_GLOB_x86_64-unknown-bitrig=lib$(1)-*.so
|
||||
CFG_LIB_DSYM_GLOB_x86_64-unknown-bitrig=$(1)-*.dylib.dSYM
|
||||
CFG_JEMALLOC_CFLAGS_x86_64-unknown-bitrig := -m64 -I/usr/include $(CFLAGS)
|
||||
CFG_GCCISH_CFLAGS_x86_64-unknown-bitrig := -Wall -Werror -fPIC -m64 -I/usr/include $(CFLAGS)
|
||||
CFG_GCCISH_LINK_FLAGS_x86_64-unknown-bitrig := -shared -pic -pthread -m64 $(LDFLAGS)
|
||||
CFG_GCCISH_DEF_FLAG_x86_64-unknown-bitrig := -Wl,--export-dynamic,--dynamic-list=
|
||||
CFG_GCCISH_PRE_LIB_FLAGS_x86_64-unknown-bitrig := -Wl,-pic -Wl,-whole-archive
|
||||
CFG_GCCISH_POST_LIB_FLAGS_x86_64-unknown-bitrig := -Wl,-no-whole-archive
|
||||
CFG_DEF_SUFFIX_x86_64-unknown-bitrig := .bsd.def
|
||||
CFG_LLC_FLAGS_x86_64-unknown-bitrig :=
|
||||
CFG_INSTALL_NAME_x86_64-unknown-bitrig =
|
||||
CFG_EXE_SUFFIX_x86_64-unknown-bitrig :=
|
||||
CFG_WINDOWSY_x86_64-unknown-bitrig :=
|
||||
CFG_UNIXY_x86_64-unknown-bitrig := 1
|
||||
CFG_PATH_MUNGE_x86_64-unknown-bitrig :=
|
||||
CFG_LDPATH_x86_64-unknown-bitrig :=
|
||||
CFG_RUN_x86_64-unknown-bitrig=$(2)
|
||||
CFG_RUN_TARG_x86_64-unknown-bitrig=$(call CFG_RUN_x86_64-unknown-bitrig,,$(2))
|
||||
CFG_GNU_TRIPLE_x86_64-unknown-bitrig := x86_64-unknown-bitrig
|
@ -179,11 +179,19 @@ define CFG_MAKE_TOOLCHAIN
|
||||
|
||||
ifeq ($$(findstring $(HOST_$(1)),arm aarch64 mips mipsel powerpc),)
|
||||
|
||||
# On Bitrig, we need the relocation model to be PIC for everthing
|
||||
ifeq (,$(filter $(OSTYPE_$(1)),bitrig))
|
||||
LLVM_MC_RELOCATION_MODEL="pic"
|
||||
else
|
||||
LLVM_MC_RELOCATION_MODEL="default"
|
||||
endif
|
||||
|
||||
# We're using llvm-mc as our assembler because it supports
|
||||
# .cfi pseudo-ops on mac
|
||||
CFG_ASSEMBLE_$(1)=$$(CPP_$(1)) -E $$(CFG_DEPEND_FLAGS) $$(2) | \
|
||||
$$(LLVM_MC_$$(CFG_BUILD)) \
|
||||
-assemble \
|
||||
-relocation-model=$$(LLVM_MC_RELOCATION_MODEL) \
|
||||
-filetype=obj \
|
||||
-triple=$(1) \
|
||||
-o=$$(1)
|
||||
|
@ -23,6 +23,7 @@ static OS_TABLE: &'static [(&'static str, &'static str)] = &[
|
||||
("linux", "linux"),
|
||||
("freebsd", "freebsd"),
|
||||
("dragonfly", "dragonfly"),
|
||||
("bitrig", "bitrig"),
|
||||
("openbsd", "openbsd"),
|
||||
];
|
||||
|
||||
|
@ -2192,8 +2192,8 @@ The following configurations must be defined by the implementation:
|
||||
`"unix"` or `"windows"`. The value of this configuration option is defined
|
||||
as a configuration itself, like `unix` or `windows`.
|
||||
* `target_os = "..."`. Operating system of the target, examples include
|
||||
`"win32"`, `"macos"`, `"linux"`, `"android"`, `"freebsd"`, `"dragonfly"` or
|
||||
`"openbsd"`.
|
||||
`"win32"`, `"macos"`, `"linux"`, `"android"`, `"freebsd"`, `"dragonfly"`,
|
||||
`"bitrig"` or `"openbsd"`.
|
||||
* `target_word_size = "..."`. Target word size in bits. This is set to `"32"`
|
||||
for targets with 32-bit pointers, and likewise set to `"64"` for 64-bit
|
||||
pointers.
|
||||
|
@ -18,7 +18,7 @@ LIB_PREFIX=lib
|
||||
|
||||
OS=`uname -s`
|
||||
case $OS in
|
||||
("Linux"|"FreeBSD"|"DragonFly"|"OpenBSD")
|
||||
("Linux"|"FreeBSD"|"DragonFly"|"Bitrig"|"OpenBSD")
|
||||
BIN_SUF=
|
||||
LIB_SUF=.so
|
||||
;;
|
||||
|
@ -57,7 +57,16 @@ else:
|
||||
args.extend(components)
|
||||
out = run(args)
|
||||
for lib in out.strip().replace("\n", ' ').split(' '):
|
||||
lib = lib.strip()[2:] # chop of the leading '-l'
|
||||
if len(lib) == 0:
|
||||
continue
|
||||
# in some cases we get extra spaces in between libs so ignore those
|
||||
if len(lib) == 1 and lib == ' ':
|
||||
continue
|
||||
# not all libs strictly follow -lfoo, on Bitrig, there is -pthread
|
||||
if lib[0:2] == '-l':
|
||||
lib = lib.strip()[2:]
|
||||
elif lib[0] == '-':
|
||||
lib = lib.strip()[1:]
|
||||
f.write("#[link(name = \"" + lib + "\"")
|
||||
# LLVM libraries are all static libraries
|
||||
if 'LLVM' in lib:
|
||||
|
@ -46,13 +46,13 @@ snapshot_files = {
|
||||
"winnt": ["bin/rustc.exe"],
|
||||
"freebsd": ["bin/rustc"],
|
||||
"dragonfly": ["bin/rustc"],
|
||||
"bitrig": ["bin/rustc"],
|
||||
"openbsd": ["bin/rustc"],
|
||||
}
|
||||
|
||||
winnt_runtime_deps_32 = ["libgcc_s_dw2-1.dll", "libstdc++-6.dll"]
|
||||
winnt_runtime_deps_64 = ["libgcc_s_seh-1.dll", "libstdc++-6.dll"]
|
||||
|
||||
|
||||
def parse_line(n, line):
|
||||
global snapshotfile
|
||||
|
||||
@ -101,6 +101,8 @@ def get_kernel(triple):
|
||||
return "freebsd"
|
||||
if os_name == "dragonfly":
|
||||
return "dragonfly"
|
||||
if os_name == "bitrig":
|
||||
return "bitrig"
|
||||
if os_name == "openbsd":
|
||||
return "openbsd"
|
||||
return "linux"
|
||||
|
4
src/libbacktrace/configure
vendored
4
src/libbacktrace/configure
vendored
@ -5650,7 +5650,7 @@ else
|
||||
lt_cv_sys_max_cmd_len=8192;
|
||||
;;
|
||||
|
||||
netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
|
||||
netbsd* | freebsd* | openbsd* | darwin* | dragonfly* | bitrig*)
|
||||
# This has been around since 386BSD, at least. Likely further.
|
||||
if test -x /sbin/sysctl; then
|
||||
lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
|
||||
@ -9332,7 +9332,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
|
||||
;;
|
||||
|
||||
# FreeBSD 3 and greater uses gcc -shared to do shared libraries.
|
||||
freebsd* | dragonfly* | openbsd*)
|
||||
freebsd* | dragonfly* | bitrig* | openbsd*)
|
||||
archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
|
@ -4741,7 +4741,7 @@ func_mode_link ()
|
||||
# These systems don't actually have a C library (as such)
|
||||
test "X$arg" = "X-lc" && continue
|
||||
;;
|
||||
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
|
||||
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
|
||||
# Do not include libc due to us having libc/libc_r.
|
||||
test "X$arg" = "X-lc" && continue
|
||||
;;
|
||||
|
@ -281,6 +281,7 @@ pub use funcs::bsd43::{shutdown};
|
||||
target_os = "android",
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
pub use consts::os::posix01::{CLOCK_REALTIME, CLOCK_MONOTONIC};
|
||||
|
||||
@ -291,7 +292,7 @@ pub use types::os::arch::extra::{sockaddr_ll};
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
pub use consts::os::extra::{AF_PACKET};
|
||||
|
||||
#[cfg(all(unix, not(any(target_os = "freebsd", target_os = "openbsd"))))]
|
||||
#[cfg(all(unix, not(any(target_os = "freebsd", target_os = "bitrig", target_os = "openbsd"))))]
|
||||
pub use consts::os::extra::{MAP_STACK};
|
||||
|
||||
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
|
||||
@ -1322,7 +1323,7 @@ pub mod types {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "openbsd")]
|
||||
#[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
|
||||
pub mod os {
|
||||
pub mod common {
|
||||
pub mod posix01 {
|
||||
@ -1333,6 +1334,24 @@ pub mod types {
|
||||
|
||||
pub type pthread_t = uintptr_t;
|
||||
|
||||
#[cfg(target_os = "bitrig")]
|
||||
#[repr(C)]
|
||||
#[derive(Copy)] pub struct glob_t {
|
||||
pub gl_pathc: c_int,
|
||||
pub gl_matchc: c_int,
|
||||
pub gl_offs: c_int,
|
||||
pub gl_flags: c_int,
|
||||
pub gl_pathv: *mut *mut c_char,
|
||||
pub __unused1: *mut c_void,
|
||||
pub __unused2: *mut c_void,
|
||||
pub __unused3: *mut c_void,
|
||||
pub __unused4: *mut c_void,
|
||||
pub __unused5: *mut c_void,
|
||||
pub __unused6: *mut c_void,
|
||||
pub __unused7: *mut c_void,
|
||||
}
|
||||
|
||||
#[cfg(target_os = "openbsd")]
|
||||
#[repr(C)]
|
||||
#[derive(Copy)] pub struct glob_t {
|
||||
pub gl_pathc: c_int,
|
||||
@ -1451,7 +1470,6 @@ pub mod types {
|
||||
pub ifa_dstaddr: *mut sockaddr,
|
||||
pub ifa_data: *mut c_void
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1485,25 +1503,27 @@ pub mod types {
|
||||
pub type uintmax_t = u64;
|
||||
}
|
||||
pub mod posix88 {
|
||||
use types::os::arch::c95::{c_long};
|
||||
pub type off_t = i64;
|
||||
pub type dev_t = u32;
|
||||
pub type dev_t = i32;
|
||||
pub type ino_t = u64;
|
||||
pub type pid_t = i32;
|
||||
pub type uid_t = u32;
|
||||
pub type gid_t = u32;
|
||||
pub type useconds_t = u32;
|
||||
pub type mode_t = u32;
|
||||
pub type ssize_t = i64;
|
||||
pub type ssize_t = c_long;
|
||||
}
|
||||
pub mod posix01 {
|
||||
use types::common::c95::{c_void};
|
||||
use types::common::c99::{uint32_t, uint64_t};
|
||||
use types::os::arch::c95::{c_long, time_t};
|
||||
use types::os::arch::c95::{time_t};
|
||||
use types::os::arch::posix88::{dev_t, gid_t};
|
||||
use types::os::arch::posix88::{mode_t, off_t};
|
||||
use types::os::arch::posix88::{uid_t};
|
||||
use types::os::common::posix01::{timespec};
|
||||
|
||||
pub type nlink_t = u32;
|
||||
pub type nlink_t = uint32_t;
|
||||
pub type blksize_t = uint32_t;
|
||||
pub type ino_t = uint64_t;
|
||||
pub type blkcnt_t = i64;
|
||||
@ -1518,19 +1538,15 @@ pub mod types {
|
||||
pub st_uid: uid_t,
|
||||
pub st_gid: gid_t,
|
||||
pub st_rdev: dev_t,
|
||||
pub st_atime: time_t,
|
||||
pub st_atime_nsec: c_long,
|
||||
pub st_mtime: time_t,
|
||||
pub st_mtime_nsec: c_long,
|
||||
pub st_ctime: time_t,
|
||||
pub st_ctime_nsec: c_long,
|
||||
pub st_atim: timespec,
|
||||
pub st_mtim: timespec,
|
||||
pub st_ctim: timespec,
|
||||
pub st_size: off_t,
|
||||
pub st_blocks: blkcnt_t,
|
||||
pub st_blksize: blksize_t,
|
||||
pub st_flags: fflags_t,
|
||||
pub st_gen: uint32_t,
|
||||
pub st_birthtime: time_t,
|
||||
pub st_birthtime_nsec: c_long,
|
||||
pub __st_birthtim: timespec,
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Copy)] pub struct utimbuf {
|
||||
@ -3887,7 +3903,386 @@ pub mod consts {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "openbsd")]
|
||||
#[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
|
||||
pub mod os {
|
||||
pub mod c95 {
|
||||
use types::os::arch::c95::{c_int, c_uint};
|
||||
|
||||
pub const EXIT_FAILURE : c_int = 1;
|
||||
pub const EXIT_SUCCESS : c_int = 0;
|
||||
pub const RAND_MAX : c_int = 2147483647;
|
||||
pub const EOF : c_int = -1;
|
||||
pub const SEEK_SET : c_int = 0;
|
||||
pub const SEEK_CUR : c_int = 1;
|
||||
pub const SEEK_END : c_int = 2;
|
||||
pub const _IOFBF : c_int = 0;
|
||||
pub const _IONBF : c_int = 2;
|
||||
pub const _IOLBF : c_int = 1;
|
||||
pub const BUFSIZ : c_uint = 1024_u32;
|
||||
pub const FOPEN_MAX : c_uint = 20_u32;
|
||||
pub const FILENAME_MAX : c_uint = 1024_u32;
|
||||
pub const L_tmpnam : c_uint = 1024_u32;
|
||||
pub const TMP_MAX : c_uint = 308915776_u32;
|
||||
}
|
||||
pub mod c99 {
|
||||
}
|
||||
pub mod posix88 {
|
||||
use types::common::c95::c_void;
|
||||
use types::os::arch::c95::c_int;
|
||||
use types::os::arch::posix88::mode_t;
|
||||
|
||||
pub const O_RDONLY : c_int = 0;
|
||||
pub const O_WRONLY : c_int = 1;
|
||||
pub const O_RDWR : c_int = 2;
|
||||
pub const O_APPEND : c_int = 8;
|
||||
pub const O_CREAT : c_int = 512;
|
||||
pub const O_EXCL : c_int = 2048;
|
||||
pub const O_TRUNC : c_int = 1024;
|
||||
pub const S_IFIFO : mode_t = 4096;
|
||||
pub const S_IFCHR : mode_t = 8192;
|
||||
pub const S_IFBLK : mode_t = 24576;
|
||||
pub const S_IFDIR : mode_t = 16384;
|
||||
pub const S_IFREG : mode_t = 32768;
|
||||
pub const S_IFLNK : mode_t = 40960;
|
||||
pub const S_IFMT : mode_t = 61440;
|
||||
pub const S_IEXEC : mode_t = 64;
|
||||
pub const S_IWRITE : mode_t = 128;
|
||||
pub const S_IREAD : mode_t = 256;
|
||||
pub const S_IRWXU : mode_t = 448;
|
||||
pub const S_IXUSR : mode_t = 64;
|
||||
pub const S_IWUSR : mode_t = 128;
|
||||
pub const S_IRUSR : mode_t = 256;
|
||||
pub const F_OK : c_int = 0;
|
||||
pub const R_OK : c_int = 4;
|
||||
pub const W_OK : c_int = 2;
|
||||
pub const X_OK : c_int = 1;
|
||||
pub const STDIN_FILENO : c_int = 0;
|
||||
pub const STDOUT_FILENO : c_int = 1;
|
||||
pub const STDERR_FILENO : c_int = 2;
|
||||
pub const F_LOCK : c_int = 1;
|
||||
pub const F_TEST : c_int = 3;
|
||||
pub const F_TLOCK : c_int = 2;
|
||||
pub const F_ULOCK : c_int = 0;
|
||||
pub const SIGHUP : c_int = 1;
|
||||
pub const SIGINT : c_int = 2;
|
||||
pub const SIGQUIT : c_int = 3;
|
||||
pub const SIGILL : c_int = 4;
|
||||
pub const SIGABRT : c_int = 6;
|
||||
pub const SIGFPE : c_int = 8;
|
||||
pub const SIGKILL : c_int = 9;
|
||||
pub const SIGSEGV : c_int = 11;
|
||||
pub const SIGPIPE : c_int = 13;
|
||||
pub const SIGALRM : c_int = 14;
|
||||
pub const SIGTERM : c_int = 15;
|
||||
|
||||
pub const PROT_NONE : c_int = 0;
|
||||
pub const PROT_READ : c_int = 1;
|
||||
pub const PROT_WRITE : c_int = 2;
|
||||
pub const PROT_EXEC : c_int = 4;
|
||||
|
||||
pub const MAP_FILE : c_int = 0x0000;
|
||||
pub const MAP_SHARED : c_int = 0x0001;
|
||||
pub const MAP_PRIVATE : c_int = 0x0002;
|
||||
pub const MAP_FIXED : c_int = 0x0010;
|
||||
pub const MAP_ANON : c_int = 0x1000;
|
||||
|
||||
pub const MAP_FAILED : *mut c_void = -1 as *mut c_void;
|
||||
|
||||
pub const MCL_CURRENT : c_int = 0x0001;
|
||||
pub const MCL_FUTURE : c_int = 0x0002;
|
||||
|
||||
pub const MS_ASYNC : c_int = 0x0001;
|
||||
pub const MS_SYNC : c_int = 0x0002;
|
||||
pub const MS_INVALIDATE : c_int = 0x0004;
|
||||
|
||||
pub const EPERM : c_int = 1;
|
||||
pub const ENOENT : c_int = 2;
|
||||
pub const ESRCH : c_int = 3;
|
||||
pub const EINTR : c_int = 4;
|
||||
pub const EIO : c_int = 5;
|
||||
pub const ENXIO : c_int = 6;
|
||||
pub const E2BIG : c_int = 7;
|
||||
pub const ENOEXEC : c_int = 8;
|
||||
pub const EBADF : c_int = 9;
|
||||
pub const ECHILD : c_int = 10;
|
||||
pub const EDEADLK : c_int = 11;
|
||||
pub const ENOMEM : c_int = 12;
|
||||
pub const EACCES : c_int = 13;
|
||||
pub const EFAULT : c_int = 14;
|
||||
pub const ENOTBLK : c_int = 15;
|
||||
pub const EBUSY : c_int = 16;
|
||||
pub const EEXIST : c_int = 17;
|
||||
pub const EXDEV : c_int = 18;
|
||||
pub const ENODEV : c_int = 19;
|
||||
pub const ENOTDIR : c_int = 20;
|
||||
pub const EISDIR : c_int = 21;
|
||||
pub const EINVAL : c_int = 22;
|
||||
pub const ENFILE : c_int = 23;
|
||||
pub const EMFILE : c_int = 24;
|
||||
pub const ENOTTY : c_int = 25;
|
||||
pub const ETXTBSY : c_int = 26;
|
||||
pub const EFBIG : c_int = 27;
|
||||
pub const ENOSPC : c_int = 28;
|
||||
pub const ESPIPE : c_int = 29;
|
||||
pub const EROFS : c_int = 30;
|
||||
pub const EMLINK : c_int = 31;
|
||||
pub const EPIPE : c_int = 32;
|
||||
pub const EDOM : c_int = 33;
|
||||
pub const ERANGE : c_int = 34;
|
||||
pub const EAGAIN : c_int = 35;
|
||||
pub const EWOULDBLOCK : c_int = 35;
|
||||
pub const EINPROGRESS : c_int = 36;
|
||||
pub const EALREADY : c_int = 37;
|
||||
pub const ENOTSOCK : c_int = 38;
|
||||
pub const EDESTADDRREQ : c_int = 39;
|
||||
pub const EMSGSIZE : c_int = 40;
|
||||
pub const EPROTOTYPE : c_int = 41;
|
||||
pub const ENOPROTOOPT : c_int = 42;
|
||||
pub const EPROTONOSUPPORT : c_int = 43;
|
||||
pub const ESOCKTNOSUPPORT : c_int = 44;
|
||||
pub const EOPNOTSUPP : c_int = 45;
|
||||
pub const EPFNOSUPPORT : c_int = 46;
|
||||
pub const EAFNOSUPPORT : c_int = 47;
|
||||
pub const EADDRINUSE : c_int = 48;
|
||||
pub const EADDRNOTAVAIL : c_int = 49;
|
||||
pub const ENETDOWN : c_int = 50;
|
||||
pub const ENETUNREACH : c_int = 51;
|
||||
pub const ENETRESET : c_int = 52;
|
||||
pub const ECONNABORTED : c_int = 53;
|
||||
pub const ECONNRESET : c_int = 54;
|
||||
pub const ENOBUFS : c_int = 55;
|
||||
pub const EISCONN : c_int = 56;
|
||||
pub const ENOTCONN : c_int = 57;
|
||||
pub const ESHUTDOWN : c_int = 58;
|
||||
pub const ETOOMANYREFS : c_int = 59;
|
||||
pub const ETIMEDOUT : c_int = 60;
|
||||
pub const ECONNREFUSED : c_int = 61;
|
||||
pub const ELOOP : c_int = 62;
|
||||
pub const ENAMETOOLONG : c_int = 63;
|
||||
pub const EHOSTDOWN : c_int = 64;
|
||||
pub const EHOSTUNREACH : c_int = 65;
|
||||
pub const ENOTEMPTY : c_int = 66;
|
||||
pub const EPROCLIM : c_int = 67;
|
||||
pub const EUSERS : c_int = 68;
|
||||
pub const EDQUOT : c_int = 69;
|
||||
pub const ESTALE : c_int = 70;
|
||||
pub const EREMOTE : c_int = 71;
|
||||
pub const EBADRPC : c_int = 72;
|
||||
pub const ERPCMISMATCH : c_int = 73;
|
||||
pub const EPROGUNAVAIL : c_int = 74;
|
||||
pub const EPROGMISMATCH : c_int = 75;
|
||||
pub const EPROCUNAVAIL : c_int = 76;
|
||||
pub const ENOLCK : c_int = 77;
|
||||
pub const ENOSYS : c_int = 78;
|
||||
pub const EFTYPE : c_int = 79;
|
||||
pub const EAUTH : c_int = 80;
|
||||
pub const ENEEDAUTH : c_int = 81;
|
||||
pub const EIPSEC : c_int = 82;
|
||||
pub const ENOATTR : c_int = 83;
|
||||
pub const EILSEQ : c_int = 84;
|
||||
pub const ENOMEDIUM : c_int = 85;
|
||||
pub const EMEDIUMTYPE : c_int = 86;
|
||||
pub const EOVERFLOW : c_int = 87;
|
||||
pub const ECANCELED : c_int = 88;
|
||||
pub const EIDRM : c_int = 89;
|
||||
pub const ENOMSG : c_int = 90;
|
||||
pub const ENOTSUP : c_int = 91;
|
||||
pub const ELAST : c_int = 91; // must be equal to largest errno
|
||||
}
|
||||
pub mod posix01 {
|
||||
use types::os::arch::c95::{c_int, size_t};
|
||||
|
||||
pub const F_DUPFD : c_int = 0;
|
||||
pub const F_GETFD : c_int = 1;
|
||||
pub const F_SETFD : c_int = 2;
|
||||
pub const F_GETFL : c_int = 3;
|
||||
pub const F_SETFL : c_int = 4;
|
||||
pub const F_GETOWN : c_int = 5;
|
||||
pub const F_SETOWN : c_int = 6;
|
||||
pub const F_GETLK : c_int = 7;
|
||||
pub const F_SETLK : c_int = 8;
|
||||
pub const F_SETLKW : c_int = 9;
|
||||
pub const F_DUPFD_CLOEXEC : c_int = 10;
|
||||
|
||||
pub const SIGTRAP : c_int = 5;
|
||||
pub const SIGPIPE: c_int = 13;
|
||||
pub const SIG_IGN: size_t = 1;
|
||||
|
||||
pub const GLOB_APPEND : c_int = 0x0001;
|
||||
pub const GLOB_DOOFFS : c_int = 0x0002;
|
||||
pub const GLOB_ERR : c_int = 0x0004;
|
||||
pub const GLOB_MARK : c_int = 0x0008;
|
||||
pub const GLOB_NOCHECK : c_int = 0x0010;
|
||||
pub const GLOB_NOSORT : c_int = 0x0020;
|
||||
pub const GLOB_NOESCAPE : c_int = 0x1000;
|
||||
|
||||
pub const GLOB_NOSPACE : c_int = -1;
|
||||
pub const GLOB_ABORTED : c_int = -2;
|
||||
pub const GLOB_NOMATCH : c_int = -3;
|
||||
pub const GLOB_NOSYS : c_int = -4;
|
||||
|
||||
pub const POSIX_MADV_NORMAL : c_int = 0;
|
||||
pub const POSIX_MADV_RANDOM : c_int = 1;
|
||||
pub const POSIX_MADV_SEQUENTIAL : c_int = 2;
|
||||
pub const POSIX_MADV_WILLNEED : c_int = 3;
|
||||
pub const POSIX_MADV_DONTNEED : c_int = 4;
|
||||
|
||||
pub const _SC_IOV_MAX : c_int = 51;
|
||||
pub const _SC_GETGR_R_SIZE_MAX : c_int = 100;
|
||||
pub const _SC_GETPW_R_SIZE_MAX : c_int = 101;
|
||||
pub const _SC_LOGIN_NAME_MAX : c_int = 102;
|
||||
pub const _SC_MQ_PRIO_MAX : c_int = 59;
|
||||
pub const _SC_THREAD_ATTR_STACKADDR : c_int = 77;
|
||||
pub const _SC_THREAD_ATTR_STACKSIZE : c_int = 78;
|
||||
pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : c_int = 80;
|
||||
pub const _SC_THREAD_KEYS_MAX : c_int = 81;
|
||||
pub const _SC_THREAD_PRIO_INHERIT : c_int = 82;
|
||||
pub const _SC_THREAD_PRIO_PROTECT : c_int = 83;
|
||||
pub const _SC_THREAD_PRIORITY_SCHEDULING : c_int = 84;
|
||||
pub const _SC_THREAD_PROCESS_SHARED : c_int = 85;
|
||||
pub const _SC_THREAD_SAFE_FUNCTIONS : c_int = 103;
|
||||
pub const _SC_THREAD_STACK_MIN : c_int = 89;
|
||||
pub const _SC_THREAD_THREADS_MAX : c_int = 90;
|
||||
pub const _SC_THREADS : c_int = 91;
|
||||
pub const _SC_TTY_NAME_MAX : c_int = 107;
|
||||
pub const _SC_ATEXIT_MAX : c_int = 146;
|
||||
pub const _SC_XOPEN_CRYPT : c_int = 117;
|
||||
pub const _SC_XOPEN_ENH_I18N : c_int = 118;
|
||||
pub const _SC_XOPEN_LEGACY : c_int = 119;
|
||||
pub const _SC_XOPEN_REALTIME : c_int = 120;
|
||||
pub const _SC_XOPEN_REALTIME_THREADS : c_int = 121;
|
||||
pub const _SC_XOPEN_SHM : c_int = 30;
|
||||
pub const _SC_XOPEN_UNIX : c_int = 123;
|
||||
pub const _SC_XOPEN_VERSION : c_int = 125;
|
||||
|
||||
pub const PTHREAD_CREATE_JOINABLE : c_int = 0;
|
||||
pub const PTHREAD_CREATE_DETACHED : c_int = 1;
|
||||
pub const PTHREAD_STACK_MIN : size_t = 2048;
|
||||
|
||||
pub const CLOCK_REALTIME : c_int = 0;
|
||||
pub const CLOCK_MONOTONIC : c_int = 3;
|
||||
}
|
||||
pub mod posix08 {
|
||||
}
|
||||
pub mod bsd44 {
|
||||
use types::os::arch::c95::c_int;
|
||||
|
||||
pub const MADV_NORMAL : c_int = 0;
|
||||
pub const MADV_RANDOM : c_int = 1;
|
||||
pub const MADV_SEQUENTIAL : c_int = 2;
|
||||
pub const MADV_WILLNEED : c_int = 3;
|
||||
pub const MADV_DONTNEED : c_int = 4;
|
||||
pub const MADV_FREE : c_int = 6;
|
||||
|
||||
pub const AF_UNIX: c_int = 1;
|
||||
pub const AF_INET: c_int = 2;
|
||||
pub const AF_INET6: c_int = 24;
|
||||
pub const SOCK_STREAM: c_int = 1;
|
||||
pub const SOCK_DGRAM: c_int = 2;
|
||||
pub const SOCK_RAW: c_int = 3;
|
||||
pub const IPPROTO_TCP: c_int = 6;
|
||||
pub const IPPROTO_IP: c_int = 0;
|
||||
pub const IPPROTO_IPV6: c_int = 41;
|
||||
pub const IP_MULTICAST_TTL: c_int = 10;
|
||||
pub const IP_MULTICAST_LOOP: c_int = 11;
|
||||
pub const IP_TTL: c_int = 4;
|
||||
pub const IP_HDRINCL: c_int = 2;
|
||||
pub const IP_ADD_MEMBERSHIP: c_int = 12;
|
||||
pub const IP_DROP_MEMBERSHIP: c_int = 13;
|
||||
pub const IPV6_ADD_MEMBERSHIP: c_int = 12; // don't exist
|
||||
pub const IPV6_DROP_MEMBERSHIP: c_int = 13; // don't exist
|
||||
|
||||
pub const TCP_NODELAY: c_int = 0x01;
|
||||
pub const SOL_SOCKET: c_int = 0xffff;
|
||||
pub const SO_KEEPALIVE: c_int = 0x0008;
|
||||
pub const SO_BROADCAST: c_int = 0x0020;
|
||||
pub const SO_REUSEADDR: c_int = 0x0004;
|
||||
pub const SO_ERROR: c_int = 0x1007;
|
||||
|
||||
pub const IFF_LOOPBACK: c_int = 0x8;
|
||||
|
||||
pub const SHUT_RD: c_int = 0;
|
||||
pub const SHUT_WR: c_int = 1;
|
||||
pub const SHUT_RDWR: c_int = 2;
|
||||
}
|
||||
pub mod extra {
|
||||
use types::os::arch::c95::c_int;
|
||||
|
||||
pub const O_DSYNC : c_int = 128; // same as SYNC
|
||||
pub const O_SYNC : c_int = 128;
|
||||
pub const O_NONBLOCK : c_int = 4;
|
||||
pub const CTL_KERN : c_int = 1;
|
||||
pub const KERN_PROC : c_int = 66;
|
||||
|
||||
pub const MAP_COPY : c_int = 0x0002;
|
||||
pub const MAP_RENAME : c_int = 0x0000;
|
||||
pub const MAP_NORESERVE : c_int = 0x0000;
|
||||
pub const MAP_NOEXTEND : c_int = 0x0000;
|
||||
pub const MAP_HASSEMAPHORE : c_int = 0x0000;
|
||||
|
||||
pub const IPPROTO_RAW : c_int = 255;
|
||||
|
||||
pub const PATH_MAX: c_int = 1024;
|
||||
}
|
||||
pub mod sysconf {
|
||||
use types::os::arch::c95::c_int;
|
||||
|
||||
pub const _SC_ARG_MAX : c_int = 1;
|
||||
pub const _SC_CHILD_MAX : c_int = 2;
|
||||
pub const _SC_CLK_TCK : c_int = 3;
|
||||
pub const _SC_NGROUPS_MAX : c_int = 4;
|
||||
pub const _SC_OPEN_MAX : c_int = 5;
|
||||
pub const _SC_JOB_CONTROL : c_int = 6;
|
||||
pub const _SC_SAVED_IDS : c_int = 7;
|
||||
pub const _SC_VERSION : c_int = 8;
|
||||
pub const _SC_BC_BASE_MAX : c_int = 9;
|
||||
pub const _SC_BC_DIM_MAX : c_int = 10;
|
||||
pub const _SC_BC_SCALE_MAX : c_int = 11;
|
||||
pub const _SC_BC_STRING_MAX : c_int = 12;
|
||||
pub const _SC_COLL_WEIGHTS_MAX : c_int = 13;
|
||||
pub const _SC_EXPR_NEST_MAX : c_int = 14;
|
||||
pub const _SC_LINE_MAX : c_int = 15;
|
||||
pub const _SC_RE_DUP_MAX : c_int = 16;
|
||||
pub const _SC_2_VERSION : c_int = 17;
|
||||
pub const _SC_2_C_BIND : c_int = 18;
|
||||
pub const _SC_2_C_DEV : c_int = 19;
|
||||
pub const _SC_2_CHAR_TERM : c_int = 20;
|
||||
pub const _SC_2_FORT_DEV : c_int = 21;
|
||||
pub const _SC_2_FORT_RUN : c_int = 22;
|
||||
pub const _SC_2_LOCALEDEF : c_int = 23;
|
||||
pub const _SC_2_SW_DEV : c_int = 24;
|
||||
pub const _SC_2_UPE : c_int = 25;
|
||||
pub const _SC_STREAM_MAX : c_int = 26;
|
||||
pub const _SC_TZNAME_MAX : c_int = 27;
|
||||
pub const _SC_PAGESIZE : c_int = 28;
|
||||
pub const _SC_FSYNC : c_int = 29;
|
||||
pub const _SC_SEM_NSEMS_MAX : c_int = 31;
|
||||
pub const _SC_SEM_VALUE_MAX : c_int = 32;
|
||||
pub const _SC_AIO_LISTIO_MAX : c_int = 42;
|
||||
pub const _SC_AIO_MAX : c_int = 43;
|
||||
pub const _SC_AIO_PRIO_DELTA_MAX : c_int = 44;
|
||||
pub const _SC_ASYNCHRONOUS_IO : c_int = 45;
|
||||
pub const _SC_DELAYTIMER_MAX : c_int = 50;
|
||||
pub const _SC_MAPPED_FILES : c_int = 53;
|
||||
pub const _SC_MEMLOCK : c_int = 54;
|
||||
pub const _SC_MEMLOCK_RANGE : c_int = 55;
|
||||
pub const _SC_MEMORY_PROTECTION : c_int = 56;
|
||||
pub const _SC_MESSAGE_PASSING : c_int = 57;
|
||||
pub const _SC_MQ_OPEN_MAX : c_int = 58;
|
||||
pub const _SC_PRIORITIZED_IO : c_int = 60;
|
||||
pub const _SC_PRIORITY_SCHEDULING : c_int = 61;
|
||||
pub const _SC_REALTIME_SIGNALS : c_int = 64;
|
||||
pub const _SC_RTSIG_MAX : c_int = 66;
|
||||
pub const _SC_SEMAPHORES : c_int = 67;
|
||||
pub const _SC_SHARED_MEMORY_OBJECTS : c_int = 68;
|
||||
pub const _SC_SIGQUEUE_MAX : c_int = 70;
|
||||
pub const _SC_SYNCHRONIZED_IO : c_int = 75;
|
||||
pub const _SC_TIMER_MAX : c_int = 93;
|
||||
pub const _SC_TIMERS : c_int = 94;
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "macos", target_os = "ios"))]
|
||||
pub mod os {
|
||||
pub mod c95 {
|
||||
use types::os::arch::c95::{c_int, c_uint};
|
||||
@ -5000,6 +5395,7 @@ pub mod funcs {
|
||||
target_os = "ios",
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
pub mod posix88 {
|
||||
pub mod stat_ {
|
||||
@ -5014,6 +5410,7 @@ pub mod funcs {
|
||||
#[cfg(any(target_os = "linux",
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd",
|
||||
target_os = "android",
|
||||
target_os = "ios"))]
|
||||
@ -5029,6 +5426,7 @@ pub mod funcs {
|
||||
#[cfg(any(target_os = "linux",
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd",
|
||||
target_os = "android",
|
||||
target_os = "ios"))]
|
||||
@ -5223,6 +5621,7 @@ pub mod funcs {
|
||||
target_os = "ios",
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
pub mod posix01 {
|
||||
pub mod stat_ {
|
||||
@ -5233,6 +5632,7 @@ pub mod funcs {
|
||||
#[cfg(any(target_os = "linux",
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd",
|
||||
target_os = "android",
|
||||
target_os = "ios"))]
|
||||
@ -5342,6 +5742,7 @@ pub mod funcs {
|
||||
target_os = "ios",
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
pub mod posix08 {
|
||||
pub mod unistd {
|
||||
@ -5429,6 +5830,7 @@ pub mod funcs {
|
||||
target_os = "ios",
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
pub mod bsd44 {
|
||||
use types::common::c95::{c_void};
|
||||
@ -5458,10 +5860,11 @@ pub mod funcs {
|
||||
-> c_int;
|
||||
pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_uchar)
|
||||
-> c_int;
|
||||
pub fn realpath(pathname: *const c_char, resolved: *mut c_char)
|
||||
-> *mut c_char;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
pub mod bsd44 {
|
||||
use types::common::c95::{c_void};
|
||||
@ -5494,6 +5897,7 @@ pub mod funcs {
|
||||
|
||||
#[cfg(any(target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
pub mod extra {
|
||||
}
|
||||
|
@ -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::OsOpenbsd => {
|
||||
abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig | 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\
|
||||
|
@ -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::OsOpenbsd => {
|
||||
abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig | 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\
|
||||
|
@ -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::OsOpenbsd => {
|
||||
abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig | 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\
|
||||
|
@ -215,6 +215,7 @@ mod test {
|
||||
#[test]
|
||||
#[cfg(any(target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
fn test_rpath_relative() {
|
||||
let config = &mut RPathConfig {
|
||||
|
28
src/librustc_back/target/bitrig_base.rs
Normal file
28
src/librustc_back/target/bitrig_base.rs
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright 2014 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,
|
||||
position_independent_executables: true,
|
||||
pre_link_args: vec!(
|
||||
),
|
||||
|
||||
.. Default::default()
|
||||
}
|
||||
}
|
@ -56,6 +56,7 @@ mod apple_base;
|
||||
mod apple_ios_base;
|
||||
mod freebsd_base;
|
||||
mod dragonfly_base;
|
||||
mod bitrig_base;
|
||||
mod openbsd_base;
|
||||
|
||||
mod armv7_apple_ios;
|
||||
@ -80,6 +81,7 @@ mod x86_64_apple_ios;
|
||||
mod x86_64_pc_windows_gnu;
|
||||
mod x86_64_unknown_freebsd;
|
||||
mod x86_64_unknown_dragonfly;
|
||||
mod x86_64_unknown_bitrig;
|
||||
mod x86_64_unknown_linux_gnu;
|
||||
mod x86_64_unknown_openbsd;
|
||||
|
||||
@ -355,6 +357,7 @@ impl Target {
|
||||
i686_unknown_dragonfly,
|
||||
x86_64_unknown_dragonfly,
|
||||
|
||||
x86_64_unknown_bitrig,
|
||||
x86_64_unknown_openbsd,
|
||||
|
||||
x86_64_apple_darwin,
|
||||
|
28
src/librustc_back/target/x86_64_unknown_bitrig.rs
Normal file
28
src/librustc_back/target/x86_64_unknown_bitrig.rs
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright 2014 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::bitrig_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-a0:0:64-\
|
||||
s0:64:64-f80:128:128-n8:16:32:64-S128".to_string(),
|
||||
llvm_target: "x86_64-unknown-bitrig".to_string(),
|
||||
target_endian: "little".to_string(),
|
||||
target_pointer_width: "64".to_string(),
|
||||
arch: "x86_64".to_string(),
|
||||
target_os: "bitrig".to_string(),
|
||||
options: base,
|
||||
}
|
||||
}
|
@ -45,10 +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 => {
|
||||
"e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string()
|
||||
}
|
||||
abi::OsDragonfly => {
|
||||
abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig => {
|
||||
"e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string()
|
||||
}
|
||||
abi::OsOpenbsd => {
|
||||
|
@ -47,12 +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 => {
|
||||
"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()
|
||||
}
|
||||
abi::OsDragonfly => {
|
||||
abi::OsFreebsd | abi::OsDragonfly | abi::OsBitrig => {
|
||||
"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()
|
||||
|
@ -64,7 +64,9 @@ mod imp {
|
||||
pub const F_SETLKW: libc::c_int = 13;
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "dragonfly", target_os = "openbsd"))]
|
||||
#[cfg(any(target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
mod os {
|
||||
use libc;
|
||||
|
||||
|
@ -165,6 +165,7 @@ mod test {
|
||||
target_os = "macos",
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
fn test_errors_do_not_crash() {
|
||||
// Open /dev/null as a library to get an error, and make sure
|
||||
@ -183,6 +184,7 @@ mod test {
|
||||
target_os = "ios",
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
mod dl {
|
||||
use prelude::v1::*;
|
||||
|
@ -562,6 +562,38 @@ pub mod consts {
|
||||
pub const EXE_EXTENSION: &'static str = "";
|
||||
}
|
||||
|
||||
/// Constants associated with the current target
|
||||
#[cfg(target_os = "bitrig")]
|
||||
pub mod consts {
|
||||
pub use super::arch_consts::ARCH;
|
||||
|
||||
pub const FAMILY: &'static str = "unix";
|
||||
|
||||
/// A string describing the specific operating system in use: in this
|
||||
/// case, `bitrig`.
|
||||
pub const OS: &'static str = "bitrig";
|
||||
|
||||
/// Specifies the filename prefix used for shared libraries on this
|
||||
/// platform: in this case, `lib`.
|
||||
pub const DLL_PREFIX: &'static str = "lib";
|
||||
|
||||
/// Specifies the filename suffix used for shared libraries on this
|
||||
/// platform: in this case, `.so`.
|
||||
pub const DLL_SUFFIX: &'static str = ".so";
|
||||
|
||||
/// Specifies the file extension used for shared libraries on this
|
||||
/// platform that goes after the dot: in this case, `so`.
|
||||
pub const DLL_EXTENSION: &'static str = "so";
|
||||
|
||||
/// Specifies the filename suffix used for executable binaries on this
|
||||
/// platform: in this case, the empty string.
|
||||
pub const EXE_SUFFIX: &'static str = "";
|
||||
|
||||
/// Specifies the file extension, if any, used for executable binaries
|
||||
/// on this platform: in this case, the empty string.
|
||||
pub const EXE_EXTENSION: &'static str = "";
|
||||
}
|
||||
|
||||
/// Constants associated with the current target
|
||||
#[cfg(target_os = "openbsd")]
|
||||
pub mod consts {
|
||||
@ -570,7 +602,7 @@ pub mod consts {
|
||||
pub const FAMILY: &'static str = "unix";
|
||||
|
||||
/// A string describing the specific operating system in use: in this
|
||||
/// case, `dragonfly`.
|
||||
/// case, `openbsd`.
|
||||
pub const OS: &'static str = "openbsd";
|
||||
|
||||
/// Specifies the filename prefix used for shared libraries on this
|
||||
|
@ -639,6 +639,7 @@ fn real_args_as_bytes() -> Vec<Vec<u8>> {
|
||||
target_os = "android",
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
fn real_args_as_bytes() -> Vec<Vec<u8>> {
|
||||
use rt;
|
||||
@ -1287,6 +1288,39 @@ pub mod consts {
|
||||
pub const EXE_EXTENSION: &'static str = "";
|
||||
}
|
||||
|
||||
#[cfg(target_os = "bitrig")]
|
||||
#[deprecated(since = "1.0.0", reason = "renamed to env::consts")]
|
||||
#[unstable(feature = "os")]
|
||||
pub mod consts {
|
||||
pub use os::arch_consts::ARCH;
|
||||
|
||||
pub const FAMILY: &'static str = "unix";
|
||||
|
||||
/// A string describing the specific operating system in use: in this
|
||||
/// case, `bitrig`.
|
||||
pub const SYSNAME: &'static str = "bitrig";
|
||||
|
||||
/// Specifies the filename prefix used for shared libraries on this
|
||||
/// platform: in this case, `lib`.
|
||||
pub const DLL_PREFIX: &'static str = "lib";
|
||||
|
||||
/// Specifies the filename suffix used for shared libraries on this
|
||||
/// platform: in this case, `.so`.
|
||||
pub const DLL_SUFFIX: &'static str = ".so";
|
||||
|
||||
/// Specifies the file extension used for shared libraries on this
|
||||
/// platform that goes after the dot: in this case, `so`.
|
||||
pub const DLL_EXTENSION: &'static str = "so";
|
||||
|
||||
/// Specifies the filename suffix used for executable binaries on this
|
||||
/// platform: in this case, the empty string.
|
||||
pub const EXE_SUFFIX: &'static str = "";
|
||||
|
||||
/// Specifies the file extension, if any, used for executable binaries
|
||||
/// on this platform: in this case, the empty string.
|
||||
pub const EXE_EXTENSION: &'static str = "";
|
||||
}
|
||||
|
||||
#[cfg(target_os = "openbsd")]
|
||||
#[deprecated(since = "1.0.0", reason = "renamed to env::consts")]
|
||||
#[unstable(feature = "os")]
|
||||
|
@ -43,6 +43,7 @@ pub fn clone() -> Option<Vec<Vec<u8>>> { imp::clone() }
|
||||
target_os = "android",
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
mod imp {
|
||||
use prelude::v1::*;
|
||||
|
@ -109,6 +109,10 @@ extern {}
|
||||
#[link(name = "gcc_pic")]
|
||||
extern {}
|
||||
|
||||
#[cfg(target_os = "bitrig")]
|
||||
#[link(name = "c++abi")]
|
||||
extern {}
|
||||
|
||||
extern "C" {
|
||||
// iOS on armv7 uses SjLj exceptions and requires to link
|
||||
// against corresponding routine (..._SjLj_...)
|
||||
|
@ -39,7 +39,9 @@ extern {}
|
||||
#[link(name = "pthread")]
|
||||
extern {}
|
||||
|
||||
#[cfg(any(target_os = "dragonfly", target_os = "openbsd"))]
|
||||
#[cfg(any(target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
#[link(name = "pthread")]
|
||||
extern {}
|
||||
|
||||
|
@ -689,7 +689,8 @@ impl TcpStream {
|
||||
setsockopt(self.fd(), libc::IPPROTO_TCP, libc::TCP_KEEPALIVE,
|
||||
seconds as libc::c_int)
|
||||
}
|
||||
#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
|
||||
#[cfg(any(target_os = "freebsd",
|
||||
target_os = "dragonfly"))]
|
||||
fn set_tcp_keepalive(&mut self, seconds: uint) -> IoResult<()> {
|
||||
setsockopt(self.fd(), libc::IPPROTO_TCP, libc::TCP_KEEPIDLE,
|
||||
seconds as libc::c_int)
|
||||
|
@ -189,11 +189,18 @@ pub unsafe fn record_sp_limit(limit: uint) {
|
||||
unsafe fn target_record_sp_limit(limit: uint) {
|
||||
asm!("movq $0, %fs:24" :: "r"(limit) :: "volatile")
|
||||
}
|
||||
#[cfg(all(target_arch = "x86_64", target_os = "dragonfly"))] #[inline(always)]
|
||||
#[cfg(all(target_arch = "x86_64", target_os = "dragonfly"))]
|
||||
#[inline(always)]
|
||||
unsafe fn target_record_sp_limit(limit: uint) {
|
||||
asm!("movq $0, %fs:32" :: "r"(limit) :: "volatile")
|
||||
}
|
||||
|
||||
#[cfg(target_os = "bitrig")]
|
||||
#[inline(always)]
|
||||
unsafe fn target_record_sp_limit(_: uint) {
|
||||
// segmented stacks are disabled
|
||||
}
|
||||
|
||||
// x86
|
||||
#[cfg(all(target_arch = "x86",
|
||||
any(target_os = "macos", target_os = "ios")))]
|
||||
@ -276,12 +283,18 @@ pub unsafe fn get_sp_limit() -> uint {
|
||||
asm!("movq %fs:24, $0" : "=r"(limit) ::: "volatile");
|
||||
return limit;
|
||||
}
|
||||
#[cfg(all(target_arch = "x86_64", target_os = "dragonfly"))] #[inline(always)]
|
||||
#[cfg(all(target_arch = "x86_64", target_os = "dragonfly"))]
|
||||
#[inline(always)]
|
||||
unsafe fn target_get_sp_limit() -> uint {
|
||||
let limit;
|
||||
asm!("movq %fs:32, $0" : "=r"(limit) ::: "volatile");
|
||||
return limit;
|
||||
}
|
||||
#[cfg(target_os = "bitrig")]
|
||||
#[inline(always)]
|
||||
unsafe fn target_get_sp_limit() -> uint {
|
||||
return 2048;
|
||||
}
|
||||
|
||||
|
||||
// x86
|
||||
|
@ -319,6 +319,7 @@ fn print(w: &mut Writer, idx: int, addr: *mut libc::c_void) -> IoResult<()> {
|
||||
if !STATE.is_null() { return STATE }
|
||||
let selfname = if cfg!(target_os = "freebsd") ||
|
||||
cfg!(target_os = "dragonfly") ||
|
||||
cfg!(target_os = "bitrig") ||
|
||||
cfg!(target_os = "openbsd") {
|
||||
env::current_exe().ok()
|
||||
} else {
|
||||
|
@ -24,6 +24,7 @@ use libc;
|
||||
target_os = "ios",
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
pub const FIONBIO: libc::c_ulong = 0x8004667e;
|
||||
#[cfg(any(all(target_os = "linux",
|
||||
@ -43,6 +44,7 @@ pub const FIONBIO: libc::c_ulong = 0x667e;
|
||||
target_os = "ios",
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
pub const FIOCLEX: libc::c_ulong = 0x20006601;
|
||||
#[cfg(any(all(target_os = "linux",
|
||||
@ -62,6 +64,7 @@ pub const FIOCLEX: libc::c_ulong = 0x6601;
|
||||
target_os = "ios",
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
pub const MSG_DONTWAIT: libc::c_int = 0x80;
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
@ -75,7 +78,8 @@ pub const _SC_GETPW_R_SIZE_MAX: libc::c_int = 70;
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly"))]
|
||||
pub const _SC_GETPW_R_SIZE_MAX: libc::c_int = 71;
|
||||
#[cfg(target_os = "openbsd")]
|
||||
#[cfg(any(target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
pub const _SC_GETPW_R_SIZE_MAX: libc::c_int = 101;
|
||||
#[cfg(target_os = "android")]
|
||||
pub const _SC_GETPW_R_SIZE_MAX: libc::c_int = 0x0048;
|
||||
@ -96,6 +100,7 @@ pub struct passwd {
|
||||
#[cfg(any(target_os = "macos",
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
pub struct passwd {
|
||||
pub pw_name: *mut libc::c_char,
|
||||
@ -176,6 +181,7 @@ mod select {
|
||||
#[cfg(any(target_os = "android",
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd",
|
||||
target_os = "linux"))]
|
||||
mod select {
|
||||
@ -344,3 +350,41 @@ mod signal {
|
||||
pub sa_mask: sigset_t,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "bitrig")]
|
||||
mod signal {
|
||||
use libc;
|
||||
|
||||
pub const SA_ONSTACK: libc::c_int = 0x0001;
|
||||
pub const SA_RESTART: libc::c_int = 0x0002;
|
||||
pub const SA_RESETHAND: libc::c_int = 0x0004;
|
||||
pub const SA_NOCLDSTOP: libc::c_int = 0x0008;
|
||||
pub const SA_NODEFER: libc::c_int = 0x0010;
|
||||
pub const SA_NOCLDWAIT: libc::c_int = 0x0020;
|
||||
pub const SA_SIGINFO: libc::c_int = 0x0040;
|
||||
pub const SIGCHLD: libc::c_int = 20;
|
||||
|
||||
pub type sigset_t = libc::c_uint;
|
||||
|
||||
// This structure has more fields, but we're not all that interested in
|
||||
// them.
|
||||
#[repr(C)]
|
||||
pub struct siginfo {
|
||||
pub si_signo: libc::c_int,
|
||||
pub si_code: libc::c_int,
|
||||
pub si_errno: libc::c_int,
|
||||
// FIXME: Bitrig has a crazy union here in the siginfo, I think this
|
||||
// layout will still work tho. The status might be off by the size of
|
||||
// a clock_t by my reading, but we can fix this later.
|
||||
pub pid: libc::pid_t,
|
||||
pub uid: libc::uid_t,
|
||||
pub status: libc::c_int,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct sigaction {
|
||||
pub sa_handler: extern fn(libc::c_int),
|
||||
pub sa_mask: sigset_t,
|
||||
pub sa_flags: libc::c_int,
|
||||
}
|
||||
}
|
||||
|
@ -291,6 +291,33 @@ fn mkstat(stat: &libc::stat) -> FileStat {
|
||||
// FileStat times are in milliseconds
|
||||
fn mktime(secs: u64, nsecs: u64) -> u64 { secs * 1000 + nsecs / 1000000 }
|
||||
|
||||
#[cfg(target_os = "bitrig")]
|
||||
fn ctime(stat: &libc::stat) -> u64 {
|
||||
mktime(stat.st_ctim.tv_sec as u64, stat.st_ctim.tv_nsec as u64)
|
||||
}
|
||||
#[cfg(not(target_os = "bitrig"))]
|
||||
fn ctime(stat: &libc::stat) -> u64 {
|
||||
mktime(stat.st_ctime as u64, stat.st_ctime_nsec as u64)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "bitrig")]
|
||||
fn atime(stat: &libc::stat) -> u64 {
|
||||
mktime(stat.st_atim.tv_sec as u64, stat.st_atim.tv_nsec as u64)
|
||||
}
|
||||
#[cfg(not(target_os = "bitrig"))]
|
||||
fn atime(stat: &libc::stat) -> u64 {
|
||||
mktime(stat.st_atime as u64, stat.st_atime_nsec as u64)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "bitrig")]
|
||||
fn mtime(stat: &libc::stat) -> u64 {
|
||||
mktime(stat.st_mtim.tv_sec as u64, stat.st_mtim.tv_nsec as u64)
|
||||
}
|
||||
#[cfg(not(target_os = "bitrig"))]
|
||||
fn mtime(stat: &libc::stat) -> u64 {
|
||||
mktime(stat.st_mtime as u64, stat.st_mtime_nsec as u64)
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os = "linux", target_os = "android")))]
|
||||
fn flags(stat: &libc::stat) -> u64 { stat.st_flags as u64 }
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
@ -312,9 +339,9 @@ fn mkstat(stat: &libc::stat) -> FileStat {
|
||||
_ => old_io::FileType::Unknown,
|
||||
},
|
||||
perm: FilePermission::from_bits_truncate(stat.st_mode as u32),
|
||||
created: mktime(stat.st_ctime as u64, stat.st_ctime_nsec as u64),
|
||||
modified: mktime(stat.st_mtime as u64, stat.st_mtime_nsec as u64),
|
||||
accessed: mktime(stat.st_atime as u64, stat.st_atime_nsec as u64),
|
||||
created: ctime(stat),
|
||||
modified: mtime(stat),
|
||||
accessed: atime(stat),
|
||||
unstable: UnstableFileStat {
|
||||
device: stat.st_dev as u64,
|
||||
inode: stat.st_ino as u64,
|
||||
|
@ -40,6 +40,16 @@ pub fn errno() -> i32 {
|
||||
__error()
|
||||
}
|
||||
|
||||
#[cfg(target_os = "bitrig")]
|
||||
fn errno_location() -> *const c_int {
|
||||
extern {
|
||||
fn __errno() -> *const c_int;
|
||||
}
|
||||
unsafe {
|
||||
__errno()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "dragonfly")]
|
||||
unsafe fn errno_location() -> *const c_int {
|
||||
extern { fn __dfly_error() -> *const c_int; }
|
||||
@ -192,10 +202,9 @@ pub fn current_exe() -> IoResult<Path> {
|
||||
fs::readlink(&Path::new("/proc/curproc/file"))
|
||||
}
|
||||
|
||||
#[cfg(target_os = "openbsd")]
|
||||
#[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
|
||||
pub fn current_exe() -> IoResult<Path> {
|
||||
use sync::{StaticMutex, MUTEX_INIT};
|
||||
|
||||
static LOCK: StaticMutex = MUTEX_INIT;
|
||||
|
||||
extern {
|
||||
@ -330,6 +339,7 @@ pub fn args() -> Args {
|
||||
target_os = "android",
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
pub fn args() -> Args {
|
||||
use rt;
|
||||
|
@ -593,6 +593,7 @@ fn translate_status(status: c_int) -> ProcessExit {
|
||||
target_os = "ios",
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
mod imp {
|
||||
pub fn WIFEXITED(status: i32) -> bool { (status & 0x7f) == 0 }
|
||||
|
@ -34,6 +34,7 @@ impl Drop for Handler {
|
||||
|
||||
#[cfg(any(target_os = "linux",
|
||||
target_os = "macos",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
mod imp {
|
||||
use core::prelude::*;
|
||||
@ -205,7 +206,9 @@ mod imp {
|
||||
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "macos", target_os = "openbsd"))]
|
||||
#[cfg(any(target_os = "macos",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
mod signal {
|
||||
use libc;
|
||||
use super::sighandler_t;
|
||||
@ -219,6 +222,9 @@ mod imp {
|
||||
#[cfg(target_os = "openbsd")]
|
||||
pub const SIGSTKSZ: libc::size_t = 40960;
|
||||
|
||||
#[cfg(target_os = "bitrig")]
|
||||
pub const SIGSTKSZ: libc::size_t = 40960;
|
||||
|
||||
pub const SIG_DFL: sighandler_t = 0 as sighandler_t;
|
||||
|
||||
pub type sigset_t = u32;
|
||||
@ -237,14 +243,14 @@ mod imp {
|
||||
pub si_addr: *mut libc::c_void
|
||||
}
|
||||
|
||||
#[cfg(target_os = "openbsd")]
|
||||
#[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
|
||||
#[repr(C)]
|
||||
pub struct siginfo {
|
||||
pub si_signo: libc::c_int,
|
||||
pub si_code: libc::c_int,
|
||||
pub si_errno: libc::c_int,
|
||||
// union
|
||||
pub si_addr: *mut libc::c_void,
|
||||
//union
|
||||
pub si_addr: *mut libc::c_void
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
@ -277,6 +283,7 @@ mod imp {
|
||||
|
||||
#[cfg(not(any(target_os = "linux",
|
||||
target_os = "macos",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd")))]
|
||||
mod imp {
|
||||
use libc;
|
||||
|
@ -46,6 +46,7 @@ extern {
|
||||
|
||||
#[cfg(any(target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
mod os {
|
||||
use libc;
|
||||
|
@ -33,6 +33,7 @@ pub extern fn thread_start(main: *mut libc::c_void) -> rust_thread_return {
|
||||
|
||||
#[cfg(all(not(target_os = "linux"),
|
||||
not(target_os = "macos"),
|
||||
not(target_os = "bitrig"),
|
||||
not(target_os = "openbsd")))]
|
||||
pub mod guard {
|
||||
pub unsafe fn current() -> uint {
|
||||
@ -50,11 +51,13 @@ pub mod guard {
|
||||
|
||||
#[cfg(any(target_os = "linux",
|
||||
target_os = "macos",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
pub mod guard {
|
||||
use super::*;
|
||||
#[cfg(any(target_os = "linux",
|
||||
target_os = "android",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
use mem;
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
@ -71,7 +74,9 @@ pub mod guard {
|
||||
static mut PAGE_SIZE: uint = 0;
|
||||
static mut GUARD_PAGE: uint = 0;
|
||||
|
||||
#[cfg(any(target_os = "macos", target_os = "openbsd"))]
|
||||
#[cfg(any(target_os = "macos",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
unsafe fn get_stack_start() -> *mut libc::c_void {
|
||||
current() as *mut libc::c_void
|
||||
}
|
||||
@ -189,6 +194,22 @@ pub mod guard {
|
||||
|
||||
stackaddr as uint + guardsize as uint
|
||||
}
|
||||
|
||||
#[cfg(target_os = "bitrig")]
|
||||
pub unsafe fn current() -> uint {
|
||||
let mut current_stack: stack_t = mem::zeroed();
|
||||
if pthread_stackseg_np(pthread_self(), &mut current_stack) != 0 {
|
||||
panic!("failed to get current stack: pthread_stackseg_np")
|
||||
}
|
||||
|
||||
if pthread_main_np() == 1 {
|
||||
// main thread
|
||||
current_stack.ss_sp as uint - current_stack.ss_size as uint + 3 * PAGE_SIZE as uint
|
||||
} else {
|
||||
// new thread
|
||||
current_stack.ss_sp as uint - current_stack.ss_size as uint
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub unsafe fn create(stack: uint, p: Thunk) -> rust_thread {
|
||||
@ -250,6 +271,7 @@ pub unsafe fn set_name(name: &str) {
|
||||
|
||||
#[cfg(any(target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
pub unsafe fn set_name(name: &str) {
|
||||
// pthread_set_name_np() since almost forever on all BSDs
|
||||
@ -332,6 +354,15 @@ extern {
|
||||
fn pthread_setname_np(name: *const libc::c_char) -> libc::c_int;
|
||||
}
|
||||
|
||||
#[cfg(target_os = "bitrig")]
|
||||
extern {
|
||||
pub fn pthread_self() -> libc::pthread_t;
|
||||
pub fn pthread_stackseg_np(thread: libc::pthread_t,
|
||||
sinfo: *mut stack_t) -> libc::c_uint;
|
||||
pub fn pthread_main_np() -> libc::c_uint;
|
||||
fn pthread_set_name_np(tid: libc::pthread_t, name: *const libc::c_char);
|
||||
}
|
||||
|
||||
#[cfg(target_os = "openbsd")]
|
||||
extern {
|
||||
pub fn pthread_stackseg_np(thread: libc::pthread_t,
|
||||
@ -339,7 +370,7 @@ extern {
|
||||
pub fn pthread_main_np() -> libc::c_uint;
|
||||
}
|
||||
|
||||
#[cfg(target_os = "openbsd")]
|
||||
#[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
|
||||
#[repr(C)]
|
||||
pub struct stack_t {
|
||||
pub ss_sp: *mut libc::c_void,
|
||||
|
@ -43,6 +43,7 @@ type pthread_key_t = ::libc::c_ulong;
|
||||
|
||||
#[cfg(any(target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
type pthread_key_t = ::libc::c_int;
|
||||
|
||||
@ -50,6 +51,7 @@ type pthread_key_t = ::libc::c_int;
|
||||
target_os = "ios",
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd")))]
|
||||
type pthread_key_t = ::libc::c_uint;
|
||||
|
||||
|
@ -80,8 +80,11 @@ mod inner {
|
||||
}
|
||||
|
||||
// Apparently android provides this in some other library?
|
||||
// Bitrig's RT extensions are in the C library, not a separate librt
|
||||
// OpenBSD provide it via libc
|
||||
#[cfg(not(any(target_os = "android", target_os = "openbsd")))]
|
||||
#[cfg(not(any(target_os = "android",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd")))]
|
||||
#[link(name = "rt")]
|
||||
extern {}
|
||||
|
||||
|
@ -22,6 +22,7 @@ pub struct TTY {
|
||||
|
||||
#[cfg(any(target_os = "macos",
|
||||
target_os = "freebsd",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
const TIOCGWINSZ: c_ulong = 0x40087468;
|
||||
|
||||
@ -55,6 +56,7 @@ impl TTY {
|
||||
target_os = "android",
|
||||
target_os = "macos",
|
||||
target_os = "freebsd",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd"))]
|
||||
pub fn get_winsize(&mut self) -> IoResult<(int, int)> {
|
||||
unsafe {
|
||||
|
@ -24,6 +24,7 @@ pub enum Os {
|
||||
OsFreebsd,
|
||||
OsiOS,
|
||||
OsDragonfly,
|
||||
OsBitrig,
|
||||
OsOpenbsd,
|
||||
}
|
||||
|
||||
@ -136,6 +137,7 @@ impl fmt::Display for Os {
|
||||
OsAndroid => "android".fmt(f),
|
||||
OsFreebsd => "freebsd".fmt(f),
|
||||
OsDragonfly => "dragonfly".fmt(f),
|
||||
OsBitrig => "bitrig".fmt(f),
|
||||
OsOpenbsd => "openbsd".fmt(f),
|
||||
}
|
||||
}
|
||||
|
@ -15,13 +15,13 @@
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#define EXHAUSTED _rust_stack_exhausted
|
||||
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__Bitrig__)
|
||||
#define EXHAUSTED rust_stack_exhausted@PLT
|
||||
#else
|
||||
#define EXHAUSTED rust_stack_exhausted
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__Bitrig__)
|
||||
.hidden MORESTACK
|
||||
#else
|
||||
#if defined(__APPLE__)
|
||||
|
@ -47,8 +47,8 @@ extern char **environ;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__linux__) || defined(__ANDROID__) \
|
||||
|| defined(__DragonFly__) || defined(__OpenBSD__)
|
||||
#if defined(__FreeBSD__) || defined(__linux__) || defined(__ANDROID__) || \
|
||||
defined(__DragonFly__) || defined(__Bitrig__) || defined(__OpenBSD__)
|
||||
extern char **environ;
|
||||
#endif
|
||||
|
||||
@ -200,7 +200,282 @@ rust_unset_sigprocmask() {
|
||||
int *__dfly_error(void) { return __error(); }
|
||||
#endif
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
#if defined(__Bitrig__)
|
||||
#include <stdio.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <limits.h>
|
||||
|
||||
int rust_get_path(void *p, size_t* sz)
|
||||
{
|
||||
int mib[4];
|
||||
char *eq = NULL;
|
||||
char *key = NULL;
|
||||
char *val = NULL;
|
||||
char **menv = NULL;
|
||||
size_t maxlen, len;
|
||||
int nenv = 0;
|
||||
int i;
|
||||
|
||||
if ((p == NULL) && (sz == NULL))
|
||||
return -1;
|
||||
|
||||
/* get the argv array */
|
||||
mib[0] = CTL_KERN;
|
||||
mib[1] = KERN_PROC_ARGS;
|
||||
mib[2] = getpid();
|
||||
mib[3] = KERN_PROC_ENV;
|
||||
|
||||
/* get the number of bytes needed to get the env */
|
||||
maxlen = 0;
|
||||
if (sysctl(mib, 4, NULL, &maxlen, NULL, 0) == -1)
|
||||
return -1;
|
||||
|
||||
/* allocate the buffer */
|
||||
if ((menv = calloc(maxlen, sizeof(char))) == NULL)
|
||||
return -1;
|
||||
|
||||
/* get the env array */
|
||||
if (sysctl(mib, 4, menv, &maxlen, NULL, 0) == -1)
|
||||
{
|
||||
free(menv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
mib[3] = KERN_PROC_NENV;
|
||||
len = sizeof(int);
|
||||
/* get the length of env array */
|
||||
if (sysctl(mib, 4, &nenv, &len, NULL, 0) == -1)
|
||||
{
|
||||
free(menv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* find _ key and resolve the value */
|
||||
for (i = 0; i < nenv; i++)
|
||||
{
|
||||
if ((eq = strstr(menv[i], "=")) == NULL)
|
||||
continue;
|
||||
|
||||
key = menv[i];
|
||||
val = eq + 1;
|
||||
*eq = '\0';
|
||||
|
||||
if (strncmp(key, "PATH", maxlen) != 0)
|
||||
continue;
|
||||
|
||||
if (p == NULL)
|
||||
{
|
||||
/* return the length of the value + NUL */
|
||||
*sz = strnlen(val, maxlen) + 1;
|
||||
free(menv);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* copy *sz bytes to the output buffer */
|
||||
memcpy(p, val, *sz);
|
||||
free(menv);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
free(menv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int rust_get_path_array(void * p, size_t * sz)
|
||||
{
|
||||
char *path, *str;
|
||||
char **buf;
|
||||
int i, num;
|
||||
size_t len;
|
||||
|
||||
if ((p == NULL) && (sz == NULL))
|
||||
return -1;
|
||||
|
||||
/* get the length of the PATH value */
|
||||
if (rust_get_path(NULL, &len) == -1)
|
||||
return -1;
|
||||
|
||||
if (len == 0)
|
||||
return -1;
|
||||
|
||||
/* allocate the buffer */
|
||||
if ((path = calloc(len, sizeof(char))) == NULL)
|
||||
return -1;
|
||||
|
||||
/* get the PATH value */
|
||||
if (rust_get_path(path, &len) == -1)
|
||||
{
|
||||
free(path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* count the number of parts in the PATH */
|
||||
num = 1;
|
||||
for(str = path; *str != '\0'; str++)
|
||||
{
|
||||
if (*str == ':')
|
||||
num++;
|
||||
}
|
||||
|
||||
/* calculate the size of the buffer for the 2D array */
|
||||
len = (num * sizeof(char*) + 1) + strlen(path) + 1;
|
||||
|
||||
if (p == NULL)
|
||||
{
|
||||
free(path);
|
||||
*sz = len;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* make sure we have enough buffer space */
|
||||
if (*sz < len)
|
||||
{
|
||||
free(path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* zero out the buffer */
|
||||
buf = (char**)p;
|
||||
memset(buf, 0, *sz);
|
||||
|
||||
/* copy the data into the right place */
|
||||
str = p + ((num+1) * sizeof(char*));
|
||||
memcpy(str, path, strlen(path));
|
||||
|
||||
/* parse the path into it's parts */
|
||||
for (i = 0; i < num && (buf[i] = strsep(&str, ":")) != NULL; i++) {;}
|
||||
buf[num] = NULL;
|
||||
|
||||
free(path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rust_get_argv_zero(void* p, size_t* sz)
|
||||
{
|
||||
int mib[4];
|
||||
char **argv = NULL;
|
||||
size_t len;
|
||||
|
||||
if ((p == NULL) && (sz == NULL))
|
||||
return -1;
|
||||
|
||||
/* get the argv array */
|
||||
mib[0] = CTL_KERN;
|
||||
mib[1] = KERN_PROC_ARGS;
|
||||
mib[2] = getpid();
|
||||
mib[3] = KERN_PROC_ARGV;
|
||||
|
||||
/* request KERN_PROC_ARGV size */
|
||||
len = 0;
|
||||
if (sysctl(mib, 4, NULL, &len, NULL, 0) == -1)
|
||||
return -1;
|
||||
|
||||
/* allocate buffer to receive the values */
|
||||
if ((argv = malloc(len)) == NULL)
|
||||
return -1;
|
||||
|
||||
/* get the argv array */
|
||||
if (sysctl(mib, 4, argv, &len, NULL, 0) == -1)
|
||||
{
|
||||
free(argv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* get length of argv[0] */
|
||||
len = strnlen(argv[0], len) + 1;
|
||||
|
||||
if (p == NULL)
|
||||
{
|
||||
*sz = len;
|
||||
free(argv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (*sz < len)
|
||||
{
|
||||
free(argv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(p, 0, len);
|
||||
memcpy(p, argv[0], len);
|
||||
free(argv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char * rust_load_self()
|
||||
{
|
||||
static char *self = NULL;
|
||||
char *argv0;
|
||||
char **paths;
|
||||
size_t sz;
|
||||
int i;
|
||||
char buf[2*PATH_MAX], exe[2*PATH_MAX];
|
||||
|
||||
if (self != NULL)
|
||||
return self;
|
||||
|
||||
if (rust_get_argv_zero(NULL, &sz) == -1)
|
||||
return NULL;
|
||||
if ((argv0 = calloc(sz, sizeof(char))) == NULL)
|
||||
return NULL;
|
||||
if (rust_get_argv_zero(argv0, &sz) == -1)
|
||||
{
|
||||
free(argv0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* if argv0 is a relative or absolute path, resolve it with realpath */
|
||||
if ((*argv0 == '.') || (*argv0 == '/') || (strstr(argv0, "/") != NULL))
|
||||
{
|
||||
self = realpath(argv0, NULL);
|
||||
free(argv0);
|
||||
return self;
|
||||
}
|
||||
|
||||
/* get the path array */
|
||||
if (rust_get_path_array(NULL, &sz) == -1)
|
||||
{
|
||||
free(argv0);
|
||||
return NULL;
|
||||
}
|
||||
if ((paths = calloc(sz, sizeof(char))) == NULL)
|
||||
{
|
||||
free(argv0);
|
||||
return NULL;
|
||||
}
|
||||
if (rust_get_path_array(paths, &sz) == -1)
|
||||
{
|
||||
free(argv0);
|
||||
free(paths);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for(i = 0; paths[i] != NULL; i++)
|
||||
{
|
||||
snprintf(buf, 2*PATH_MAX, "%s/%s", paths[i], argv0);
|
||||
if (realpath(buf, exe) == NULL)
|
||||
continue;
|
||||
|
||||
if (access(exe, F_OK | X_OK) == -1)
|
||||
continue;
|
||||
|
||||
self = strdup(exe);
|
||||
free(argv0);
|
||||
free(paths);
|
||||
return self;
|
||||
}
|
||||
|
||||
free(argv0);
|
||||
free(paths);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#elif defined(__OpenBSD__)
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <limits.h>
|
||||
@ -248,6 +523,7 @@ const char * rust_current_exe() {
|
||||
|
||||
return (self);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
|
@ -26,6 +26,9 @@ mod hello;
|
||||
#[cfg(target_os = "dragonfly")]
|
||||
mod hello;
|
||||
|
||||
#[cfg(target_os = "bitrig")]
|
||||
mod hello;
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
mod hello;
|
||||
|
||||
|
@ -42,6 +42,18 @@ mod m {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "bitrig")]
|
||||
mod m {
|
||||
#[main]
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub fn main() {
|
||||
unsafe {
|
||||
assert_eq!(::rusti::pref_align_of::<u64>(), 8u);
|
||||
assert_eq!(::rusti::min_align_of::<u64>(), 8u);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
mod m {
|
||||
#[main]
|
||||
|
@ -37,7 +37,7 @@ extern {}
|
||||
#[link(name = "c")]
|
||||
extern {}
|
||||
|
||||
#[cfg(target_os = "openbsd")]
|
||||
#[cfg(any(target_os = "bitrig", target_os = "openbsd"))]
|
||||
#[link(name = "c")]
|
||||
extern {}
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
//ignore-freebsd
|
||||
//ignore-ios
|
||||
//ignore-dragonfly
|
||||
//ignore-bitrig
|
||||
|
||||
#![feature(asm)]
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
//ignore-freebsd
|
||||
//ignore-ios
|
||||
//ignore-dragonfly
|
||||
//ignore-bitrig
|
||||
|
||||
#![feature(asm)]
|
||||
|
||||
|
@ -55,6 +55,15 @@ mod m {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "bitrig")]
|
||||
mod m {
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub mod m {
|
||||
pub fn align() -> uint { 8u }
|
||||
pub fn size() -> uint { 16u }
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
mod m {
|
||||
#[cfg(target_arch = "x86")]
|
||||
|
@ -34,6 +34,7 @@ pub fn main() {
|
||||
target_os = "linux",
|
||||
target_os = "freebsd",
|
||||
target_os = "dragonfly",
|
||||
target_os = "bitrig",
|
||||
target_os = "openbsd",
|
||||
target_os = "android"))]
|
||||
pub fn main() { }
|
||||
|
Loading…
Reference in New Issue
Block a user