hack around on makefiles trying to get a 64 bit build

right now there are many temporary hacks, search for NDM to find them
This commit is contained in:
Niko Matsakis 2011-10-13 12:23:50 -07:00 committed by Brian Anderson
parent 020cd360e1
commit 8011e3fabb
47 changed files with 2396 additions and 57 deletions

49
src/comp/back/x86_64.rs Normal file
View file

@ -0,0 +1,49 @@
import lib::llvm::llvm;
import lib::llvm::llvm::ModuleRef;
import std::str;
import driver::session;
fn get_target_strs(target_os: session::os) -> target_strs::t {
ret {
module_asm: "",
meta_sect_name: alt target_os {
session::os_macos. { "__DATA,__note.rustc" }
session::os_win32. { ".note.rustc" }
session::os_linux. { ".note.rustc" }
},
data_layout: alt target_os {
session::os_macos. {
"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"
}
session::os_win32. {
"e-p:32:32-f64:64:64-i64:64:64-f80:32:32-n8:16:32" //NDM i386
}
session::os_linux. {
"e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32" //NDM i386
}
},
target_triple: alt target_os {
session::os_macos. { "x86_64-apple-darwin" }
session::os_win32. { "x86_64-pc-mingw32" }
session::os_linux. { "x86_64-unknown-linux-gnu" }
}
};
}
//
// Local Variables:
// mode: rust
// fill-column: 78;
// indent-tabs-mode: nil
// c-basic-offset: 4
// buffer-file-coding-system: utf-8-unix
// compile-command: "make -k -C $RBUILD 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
// End:
//

View file

