Skip to content

Move glue asm to glue.o #265

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

Closed
wants to merge 1 commit into from
Closed
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
21 changes: 17 additions & 4 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ ifdef CFG_WINDOWSY
CFG_EXE_SUFFIX := .exe
CFG_BOOT := ./rustboot.exe
CFG_RUSTC := ./rustc.exe
CFG_GLUE := ./glue.exe
CFG_GCC_CFLAGS += -march=i686
CFG_GCC_LINK_FLAGS += -shared -fPIC
CFG_RUN_TARG = $(1)
Expand All @@ -101,6 +102,7 @@ ifdef CFG_UNIXY
CFG_INFO := $(info cfg: unix-y environment)
CFG_BOOT := ./rustboot
CFG_RUSTC := ./rustc
CFG_GLUE := ./glue
CFG_OBJ_SUFFIX := .o
CFG_RUN_TARG = LD_LIBRARY_PATH=. $(CFG_VALGRIND) $(1)
CFG_GCC := 1
Expand All @@ -111,6 +113,7 @@ ifdef CFG_UNIXY
CFG_RUNTIME := rustrt.dll
CFG_STDLIB := std.dll
CFG_RUSTC := ./rustc.exe
CFG_GLUE := ./glue
ifdef CFG_VALGRIND
CFG_VALGRIND += wine
endif
Expand Down Expand Up @@ -308,11 +311,13 @@ RUNTIME_LIBS := $(CFG_RUNTIME_LIBS)
STDLIB_CRATE := lib/std.rc
STDLIB_INPUTS := $(wildcard lib/*.rc lib/*.rs lib/*/*.rs)
COMPILER_CRATE := comp/rustc.rc
COMPILER_INPUTS := $(wildcard comp/*.rc comp/*.rs comp/*/*.rs)
COMPILER_INPUTS := $(wildcard comp/rustc.rc comp/*.rs comp/*/*.rs)
GLUE_CRATE := comp/glue.rc
GLUE_INPUTS := $(wildcard comp/glue.rc comp/*.rs comp/*/*.rs)

GENERATED := boot/fe/lexer.ml boot/util/version.ml

all: $(CFG_RUSTC) $(MKFILES) $(GENERATED)
all: $(CFG_RUSTC) $(CFG_GLUE) $(MKFILES) $(GENERATED) glue.o

boot/util/version.ml: Makefile
$(CFG_QUIET)git log -1 \
Expand Down Expand Up @@ -368,6 +373,14 @@ $(CFG_RUSTC): $(COMPILER_INPUTS) $(CFG_BOOT) $(CFG_RUNTIME) $(CFG_STDLIB)
$(BOOT) -minimal -o $@ $<
$(CFG_QUIET)chmod 0755 $@

$(CFG_GLUE): $(GLUE_INPUTS) $(CFG_BOOT) $(CFG_RUNTIME) $(CFG_STDLIB)
@$(call CFG_ECHO, compile: $<)
$(BOOT) -minimal -o $@ $<
$(CFG_QUIET)chmod 0755 $@

glue.bc: $(CFG_GLUE)
$(CFG_GLUE)

self: $(CFG_RUSTC)
@$(call CFG_ECHO, compile: $<)
$(RUSTC) $(COMPILER_CRATE)
Expand Down Expand Up @@ -762,9 +775,9 @@ test/bench/shootout/%.boot$(CFG_EXE_SUFFIX): \
@$(call CFG_ECHO, assemble [llvm]: $<)
$(CFG_QUIET)gcc $(CFG_GCC_CFLAGS) -o $@ -c $<

%.rustc$(CFG_EXE_SUFFIX): %.o $(CFG_RUNTIME)
%.rustc$(CFG_EXE_SUFFIX): %.o $(CFG_RUNTIME) glue.o
@$(call CFG_ECHO, link [llvm]: $<)
$(CFG_QUIET)gcc $(CFG_GCC_CFLAGS) -o $@ $< -L. -lrustrt
$(CFG_QUIET)gcc $(CFG_GCC_CFLAGS) glue.o -o $@ $< -L. -lrustrt
@# dsymutil sometimes fails or prints a warning, but the
@# program still runs. Since it simplifies debugging other
@# programs, I\'ll live with the noise.
Expand Down
64 changes: 64 additions & 0 deletions src/comp/glue.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// -*- rust -*-

use std;

mod front {
mod ast;
}

mod middle {
mod ty;
mod trans;
mod fold;
}

mod driver {
mod session;
}

mod glue {
mod glue;
}

mod back {
mod abi;
mod x86;
}

mod util {
mod common;
}

auth driver.rustc.main = impure;
auth middle.trans = unsafe;
auth middle.trans.copy_args_to_allocas = impure;
auth middle.trans.trans_block = impure;
auth lib.llvm = unsafe;

mod lib {
alt (target_os) {
case ("win32") {
let (llvm_lib = "LLVM-2.8.dll") {
mod llvm;
}
}
case ("macos") {
let (llvm_lib = "libLLVM-2.8svn.dylib") {
mod llvm;
}
}
else {
let (llvm_lib = "libLLVM-2.8svn.so") {
mod llvm;
}
}
}
}

// Local Variables:
// fill-column: 78;
// indent-tabs-mode: nil
// c-basic-offset: 4
// buffer-file-coding-system: utf-8-unix
// compile-command: "make -k -C .. 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
// End:
5 changes: 5 additions & 0 deletions src/comp/glue/glue.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import middle.trans.make_common_glue;

fn main(vec[str] args) {
make_common_glue("glue.bc");
}
Loading