start going back to an i386 build
This commit is contained in:
parent
8011e3fabb
commit
20946e6970
@ -50,9 +50,7 @@ include config.mk
|
|||||||
OUR_MKFILES := Makefile config.mk $(wildcard $(CFG_SRC_DIR)/mk/*.mk)
|
OUR_MKFILES := Makefile config.mk $(wildcard $(CFG_SRC_DIR)/mk/*.mk)
|
||||||
3RDPARTY_MKFILES := $(CFG_SRC_DIR)/src/rt/libuv/Makefile \
|
3RDPARTY_MKFILES := $(CFG_SRC_DIR)/src/rt/libuv/Makefile \
|
||||||
$(wildcard $(CFG_SRC_DIR)/src/rt/libuv/*.mk)
|
$(wildcard $(CFG_SRC_DIR)/src/rt/libuv/*.mk)
|
||||||
GEN_MKFILES := $(wildcard $(CFG_SRC_DIR)/mk/libuv/mac/*) \
|
GEN_MKFILES := $(wildcard $(CFG_SRC_DIR)/mk/libuv/*/*/*) \
|
||||||
$(wildcard $(CFG_SRC_DIR)/mk/libuv/unix/*) \
|
|
||||||
$(wildcard $(CFG_SRC_DIR)/mk/libuv/win/*) \
|
|
||||||
$(wildcard $(CFG_SRC_DIR)/mk/libuv/mac/src/rt/libuv/*) \
|
$(wildcard $(CFG_SRC_DIR)/mk/libuv/mac/src/rt/libuv/*) \
|
||||||
$(wildcard $(CFG_SRC_DIR)/mk/libuv/mac/src/rt/libuv/*) \
|
$(wildcard $(CFG_SRC_DIR)/mk/libuv/mac/src/rt/libuv/*) \
|
||||||
$(wildcard $(CFG_SRC_DIR)/mk/libuv/mac/src/rt/libuv/*)
|
$(wildcard $(CFG_SRC_DIR)/mk/libuv/mac/src/rt/libuv/*)
|
||||||
|
2
configure
vendored
2
configure
vendored
@ -391,7 +391,7 @@ step_msg "making directories"
|
|||||||
for i in \
|
for i in \
|
||||||
doc doc/std \
|
doc doc/std \
|
||||||
nd nd/std \
|
nd nd/std \
|
||||||
rt rt/isaac rt/bigint rt/sync rt/test rt/arch/i386 \
|
rt rt/isaac rt/bigint rt/sync rt/test rt/arch/i386 rt/arch/x86_64 \
|
||||||
rt/libuv rt/libuv/src/ares rt/libuv/src/eio rt/libuv/src/ev \
|
rt/libuv rt/libuv/src/ares rt/libuv/src/eio rt/libuv/src/ev \
|
||||||
rustllvm dl \
|
rustllvm dl \
|
||||||
test/run-pass test/run-fail test/compile-fail \
|
test/run-pass test/run-fail test/compile-fail \
|
||||||
|
@ -9,7 +9,7 @@ CFLAGS_Default := -fasm-blocks \
|
|||||||
-mpascal-strings \
|
-mpascal-strings \
|
||||||
-Os \
|
-Os \
|
||||||
-gdwarf-2 \
|
-gdwarf-2 \
|
||||||
-arch i386
|
-arch x86_64
|
||||||
|
|
||||||
# Flags passed to only C files.
|
# Flags passed to only C files.
|
||||||
CFLAGS_C_Default :=
|
CFLAGS_C_Default :=
|
||||||
@ -68,7 +68,7 @@ $(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.c FORCE_DO_CMD
|
|||||||
|
|
||||||
# End of this set of suffix rules
|
# End of this set of suffix rules
|
||||||
### Rules for final target.
|
### Rules for final target.
|
||||||
LDFLAGS_Default := -arch i386 \
|
LDFLAGS_Default := -arch x86_64 \
|
||||||
-L$(builddir)
|
-L$(builddir)
|
||||||
|
|
||||||
LIBS := -framework Carbon \
|
LIBS := -framework Carbon \
|
||||||
|
@ -12,7 +12,7 @@ CFLAGS_Default := -fasm-blocks \
|
|||||||
-mpascal-strings \
|
-mpascal-strings \
|
||||||
-Os \
|
-Os \
|
||||||
-gdwarf-2 \
|
-gdwarf-2 \
|
||||||
-arch i386
|
-arch x86_64
|
||||||
|
|
||||||
# Flags passed to only C files.
|
# Flags passed to only C files.
|
||||||
CFLAGS_C_Default :=
|
CFLAGS_C_Default :=
|
||||||
@ -104,7 +104,7 @@ $(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.c FORCE_DO_CMD
|
|||||||
|
|
||||||
# End of this set of suffix rules
|
# End of this set of suffix rules
|
||||||
### Rules for final target.
|
### Rules for final target.
|
||||||
LDFLAGS_Default := -arch i386 \
|
LDFLAGS_Default := -arch x86_64 \
|
||||||
-L$(builddir)
|
-L$(builddir)
|
||||||
|
|
||||||
LIBS := -framework Carbon \
|
LIBS := -framework Carbon \
|
||||||
|
@ -15,7 +15,7 @@ CFLAGS_Default := -fasm-blocks \
|
|||||||
-mpascal-strings \
|
-mpascal-strings \
|
||||||
-Os \
|
-Os \
|
||||||
-gdwarf-2 \
|
-gdwarf-2 \
|
||||||
-arch i386
|
-arch x86_64
|
||||||
|
|
||||||
# Flags passed to only C files.
|
# Flags passed to only C files.
|
||||||
CFLAGS_C_Default :=
|
CFLAGS_C_Default :=
|
||||||
@ -120,7 +120,7 @@ $(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.c FORCE_DO_CMD
|
|||||||
|
|
||||||
# End of this set of suffix rules
|
# End of this set of suffix rules
|
||||||
### Rules for final target.
|
### Rules for final target.
|
||||||
LDFLAGS_Default := -arch i386 \
|
LDFLAGS_Default := -arch x86_64 \
|
||||||
-L$(builddir)
|
-L$(builddir)
|
||||||
|
|
||||||
LIBS := -lm
|
LIBS := -lm
|
||||||
|
@ -66,13 +66,13 @@ ifneq ($(findstring darwin,$(CFG_OSTYPE)),)
|
|||||||
# approaches welcome!
|
# approaches welcome!
|
||||||
#
|
#
|
||||||
# NB: Currently GCC's optimizer breaks rustrt (task-comm-1 hangs) on Darwin.
|
# NB: Currently GCC's optimizer breaks rustrt (task-comm-1 hangs) on Darwin.
|
||||||
CFG_GCC_CFLAGS += -m64 #NDM
|
CFG_GCC_CFLAGS += -m32
|
||||||
CFG_CLANG_CFLAGS += -m64 #NDM
|
CFG_CLANG_CFLAGS += -m32
|
||||||
ifeq ($(CFG_CPUTYPE), x86_64)
|
ifeq ($(CFG_CPUTYPE), x86_64)
|
||||||
CFG_GCCISH_CFLAGS += -arch x86_64 #NDM
|
CFG_GCCISH_CFLAGS += -arch i386
|
||||||
CFG_GCCISH_LINK_FLAGS += -arch x86_64 #NDM
|
CFG_GCCISH_LINK_FLAGS += -arch i386
|
||||||
endif
|
endif
|
||||||
CFG_GCCISH_LINK_FLAGS += -m64
|
CFG_GCCISH_LINK_FLAGS += -m32
|
||||||
CFG_DSYMUTIL := dsymutil
|
CFG_DSYMUTIL := dsymutil
|
||||||
CFG_DEF_SUFFIX := .darwin.def
|
CFG_DEF_SUFFIX := .darwin.def
|
||||||
# Mac requires this flag to make rpath work
|
# Mac requires this flag to make rpath work
|
||||||
|
17
mk/rt.mk
17
mk/rt.mk
@ -32,8 +32,8 @@ RUNTIME_CS := rt/sync/timer.cpp \
|
|||||||
rt/memory_region.cpp \
|
rt/memory_region.cpp \
|
||||||
rt/test/rust_test_harness.cpp \
|
rt/test/rust_test_harness.cpp \
|
||||||
rt/test/rust_test_runtime.cpp \
|
rt/test/rust_test_runtime.cpp \
|
||||||
rt/test/rust_test_util.cpp #NDM
|
rt/test/rust_test_util.cpp \
|
||||||
#NDM rt/arch/i386/context.cpp
|
rt/arch/i386/context.cpp
|
||||||
|
|
||||||
RUNTIME_LL :=
|
RUNTIME_LL :=
|
||||||
|
|
||||||
@ -76,25 +76,30 @@ RUNTIME_HDR := rt/globals.h \
|
|||||||
rt/test/rust_test_harness.h \
|
rt/test/rust_test_harness.h \
|
||||||
rt/test/rust_test_runtime.h \
|
rt/test/rust_test_runtime.h \
|
||||||
rt/test/rust_test_util.h \
|
rt/test/rust_test_util.h \
|
||||||
|
<<<<<<< HEAD
|
||||||
rt/arch/i386/context.h
|
rt/arch/i386/context.h
|
||||||
|
=======
|
||||||
|
rt/arch/i386/context.h
|
||||||
|
>>>>>>> start going back to an i386 build
|
||||||
|
|
||||||
ifeq ($(CFG_WINDOWSY), 1)
|
ifeq ($(CFG_WINDOWSY), 1)
|
||||||
LIBUV_OSTYPE := win
|
LIBUV_OSTYPE := win
|
||||||
LIBUV_ARCH := x86_64 #NDM
|
LIBUV_ARCH := i386
|
||||||
LIBUV_LIB := rt/libuv/Default/obj.target/src/rt/libuv/libuv.a
|
LIBUV_LIB := rt/libuv/Default/obj.target/src/rt/libuv/libuv.a
|
||||||
else ifeq ($(CFG_OSTYPE), apple-darwin)
|
else ifeq ($(CFG_OSTYPE), apple-darwin)
|
||||||
LIBUV_OSTYPE := mac
|
LIBUV_OSTYPE := mac
|
||||||
LIBUV_ARCH := x86_64 #NDM
|
LIBUV_ARCH := i386
|
||||||
LIBUV_LIB := rt/libuv/Default/libuv.a
|
LIBUV_LIB := rt/libuv/Default/libuv.a
|
||||||
else
|
else
|
||||||
LIBUV_OSTYPE := unix
|
LIBUV_OSTYPE := unix
|
||||||
LIBUV_ARCH := x86_64 #NDM
|
LIBUV_ARCH := i386
|
||||||
LIBUV_LIB := rt/libuv/Default/obj.target/src/rt/libuv/libuv.a
|
LIBUV_LIB := rt/libuv/Default/obj.target/src/rt/libuv/libuv.a
|
||||||
endif
|
endif
|
||||||
|
|
||||||
RUNTIME_DEF := rt/rustrt$(CFG_DEF_SUFFIX)
|
RUNTIME_DEF := rt/rustrt$(CFG_DEF_SUFFIX)
|
||||||
RUNTIME_INCS := -I $(S)src/rt/isaac -I $(S)src/rt/uthash \
|
RUNTIME_INCS := -I $(S)src/rt/isaac -I $(S)src/rt/uthash \
|
||||||
-I $(S)src/rt/arch/i386 -I $(S)src/rt/libuv/include
|
-I $(S)src/rt/arch/x86_64 \
|
||||||
|
-I $(S)src/rt/libuv/include
|
||||||
RUNTIME_OBJS := $(RUNTIME_CS:.cpp=.o) $(RUNTIME_LL:.ll=.o) $(RUNTIME_S:.S=.o)
|
RUNTIME_OBJS := $(RUNTIME_CS:.cpp=.o) $(RUNTIME_LL:.ll=.o) $(RUNTIME_S:.S=.o)
|
||||||
RUNTIME_LIBS := $(LIBUV_LIB)
|
RUNTIME_LIBS := $(LIBUV_LIB)
|
||||||
|
|
||||||
|
@ -40,14 +40,17 @@ do
|
|||||||
|
|
||||||
# Comment out the gyp auto regeneration
|
# Comment out the gyp auto regeneration
|
||||||
for os in mac unix win; do
|
for os in mac unix win; do
|
||||||
sed -i ".save" \
|
sed -i "" \
|
||||||
-e 's/^\(Makefile: $(srcdir)\/src\/rt\/libuv\/uv\.gyp\)/#\1/' \
|
-e 's/^\(Makefile: $(srcdir)\/src\/rt\/libuv\/uv\.gyp\)/#\1/' \
|
||||||
mk/libuv/$ARCH/$os/Makefile
|
mk/libuv/$ARCH/$os/Makefile
|
||||||
|
|
||||||
sed -i ".save" \
|
sed -i "" \
|
||||||
-e 's/^\( $(call do_cmd,regen_makefile)\)/#\1/' \
|
-e 's/^\( $(call do_cmd,regen_makefile)\)/#\1/' \
|
||||||
mk/libuv/$ARCH/$os/Makefile
|
mk/libuv/$ARCH/$os/Makefile
|
||||||
|
|
||||||
rm mk/libuv/$ARCH/$os/Makefile.save
|
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# On Mac, GYP hardcodes a -arch i386 into the output. Fix that.
|
||||||
|
sed -i "" \
|
||||||
|
-e 's/-arch i386/-arch x86_64/' \
|
||||||
|
mk/libuv/x86_64/mac/src/rt/libuv/*.mk
|
||||||
|
@ -54,44 +54,44 @@ swap_registers:
|
|||||||
// jump back into the old code.
|
// jump back into the old code.
|
||||||
|
|
||||||
// Save instruction pointer:
|
// Save instruction pointer:
|
||||||
popl %rax
|
pop %rax
|
||||||
movl %rax, 104(%rdi)
|
mov %rax, 104(%rdi)
|
||||||
|
|
||||||
// Save non-volatile integer registers:
|
// Save non-volatile integer registers:
|
||||||
// (including RSP)
|
// (including RSP)
|
||||||
movl %rbx, 0(%rdi)
|
mov %rbx, 0(%rdi)
|
||||||
movl %rsp, 8(%rdi)
|
mov %rsp, 8(%rdi)
|
||||||
movl %rbp, 16(%rdi)
|
mov %rbp, 16(%rdi)
|
||||||
movl %r12, 24(%rdi)
|
mov %r12, 24(%rdi)
|
||||||
movl %r13, 32(%rdi)
|
mov %r13, 32(%rdi)
|
||||||
movl %r14, 40(%rdi)
|
mov %r14, 40(%rdi)
|
||||||
movl %r15, 48(%rdi)
|
mov %r15, 48(%rdi)
|
||||||
|
|
||||||
// Save non-volatile XMM registers:
|
// Save non-volatile XMM registers:
|
||||||
movl %xmm0, 56(%rdi)
|
movapd %xmm0, 56(%rdi)
|
||||||
movl %xmm1, 64(%rdi)
|
movapd %xmm1, 64(%rdi)
|
||||||
movl %xmm2, 72(%rdi)
|
movapd %xmm2, 72(%rdi)
|
||||||
movl %xmm3, 80(%rdi)
|
movapd %xmm3, 80(%rdi)
|
||||||
movl %xmm4, 88(%rdi)
|
movapd %xmm4, 88(%rdi)
|
||||||
movl %xmm5, 96(%rdi)
|
movapd %xmm5, 96(%rdi)
|
||||||
|
|
||||||
// Restore non-volatile integer registers:
|
// Restore non-volatile integer registers:
|
||||||
// (including RSP)
|
// (including RSP)
|
||||||
movl 0(%rsi), %rbx
|
mov 0(%rsi), %rbx
|
||||||
movl 8(%rsi), %rsp
|
mov 8(%rsi), %rsp
|
||||||
movl 16(%rsi), %rbp
|
mov 16(%rsi), %rbp
|
||||||
movl 24(%rsi), %r12
|
mov 24(%rsi), %r12
|
||||||
movl 32(%rsi), %r13
|
mov 32(%rsi), %r13
|
||||||
movl 40(%rsi), %r14
|
mov 40(%rsi), %r14
|
||||||
movl 48(%rsi), %r15
|
mov 48(%rsi), %r15
|
||||||
|
|
||||||
// Restore non-volatile XMM registers:
|
// Restore non-volatile XMM registers:
|
||||||
movl 56(%rsi), %xmm0
|
movapd 56(%rsi), %xmm0
|
||||||
movl 64(%rsi), %xmm1
|
movapd 64(%rsi), %xmm1
|
||||||
movl 72(%rsi), %xmm2
|
movapd 72(%rsi), %xmm2
|
||||||
movl 80(%rsi), %xmm3
|
movapd 80(%rsi), %xmm3
|
||||||
movl 88(%rsi), %xmm4
|
movapd 88(%rsi), %xmm4
|
||||||
movl 96(%rsi), %xmm5
|
movapd 96(%rsi), %xmm5
|
||||||
|
|
||||||
// Jump to the instruction pointer
|
// Jump to the instruction pointer
|
||||||
// found in regs:
|
// found in regs:
|
||||||
|
@ -11,11 +11,11 @@ _upcall_call_c_stack:
|
|||||||
.globl upcall_call_c_stack
|
.globl upcall_call_c_stack
|
||||||
upcall_call_c_stack:
|
upcall_call_c_stack:
|
||||||
#endif
|
#endif
|
||||||
pushl %rbp
|
push %rbp
|
||||||
movl %rsp,%rbp // save rsp
|
mov %rsp,%rbp // save rsp
|
||||||
movl %rsi,%rsp // switch stack
|
mov %rsi,%rsp // switch stack
|
||||||
calll *%rdi
|
call *%rdi
|
||||||
movl %rbp,%rsp // would like to use "leave" but it's slower
|
mov %rbp,%rsp // would like to use "leave" but it's slower
|
||||||
popl %rbp
|
pop %rbp
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@ -33,6 +33,6 @@ void context::call(void *f, void *arg, void *stack) {
|
|||||||
*--sp = (uint64_t)arg;
|
*--sp = (uint64_t)arg;
|
||||||
*--sp = 0xdeadbeef;
|
*--sp = 0xdeadbeef;
|
||||||
|
|
||||||
regs.regs[1] = (uint64_t)sp;
|
regs.regs[RSP] = (uint64_t)sp;
|
||||||
regs.ip = (uint64_t)f;
|
regs.ip = (uint64_t)f;
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,8 @@ struct registers_t {
|
|||||||
|
|
||||||
class context {
|
class context {
|
||||||
public:
|
public:
|
||||||
|
static const int RSP = 1;
|
||||||
|
|
||||||
registers_t regs;
|
registers_t regs;
|
||||||
|
|
||||||
context();
|
context();
|
||||||
@ -42,7 +44,7 @@ public:
|
|||||||
// function being called causes the task to fail, then we have to avoid
|
// function being called causes the task to fail, then we have to avoid
|
||||||
// leaking space on the C stack.
|
// leaking space on the C stack.
|
||||||
inline void *alloc_stack(size_t nbytes) {
|
inline void *alloc_stack(size_t nbytes) {
|
||||||
uint32_t bot = regs.esp;
|
uint32_t bot = regs.regs[RSP];
|
||||||
uint32_t top = align_down(bot - nbytes);
|
uint32_t top = align_down(bot - nbytes);
|
||||||
|
|
||||||
#ifdef HAVE_VALGRIND
|
#ifdef HAVE_VALGRIND
|
||||||
|
Loading…
Reference in New Issue
Block a user