Skip to content

Commit be7b287

Browse files
cixtorgraydon
authored andcommitted
---
yaml --- r: 1554 b: refs/heads/master c: 55c80e7 h: refs/heads/master v: v3
1 parent e8e3db8 commit be7b287

File tree

5 files changed

+68
-7
lines changed

5 files changed

+68
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 35bee753dea812bb8112c5bf5c02e1311bbca2fa
2+
refs/heads/master: 55c80e763bfd850682b3217fcfc5cdb516eafae0

trunk/src/Makefile

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ ifdef CFG_WINDOWSY
9090
CFG_EXE_SUFFIX := .exe
9191
CFG_BOOT := ./rustboot.exe
9292
CFG_RUSTC := ./rustc.exe
93+
CFG_GLUE := ./glue.exe
9394
CFG_GCC_CFLAGS += -march=i686
9495
CFG_GCC_LINK_FLAGS += -shared -fPIC
9596
CFG_RUN_TARG = $(1)
@@ -101,6 +102,7 @@ ifdef CFG_UNIXY
101102
CFG_INFO := $(info cfg: unix-y environment)
102103
CFG_BOOT := ./rustboot
103104
CFG_RUSTC := ./rustc
105+
CFG_GLUE := ./glue
104106
CFG_OBJ_SUFFIX := .o
105107
CFG_RUN_TARG = LD_LIBRARY_PATH=. $(CFG_VALGRIND) $(1)
106108
CFG_GCC := 1
@@ -111,6 +113,7 @@ ifdef CFG_UNIXY
111113
CFG_RUNTIME := rustrt.dll
112114
CFG_STDLIB := std.dll
113115
CFG_RUSTC := ./rustc.exe
116+
CFG_GLUE := ./glue
114117
ifdef CFG_VALGRIND
115118
CFG_VALGRIND += wine
116119
endif
@@ -308,11 +311,13 @@ RUNTIME_LIBS := $(CFG_RUNTIME_LIBS)
308311
STDLIB_CRATE := lib/std.rc
309312
STDLIB_INPUTS := $(wildcard lib/*.rc lib/*.rs lib/*/*.rs)
310313
COMPILER_CRATE := comp/rustc.rc
311-
COMPILER_INPUTS := $(wildcard comp/*.rc comp/*.rs comp/*/*.rs)
314+
COMPILER_INPUTS := $(wildcard comp/rustc.rc comp/*.rs comp/*/*.rs)
315+
GLUE_CRATE := comp/glue.rc
316+
GLUE_INPUTS := $(wildcard comp/glue.rc comp/*.rs comp/*/*.rs)
312317

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

315-
all: $(CFG_RUSTC) $(MKFILES) $(GENERATED)
320+
all: $(CFG_RUSTC) $(CFG_GLUE) $(MKFILES) $(GENERATED) glue.o
316321

317322
boot/util/version.ml: Makefile
318323
$(CFG_QUIET)git log -1 \
@@ -368,6 +373,16 @@ $(CFG_RUSTC): $(COMPILER_INPUTS) $(CFG_BOOT) $(CFG_RUNTIME) $(CFG_STDLIB)
368373
$(BOOT) -minimal -o $@ $<
369374
$(CFG_QUIET)chmod 0755 $@
370375

376+
$(CFG_GLUE): $(GLUE_INPUTS) $(CFG_BOOT) $(CFG_RUNTIME) $(CFG_STDLIB)
377+
@$(call CFG_ECHO, compile: $<)
378+
$(BOOT) -minimal -o $@ $<
379+
$(CFG_QUIET)chmod 0755 $@
380+
381+
glue.o: glue.s
382+
383+
glue.s: $(CFG_GLUE)
384+
$(CFG_GLUE) > $@
385+
371386
self: $(CFG_RUSTC)
372387
@$(call CFG_ECHO, compile: $<)
373388
$(RUSTC) $(COMPILER_CRATE)
@@ -763,9 +778,9 @@ test/bench/shootout/%.boot$(CFG_EXE_SUFFIX): \
763778
@$(call CFG_ECHO, assemble [llvm]: $<)
764779
$(CFG_QUIET)gcc $(CFG_GCC_CFLAGS) -o $@ -c $<
765780

766-
%.rustc$(CFG_EXE_SUFFIX): %.o $(CFG_RUNTIME)
781+
%.rustc$(CFG_EXE_SUFFIX): %.o $(CFG_RUNTIME) glue.o
767782
@$(call CFG_ECHO, link [llvm]: $<)
768-
$(CFG_QUIET)gcc $(CFG_GCC_CFLAGS) -o $@ $< -L. -lrustrt
783+
$(CFG_QUIET)gcc $(CFG_GCC_CFLAGS) glue.o -o $@ $< -L. -lrustrt
769784
@# dsymutil sometimes fails or prints a warning, but the
770785
@# program still runs. Since it simplifies debugging other
771786
@# programs, I\'ll live with the noise.

trunk/src/comp/glue.rc

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// -*- rust -*-
2+
3+
use std;
4+
5+
mod front {
6+
mod ast;
7+
}
8+
9+
mod middle {
10+
mod ty;
11+
}
12+
13+
mod driver {
14+
mod session;
15+
}
16+
17+
mod glue {
18+
mod glue;
19+
}
20+
21+
mod back {
22+
mod abi;
23+
mod x86;
24+
}
25+
26+
mod util {
27+
mod common;
28+
}
29+
30+
31+
// Local Variables:
32+
// fill-column: 78;
33+
// indent-tabs-mode: nil
34+
// c-basic-offset: 4
35+
// buffer-file-coding-system: utf-8-unix
36+
// compile-command: "make -k -C .. 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
37+
// End:

trunk/src/comp/glue/glue.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import back.x86;
2+
import std._str;
3+
import std._vec;
4+
import std.os.libc;
5+
6+
fn main(vec[str] args) {
7+
auto module_asm = x86.get_module_asm() + "\n";
8+
auto bytes = _str.bytes(module_asm);
9+
auto b = _vec.buf[u8](bytes);
10+
libc.write(1, b, _vec.len[u8](bytes));
11+
}

trunk/src/comp/middle/trans.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5708,8 +5708,6 @@ fn trans_crate(session.session sess, @ast.crate crate, str output,
57085708
let ValueRef crate_ptr =
57095709
llvm.LLVMAddGlobal(llmod, T_crate(tn), _str.buf("rust_crate"));
57105710

5711-
llvm.LLVMSetModuleInlineAsm(llmod, _str.buf(x86.get_module_asm()));
5712-
57135711
auto intrinsics = declare_intrinsics(llmod);
57145712

57155713
auto glues = make_glues(llmod, tn);

0 commit comments

Comments
 (0)