@ -16,7 +16,7 @@ import std::map::mk_hashmap;
import std::option::{some, none};
import std::getopts::{optopt, optmulti, optflag, optflagopt, opt_present};
import back::link::output_type;
import back::x86;
import back::{x86, x86_64};
tag pp_mode { ppm_normal; ppm_expanded; ppm_typed; ppm_identified; }
@ -295,7 +295,7 @@ fn get_arch(triple: str) -> session::arch {
str::find(triple, "i786") >= 0 {
session::arch_x86
} else if str::find(triple, "x86_64") >= 0 {
session::arch_x64
session::arch_x86_64
} else if str::find(triple, "arm") >= 0 ||
str::find(triple, "xscale") >= 0 {
session::arch_arm
@ -307,12 +307,12 @@ fn build_target_config(sopts: @session::options) -> @session::config {
let arch = get_arch(sopts.target_triple);
let (int_type, uint_type, float_type) = alt arch {
session::arch_x86. {(ast::ty_i32, ast::ty_u32, ast::ty_f64)}
session::arch_x64. {(ast::ty_i64, ast::ty_u64, ast::ty_f64)}
session::arch_x86_64. {(ast::ty_i64, ast::ty_u64, ast::ty_f64)}
session::arch_arm. {(ast::ty_i32, ast::ty_u32, ast::ty_f64)}
};
let target_strs = alt arch {
session::arch_x86. {x86::get_target_strs(os)}
session::arch_x64. {x86::get_target_strs(os)}
session::arch_x86_64. {x86_64::get_target_strs(os)}
session::arch_arm. {x86::get_target_strs(os)}
};
let target_cfg: @session::config =

View file

@ -11,7 +11,7 @@ import back::target_strs;
tag os { os_win32; os_macos; os_linux; }
tag arch { arch_x86; arch_x64; arch_arm; }
tag arch { arch_x86; arch_x86_64; arch_arm; }
type config =
{os: os,

View file

@ -92,6 +92,7 @@ mod back {
mod abi;
mod upcall;
mod x86;
mod x86_64;
mod rpath;
mod target_strs;
}

View file

@ -9,43 +9,45 @@
# cd $RUST_DIR/src/rt
# rm -r libuv
# tar -xvf $LIBUV_DIR/libuv.tar.gz
# cd libuv
# mkdir build
# svn co http://gyp.googlecode.com/svn/trunk build/gyp
# cd ../../..
# ./src/etc/gyp-uv
# mkdir -p libuv/build
# svn co http://gyp.googlecode.com/svn/trunk libuv/build/gyp
# cd ../..
# ./src/etc/gyp_uv
set -e
cd `dirname $0`
cd ../..
args="--depth . -Dlibrary=static_library -Dtarget_arch=ia32"
for ARCH in ia32 x86_64
do
args="--depth . -Dlibrary=static_library -Dtarget_arch=$ARCH"
./src/rt/libuv/build/gyp/gyp src/rt/libuv/uv.gyp $args \
-f make-mac \
--generator-output mk/libuv/$ARCH/mac \
-DOS=mac
./src/rt/libuv/build/gyp/gyp src/rt/libuv/uv.gyp $args \
-f make-mac \
--generator-output mk/libuv/mac \
-DOS=mac
./src/rt/libuv/build/gyp/gyp src/rt/libuv/uv.gyp $args \
-f make-linux \
--generator-output mk/libuv/$ARCH/unix \
-DOS=linux
./src/rt/libuv/build/gyp/gyp src/rt/libuv/uv.gyp $args \
-f make-linux \
--generator-output mk/libuv/unix \
-DOS=linux
./src/rt/libuv/build/gyp/gyp src/rt/libuv/uv.gyp $args \
-f make-linux \
--generator-output mk/libuv/$ARCH/win \
-DOS=win
./src/rt/libuv/build/gyp/gyp src/rt/libuv/uv.gyp $args \
-f make-linux \
--generator-output mk/libuv/win \
-DOS=win
# Comment out the gyp auto regeneration
for os in mac unix win; do
sed -i ".save" \
-e 's/^\(Makefile: $(srcdir)\/src\/rt\/libuv\/uv\.gyp\)/#\1/' \
mk/libuv/$ARCH/$os/Makefile
# Comment out the gyp auto regeneration
for os in mac unix win; do
sed -i".save" \
-e 's/^\(Makefile: $(srcdir)\/src\/rt\/libuv\/uv\.gyp\)/#\1/' \
mk/libuv/$os/Makefile
sed -i ".save" \
-e 's/^\( $(call do_cmd,regen_makefile)\)/#\1/' \
mk/libuv/$ARCH/$os/Makefile
sed -i".save" \
-e 's/^\( $(call do_cmd,regen_makefile)\)/#\1/' \
mk/libuv/$os/Makefile
rm mk/libuv/$os/Makefile.save
rm mk/libuv/$ARCH/$os/Makefile.save
done
done

View file

@ -67,9 +67,9 @@ struct frame_glue_fns;
typedef intptr_t rust_task_id;
typedef intptr_t rust_port_id;
#ifndef __i386__
#error "Target CPU not supported."
#endif
//NDM #ifndef __i386__
//NDM #error "Target CPU not supported."
//NDM #endif
#define I(dom, e) ((e) ? (void)0 : \
(dom)->srv->fatal(#e, __FILE__, __LINE__, ""))

View file

@ -26,6 +26,7 @@ rust_log::~rust_log() {
const uint16_t
hash(uintptr_t ptr) {
# if(ULONG_MAX == 0xFFFFFFFF)
// Robert Jenkins' 32 bit integer hash function
ptr = (ptr + 0x7ed55d16) + (ptr << 12);
ptr = (ptr ^ 0xc761c23c) ^ (ptr >> 19);
@ -33,6 +34,18 @@ hash(uintptr_t ptr) {
ptr = (ptr + 0xd3a2646c) ^ (ptr << 9);
ptr = (ptr + 0xfd7046c5) + (ptr << 3);
ptr = (ptr ^ 0xb55a4f09) ^ (ptr >> 16);
# elif(ULONG_MAX == 0xFFFFFFFFFFFFFFFF)
// "hash64shift()" from http://www.concentric.net/~Ttwang/tech/inthash.htm
ptr = (~ptr) + (ptr << 21); // ptr = (ptr << 21) - ptr - 1;
ptr = ptr ^ (ptr >> 24);
ptr = (ptr + (ptr << 3)) + (ptr << 8); // ptr * 265
ptr = ptr ^ (ptr >> 14);
ptr = (ptr + (ptr << 2)) + (ptr << 4); // ptr * 21
ptr = ptr ^ (ptr >> 28);
ptr = ptr + (ptr << 31);
# else
# error "hash() not defined for this pointer size"
# endif
return (uint16_t) ptr;
}
@ -72,7 +85,7 @@ rust_log::trace_ln(rust_task *task, uint32_t level, char *message) {
#if defined(__WIN32__)
uint32_t thread_id = 0;
#else
uint32_t thread_id = hash((uint32_t) pthread_self());
uint32_t thread_id = hash((uintptr_t) pthread_self());
#endif
char prefix[BUF_BYTES] = "";
if (_sched && _sched->name) {

View file

@ -8,11 +8,15 @@
// Upcalls.
#ifdef __i386__
#if defined(__i386__) || defined(__x86_64__) || defined(_M_X64)
void
check_stack(rust_task *task) {
void *esp;
# ifdef __i386__
asm volatile("movl %%esp,%0" : "=r" (esp));
# else
asm volatile("mov %%rsp,%0" : "=r" (esp));
# endif
if (esp < task->stk->data)
task->kernel->fatal("Out of stack space, sorry");
}

View file

@ -54,7 +54,7 @@ rust_synchronized_indexed_list_test::run() {
delete worker;
}
long long expected_items = LARGE_COUNT * THREADS;
size_t expected_items = LARGE_COUNT * THREADS;
CHECK(list.length() == expected_items);