diff --git a/Usermode/Makefile b/Usermode/Makefile index a2f0eb6d83654c879d0fe3feb3d0d3683c347ad3..ed494fd2debd43d773cf088ab49f7db3b933b331 100644 --- a/Usermode/Makefile +++ b/Usermode/Makefile @@ -90,10 +90,10 @@ LOADER_DEPS := $(patsubst %,$(LIBDIR)lib%.rlib,$(call fn_getdeps,loader/bin/src/ # loader: Requires an assembly stub # > Linking is done in two steps so that --gc-sections works #$(BINDIR)loader: loader/bin/link.ld $(OBJDIR)loader/bin/start.ao $(OBJDIR)loader/bin/src/main.o -$(BINDIR)loader: loader/bin/link.ld $(OBJDIR)loader/bin/start.ao $(OBJDIR)loader/bin/src/main.o $(LOADER_DEPS) +$(BINDIR)loader: loader/bin/link.ld $(OBJDIR)loader/bin/start.ao $(OBJDIR)loader/bin/src/main.o $(OBJDIR)rustrt0.o $(LOADER_DEPS) @mkdir -p $(dir $@) @echo [LD] $@ - $V$(LD) -r --gc-sections --undefined image_header --entry start -o $(OBJDIR)loader.o $(OBJDIR)loader/bin/start.ao $(OBJDIR)loader/bin/src/main.o $(LOADER_DEPS) + $V$(LD) -r --gc-sections --undefined image_header --entry start -o $(OBJDIR)loader.o $(OBJDIR)rustrt0.o $(OBJDIR)loader/bin/start.ao $(OBJDIR)loader/bin/src/main.o $(LOADER_DEPS) $V$(LD) -o $(OBJDIR)loader.elf -T loader/bin/link.ld $(OBJDIR)loader.o -Map $(OBJDIR)loader_map.txt $V$(OBJCOPY) $(OBJDIR)loader.elf -O binary $@ $V$(OBJDUMP) -CS $(OBJDIR)loader.elf > $(OBJDIR)loader.dsm @@ -102,12 +102,15 @@ $(OBJDIR)loader/bin/src/main.o: $(LOADER_DEPS) # $(XARGO) build $(XARGO_FLAGS) --manifest-path loader/Cargo.toml .PHONY: xargo -xargo: $(LIBDIR)libloader_dyn.so $(OBJDIR)loader/bin/start.ao # Referenced by link-$(TARGET).ld - $(XARGO) build $(XARGO_FLAGS) --manifest-path libstd/Cargo.toml +xargo: $(OBJDIR)rustrt0.o $(LIBDIR)libloader_dyn.so $(LIBDIR)libloader_start.a # Referenced by link-$(TARGET).ld + #$(XARGO) build $(XARGO_FLAGS) --manifest-path libstd/Cargo.toml $(XARGO) build $(XARGO_FLAGS) --manifest-path loader/bin/Cargo.toml - cp target/$(XARGO_TARGET)/$(XARGO_PROFILE)/libstd.rlib ../.prefix/xargo/lib/rustlib/$(XARGO_TARGET)/lib/ + #cp target/$(XARGO_TARGET)/$(XARGO_PROFILE)/libstd.rlib ../.prefix/xargo/lib/rustlib/$(XARGO_TARGET)/lib/ $(XARGO) build $(XARGO_FLAGS) +$(LIBDIR)libloader_start.a: $(OBJDIR)loader/bin/start.ao + @mkdir -p $(dir $@) + $V$(AR) rcu $@ $< # Low-level loader dummy dynamic library # - Used to tell ld that `loader`'s exported symbols actually exist $(LIBDIR)libloader_dyn.so: loader/bin/lib.S $(makefile_deps) diff --git a/Usermode/Xargo.toml b/Usermode/Xargo.toml index 775329b16e436ab6c63e605e4e48422439536ffe..f2723450a3aa4e1448cf4c34a24f2c767eed4253 100644 --- a/Usermode/Xargo.toml +++ b/Usermode/Xargo.toml @@ -1,2 +1,11 @@ +[xargo] +track-sysroot = true +[xargo.stage1] +disable-staged-api = true + [dependencies.alloc] stage = 0 +[dependencies.std] +stage = 1 +path = "libstd" + diff --git a/Usermode/libasync/Cargo.toml b/Usermode/libasync/Cargo.toml index 90b6096cfd4d8d441714cebd1b9f9ca463bb9cba..25984cf8e3b7225da96c313714f3cfb3b4534fa1 100644 --- a/Usermode/libasync/Cargo.toml +++ b/Usermode/libasync/Cargo.toml @@ -6,5 +6,5 @@ version = "0.0.1" path = "lib.rs" [dependencies] -std = { path = "../libstd" } +#std = { path = "../libstd" } syscalls = { path = "../libsyscalls" } diff --git a/Usermode/libbyteorder/Cargo.toml b/Usermode/libbyteorder/Cargo.toml index 78949bc25b1b1912a17977b2e8e471a161aa62d7..e390c012530fd696f539291257c33d62a2b9a9b8 100644 --- a/Usermode/libbyteorder/Cargo.toml +++ b/Usermode/libbyteorder/Cargo.toml @@ -3,6 +3,6 @@ name = "byteorder" version = "0.0.1" [dependencies] -std = { path = "../libstd" } +#std = { path = "../libstd" } diff --git a/Usermode/libvec_ring/Cargo.toml b/Usermode/libvec_ring/Cargo.toml index 1397881308b74a6a9014a1b75c4af23d03615eeb..8623cb9caad4c4e7f11cd9a10bfdb48cdd739c7a 100644 --- a/Usermode/libvec_ring/Cargo.toml +++ b/Usermode/libvec_ring/Cargo.toml @@ -6,5 +6,4 @@ version = "0.0.1" path = "lib.rs" [dependencies] - -std = { path = "../libstd" } +#std = { path = "../libstd" } diff --git a/Usermode/libwtk/Cargo.toml b/Usermode/libwtk/Cargo.toml index f86ce3e5078063af5a11acf1cff0a0d42f958b3b..a6bc07001107fb815a095c93bbf6da548d73e24f 100644 --- a/Usermode/libwtk/Cargo.toml +++ b/Usermode/libwtk/Cargo.toml @@ -11,4 +11,4 @@ macros = { path = "../libmacros" } async = { path = "../libasync" } byteorder = { path = "../libbyteorder" } -std = { path = "../libstd" } +#std = { path = "../libstd" } diff --git a/Usermode/link-amd64.ld b/Usermode/link-amd64.ld index d20cecf2bd44152e01c96f39cedae9c0ddb7a374..3eace4d75c349bcb62c79e597129670550c8b066 100644 --- a/Usermode/link-amd64.ld +++ b/Usermode/link-amd64.ld @@ -1,6 +1,7 @@ ENTRY(start) -SEARCH_DIR( .ojs/amd64/libs ) +/*SEARCH_DIR( .objs/amd64/libs )*/ +SEARCH_DIR( .output/amd64/libs ) STARTUP( .objs/amd64/rustrt0.o ) PHDRS { diff --git a/Usermode/loader/bin/Cargo.toml b/Usermode/loader/bin/Cargo.toml index ed015e4ba3d266a6173df5416170097360b59451..3f5df146f18e162073436dc72984eff52cd9b168 100644 --- a/Usermode/loader/bin/Cargo.toml +++ b/Usermode/loader/bin/Cargo.toml @@ -2,12 +2,14 @@ name = "loader-binary" version = "0.0.0" -[lib] -path = "src/main.rs" +#[bin] +#path = "src/main.rs" [dependencies] loader = { path = "../lib" } -syscalls = { path = "../../libsyscalls" } byteorder = { path = "../../libbyteorder" } macros = { path = "../../libmacros" } cmdline_words_parser = { path = "../../../externals/crates.io/cmdline_words_parser" } + +# Part of sysroot +#syscalls = { path = "../../libsyscalls" } diff --git a/Usermode/loader/bin/src/main.rs b/Usermode/loader/bin/src/main.rs index ac3afc9373bce0f461db7a32131a96167242ff32..0618b66b62876406d63baca918c867f3dbf2ed26 100644 --- a/Usermode/loader/bin/src/main.rs +++ b/Usermode/loader/bin/src/main.rs @@ -3,7 +3,7 @@ // // This program is both the initial entrypoint for the userland, and the default dynamic linker. #![feature(const_fn)] -#![crate_type="lib"] +//#![crate_type="lib"] #![no_main] use cmdline_words_parser::StrExt as CmdlineStrExt; diff --git a/Usermode/loader/bin/start.S b/Usermode/loader/bin/start.S index 8d7325916e0ba32c4d11d65ea7c788a5f7dc3cd9..2bc014bd73901e0170a327e6366686422b859efe 100644 --- a/Usermode/loader/bin/start.S +++ b/Usermode/loader/bin/start.S @@ -57,6 +57,7 @@ ENTRY(start) .loop: jmp .loop +/* // RDI = Address // RSI = Value // RDX = Count @@ -93,6 +94,7 @@ ENTRY(memcmp) ret ENTRY(_Unwind_Resume) jmp . +*/ #elif defined(ARCH_armv7) # define DEFPTR .long diff --git a/Usermode/rustrt0/amd64.S b/Usermode/rustrt0/amd64.S index d504e7d541af3e12f9bb490837265aa6ec518b54..6ace32e725df0c838c6cdc229412c01dc9e5dda5 100644 --- a/Usermode/rustrt0/amd64.S +++ b/Usermode/rustrt0/amd64.S @@ -6,7 +6,7 @@ .extern main .extern register_arguments -.globl start +.weak start start: call *start_ra(%rip) mov $0, %rdi