adding support for i686-unknown-freebsd target

This commit is contained in:
Dave Huseby 2015-07-10 16:48:59 -07:00
parent f7f28c8b26
commit 1a928f434a
5 changed files with 155 additions and 7 deletions

View File

@ -0,0 +1,22 @@
# i686-unknown-freebsd configuration
CC_i686-unknown-freebsd=$(CC)
CXX_i686-unknown-freebsd=$(CXX)
CPP_i686-unknown-freebsd=$(CPP)
AR_i686-unknown-freebsd=$(AR)
CFG_LIB_NAME_i686-unknown-freebsd=lib$(1).so
CFG_STATIC_LIB_NAME_i686-unknown-freebsd=lib$(1).a
CFG_LIB_GLOB_i686-unknown-freebsd=lib$(1)-*.so
CFG_LIB_DSYM_GLOB_i686-unknown-freebsd=$(1)-*.dylib.dSYM
CFG_JEMALLOC_CFLAGS_i686-unknown-freebsd := -m32 -arch i386 -I/usr/local/include $(CFLAGS)
CFG_GCCISH_CFLAGS_i686-unknown-freebsd := -Wall -Werror -g -fPIC -m32 -arch i386 -I/usr/local/include $(CFLAGS)
CFG_GCCISH_LINK_FLAGS_i686-unknown-freebsd := -m32 -shared -fPIC -g -pthread -lrt
CFG_GCCISH_DEF_FLAG_i686-unknown-freebsd := -Wl,--export-dynamic,--dynamic-list=
CFG_LLC_FLAGS_i686-unknown-freebsd :=
CFG_INSTALL_NAME_i686-unknown-freebsd =
CFG_EXE_SUFFIX_i686-unknown-freebsd :=
CFG_WINDOWSY_i686-unknown-freebsd :=
CFG_UNIXY_i686-unknown-freebsd := 1
CFG_LDPATH_i686-unknown-freebsd :=
CFG_RUN_i686-unknown-freebsd=$(2)
CFG_RUN_TARG_i686-unknown-freebsd=$(call CFG_RUN_i686-unknown-freebsd,,$(2))
CFG_GNU_TRIPLE_i686-unknown-freebsd := i686-unknown-freebsd

View File

@ -960,6 +960,100 @@ pub mod types {
}
}
#[cfg(target_arch = "x86")]
pub mod arch {
pub mod c95 {
pub type c_char = i8;
pub type c_schar = i8;
pub type c_uchar = u8;
pub type c_short = i16;
pub type c_ushort = u16;
pub type c_int = i32;
pub type c_uint = u32;
pub type c_long = i32;
pub type c_ulong = u32;
pub type c_float = f32;
pub type c_double = f64;
pub type size_t = u32;
pub type ptrdiff_t = i32;
pub type clock_t = i32;
pub type time_t = i32;
pub type suseconds_t = i32;
pub type wchar_t = i32;
}
pub mod c99 {
pub type c_longlong = i64;
pub type c_ulonglong = u64;
pub type intptr_t = i32;
pub type uintptr_t = u32;
pub type intmax_t = i64;
pub type uintmax_t = u64;
}
pub mod posix88 {
pub type off_t = i64;
pub type dev_t = u32;
pub type ino_t = u32;
pub type pid_t = i32;
pub type uid_t = u32;
pub type gid_t = u32;
pub type useconds_t = u32;
pub type mode_t = u16;
pub type ssize_t = i32;
}
pub mod posix01 {
use types::common::c95::{c_void};
use types::common::c99::{uint8_t, uint32_t, int32_t};
use types::os::arch::c95::{c_long, time_t};
use types::os::arch::posix88::{dev_t, gid_t, ino_t};
use types::os::arch::posix88::{mode_t, off_t};
use types::os::arch::posix88::{uid_t};
pub type nlink_t = u16;
pub type blksize_t = i32;
pub type blkcnt_t = i64;
pub type fflags_t = u32;
#[repr(C)]
#[derive(Copy, Clone)] pub struct stat {
pub st_dev: dev_t,
pub st_ino: ino_t,
pub st_mode: mode_t,
pub st_nlink: nlink_t,
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_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_lspare: int32_t,
pub st_birthtime: time_t,
pub st_birthtime_nsec: c_long,
pub __unused: [uint8_t; 2],
}
#[repr(C)]
#[derive(Copy, Clone)] pub struct utimbuf {
pub actime: time_t,
pub modtime: time_t,
}
pub type pthread_attr_t = *mut c_void;
}
pub mod posix08 {
}
pub mod bsd44 {
}
pub mod extra {
}
}
#[cfg(target_arch = "x86_64")]
pub mod arch {
pub mod c95 {

View File

@ -0,0 +1,29 @@
// 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::freebsd_base::opts();
base.cpu = "pentium4".to_string();
base.pre_link_args.push("-m32".to_string());
base.morestack = false;
Target {
data_layout: "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string(),
llvm_target: "i686-unknown-freebsd".to_string(),
target_endian: "little".to_string(),
target_pointer_width: "32".to_string(),
arch: "x86".to_string(),
target_os: "freebsd".to_string(),
target_env: "".to_string(),
options: base,
}
}

View File

@ -368,6 +368,7 @@ impl Target {
arm_linux_androideabi,
aarch64_linux_android,
i686_unknown_freebsd,
x86_64_unknown_freebsd,
i686_unknown_dragonfly,

View File

@ -170,8 +170,7 @@ pub unsafe fn record_sp_limit(limit: usize) {
asm!("movl $$0x48+90*4, %eax
movl $0, %gs:(%eax)" :: "r"(limit) : "eax" : "volatile")
}
#[cfg(all(target_arch = "x86",
any(target_os = "linux", target_os = "freebsd")))]
#[cfg(all(target_arch = "x86", target_os = "linux"))]
#[inline(always)]
unsafe fn target_record_sp_limit(limit: usize) {
asm!("movl $0, %gs:48" :: "r"(limit) :: "volatile")
@ -197,10 +196,12 @@ pub unsafe fn record_sp_limit(limit: usize) {
// aarch64 - FIXME(AARCH64): missing...
// powerpc - FIXME(POWERPC): missing...
// arm-ios - iOS segmented stack is disabled for now, see related notes
// openbsd - segmented stack is disabled
// openbsd/bitrig/netbsd - no segmented stacks.
// x86-freebsd - no segmented stacks.
#[cfg(any(target_arch = "aarch64",
target_arch = "powerpc",
all(target_arch = "arm", target_os = "ios"),
all(target_arch = "x86", target_os = "freebsd"),
target_os = "bitrig",
target_os = "netbsd",
target_os = "openbsd"))]
@ -262,8 +263,7 @@ pub unsafe fn get_sp_limit() -> usize {
movl %gs:(%eax), $0" : "=r"(limit) :: "eax" : "volatile");
return limit;
}
#[cfg(all(target_arch = "x86",
any(target_os = "linux", target_os = "freebsd")))]
#[cfg(all(target_arch = "x86", target_os = "linux"))]
#[inline(always)]
unsafe fn target_get_sp_limit() -> usize {
let limit;
@ -291,14 +291,16 @@ pub unsafe fn get_sp_limit() -> usize {
// aarch64 - FIXME(AARCH64): missing...
// powerpc - FIXME(POWERPC): missing...
// arm-ios - iOS doesn't support segmented stacks yet.
// openbsd - OpenBSD doesn't support segmented stacks.
// arm-ios - no segmented stacks.
// openbsd/bitrig/netbsd - no segmented stacks.
// x86-freebsd - no segmented stacks.
//
// This function might be called by runtime though
// so it is unsafe to unreachable, let's return a fixed constant.
#[cfg(any(target_arch = "aarch64",
target_arch = "powerpc",
all(target_arch = "arm", target_os = "ios"),
all(target_arch = "x86", target_os = "freebsd"),
target_os = "bitrig",
target_os = "netbsd",
target_os = "openbsd"))]