Compile using real libstd, with no crate overrides

This commit is contained in:
Jeremy Soller 2016-12-27 16:47:08 -07:00
parent 1566ed9060
commit 3853dfd5bc
17 changed files with 20 additions and 122 deletions

View file

@ -17,6 +17,7 @@ RUSTCFLAGS=--target $(TARGET).json -C opt-level=2 -C debuginfo=0
RUSTDOC=./rustdoc.sh RUSTDOC=./rustdoc.sh
CARGO=RUSTC="$(RUSTC)" RUSTDOC="$(RUSTDOC)" cargo CARGO=RUSTC="$(RUSTC)" RUSTDOC="$(RUSTDOC)" cargo
CARGOFLAGS=--target $(TARGET).json --release -- CARGOFLAGS=--target $(TARGET).json --release --
export CFLAGS=-fno-stack-protector
# Default targets # Default targets
.PHONY: all live iso clean doc ref test update pull qemu bochs drivers schemes binutils coreutils extrautils netutils userutils wireshark FORCE .PHONY: all live iso clean doc ref test update pull qemu bochs drivers schemes binutils coreutils extrautils netutils userutils wireshark FORCE
@ -31,7 +32,7 @@ FORCE:
clean: clean:
cargo clean cargo clean
cargo clean --manifest-path libstd/Cargo.toml cargo clean --manifest-path rust/src/libstd/Cargo.toml
cargo clean --manifest-path drivers/ahcid/Cargo.toml cargo clean --manifest-path drivers/ahcid/Cargo.toml
cargo clean --manifest-path drivers/e1000d/Cargo.toml cargo clean --manifest-path drivers/e1000d/Cargo.toml
cargo clean --manifest-path drivers/ps2d/Cargo.toml cargo clean --manifest-path drivers/ps2d/Cargo.toml
@ -74,7 +75,7 @@ doc-kernel: $(KBUILD)/libkernel.a FORCE
$(KCARGO) doc --target $(KTARGET).json $(KCARGO) doc --target $(KTARGET).json
doc-std: $(BUILD)/libstd.rlib FORCE doc-std: $(BUILD)/libstd.rlib FORCE
$(CARGO) doc --target $(TARGET).json --manifest-path libstd/Cargo.toml $(CARGO) doc --target $(TARGET).json --manifest-path rust/src/libstd/Cargo.toml
ref: FORCE ref: FORCE
rm -rf filesystem/ref/ rm -rf filesystem/ref/
@ -86,7 +87,7 @@ ref: FORCE
test: test:
cargo test cargo test
cargo test --manifest-path libstd/Cargo.toml cargo test --manifest-path rust/src/libstd/Cargo.toml
cargo test --manifest-path drivers/ahcid/Cargo.toml cargo test --manifest-path drivers/ahcid/Cargo.toml
cargo test --manifest-path drivers/e1000d/Cargo.toml cargo test --manifest-path drivers/e1000d/Cargo.toml
cargo test --manifest-path drivers/ps2d/Cargo.toml cargo test --manifest-path drivers/ps2d/Cargo.toml
@ -118,7 +119,7 @@ test:
update: update:
cargo update cargo update
cargo update --manifest-path libstd/Cargo.toml cargo update --manifest-path rust/src/libstd/Cargo.toml
cargo update --manifest-path drivers/ahcid/Cargo.toml cargo update --manifest-path drivers/ahcid/Cargo.toml
cargo update --manifest-path drivers/e1000d/Cargo.toml cargo update --manifest-path drivers/e1000d/Cargo.toml
cargo update --manifest-path drivers/ps2d/Cargo.toml cargo update --manifest-path drivers/ps2d/Cargo.toml
@ -351,32 +352,10 @@ $(KBUILD)/kernel_live: $(KBUILD)/libkernel_live.a
$(LD) $(LDFLAGS) -z max-page-size=0x1000 -T arch/$(ARCH)/src/linker.ld -o $@ $< $(LD) $(LDFLAGS) -z max-page-size=0x1000 -T arch/$(ARCH)/src/linker.ld -o $@ $<
# Userspace recipes # Userspace recipes
$(BUILD)/libcore.rlib: rust/src/libcore/lib.rs $(BUILD)/libstd.rlib: rust/src/libstd/Cargo.toml rust/src/libstd/**
mkdir -p $(BUILD) mkdir -p $(BUILD)
$(RUSTC) $(RUSTCFLAGS) -o $@ $< $(CARGO) rustc --verbose --manifest-path $< $(CARGOFLAGS) -L native=libc-artifacts/lib -o $@
cp rust/src/target/$(TARGET)/release/deps/*.rlib $(BUILD)
$(BUILD)/liballoc.rlib: rust/src/liballoc/lib.rs $(BUILD)/libcore.rlib
$(RUSTC) $(RUSTCFLAGS) -o $@ $<
$(BUILD)/libcollections.rlib: rust/src/libcollections/lib.rs $(BUILD)/libcore.rlib $(BUILD)/liballoc.rlib $(BUILD)/libstd_unicode.rlib
$(RUSTC) $(RUSTCFLAGS) -o $@ $<
$(BUILD)/librand.rlib: rust/src/librand/lib.rs $(BUILD)/libcore.rlib
$(RUSTC) $(RUSTCFLAGS) -o $@ $<
$(BUILD)/libstd_unicode.rlib: rust/src/libstd_unicode/lib.rs $(BUILD)/libcore.rlib
$(RUSTC) $(RUSTCFLAGS) -o $@ $<
libstd/openlibm/libopenlibm.a:
CFLAGS=-fno-stack-protector make -C libstd/openlibm libopenlibm.a
$(BUILD)/libopenlibm.a: libstd/openlibm/libopenlibm.a
mkdir -p $(BUILD)
cp $< $@
$(BUILD)/libstd.rlib: libstd/Cargo.toml rust/src/libstd/** $(BUILD)/libcore.rlib $(BUILD)/liballoc.rlib $(BUILD)/libstd_unicode.rlib $(BUILD)/libcollections.rlib $(BUILD)/librand.rlib $(BUILD)/libopenlibm.a
$(CARGO) rustc --verbose --manifest-path $< $(CARGOFLAGS) -o $@
cp libstd/target/$(TARGET)/release/deps/*.rlib $(BUILD)
initfs/bin/%: drivers/%/Cargo.toml drivers/%/src/** $(BUILD)/libstd.rlib initfs/bin/%: drivers/%/Cargo.toml drivers/%/src/** $(BUILD)/libstd.rlib
mkdir -p initfs/bin mkdir -p initfs/bin
@ -386,7 +365,7 @@ initfs/bin/%: drivers/%/Cargo.toml drivers/%/src/** $(BUILD)/libstd.rlib
initfs/bin/%: programs/%/Cargo.toml programs/%/src/** $(BUILD)/libstd.rlib initfs/bin/%: programs/%/Cargo.toml programs/%/src/** $(BUILD)/libstd.rlib
mkdir -p initfs/bin mkdir -p initfs/bin
$(CARGO) rustc --manifest-path $< $(CARGOFLAGS) -o $@ $(CARGO) rustc --manifest-path $< $(CARGOFLAGS) -o $@
strip $@ #strip $@
initfs/bin/%: schemes/%/Cargo.toml schemes/%/src/** $(BUILD)/libstd.rlib initfs/bin/%: schemes/%/Cargo.toml schemes/%/src/** $(BUILD)/libstd.rlib
mkdir -p initfs/bin mkdir -p initfs/bin
@ -540,8 +519,8 @@ netutils: \
filesystem/bin/httpd \ filesystem/bin/httpd \
filesystem/bin/irc \ filesystem/bin/irc \
filesystem/bin/nc \ filesystem/bin/nc \
filesystem/bin/ntp \ filesystem/bin/ntp
filesystem/bin/wget #TODO filesystem/bin/wget
orbutils: \ orbutils: \
filesystem/ui/bin/browser \ filesystem/ui/bin/browser \

View file

@ -5,7 +5,6 @@
#![deny(warnings)] #![deny(warnings)]
#![feature(alloc)] #![feature(alloc)]
#![feature(arc_counts)]
#![feature(asm)] #![feature(asm)]
#![feature(collections)] #![feature(collections)]
#![feature(const_fn)] #![feature(const_fn)]

View file

@ -1,21 +0,0 @@
[package]
name = "redox_std"
version = "0.1.0"
authors = ["Jeremy Soller <jackpot51@gmail.com>"]
build = "../rust/src/libstd/build.rs"
[lib]
name = "std"
path = "../rust/src/libstd/lib.rs"
[dependencies]
alloc_system = { path = "alloc_system" }
compiler_builtins = { path = "compiler_builtins" }
panic_abort = { path = "panic_abort" }
#panic_unwind = { path = "panic_unwind" }
libc = { path = "libc" }
unwind = { path = "unwind" }
[build-dependencies]
build_helper = { path = "../rust/src/build_helper" }
gcc = "0.3.27"

View file

@ -1,10 +0,0 @@
[package]
name = "alloc_system"
version = "0.0.0"
authors = ["Jeremy Soller <jackpot51@gmail.com>"]
[dependencies.ralloc]
git = "https://github.com/redox-os/ralloc.git"
branch = "new_kernel"
default-features = false
features = ["allocator"]

View file

@ -1,6 +0,0 @@
#![allocator]
#![feature(allocator)]
#![no_std]
#[allocator]
extern crate ralloc;

View file

@ -1,7 +0,0 @@
[package]
name = "compiler_builtins"
version = "0.1.0"
authors = ["Jeremy Soller <jackpot51@gmail.com>"]
[lib]
path = "../../rust/src/libcompiler_builtins/lib.rs"

View file

@ -1,11 +0,0 @@
[package]
name = "libc"
version = "0.1.0"
authors = ["Jeremy Soller <jackpot51@gmail.com>"]
build = "../../rust/src/rustc/libc_shim/build.rs"
[lib]
name = "libc"
path = "../../rust/src/liblibc/src/lib.rs"
test = false
bench = false

@ -1 +0,0 @@
Subproject commit 1581174c85f7b645b15ba1ac1c3a98fb601f0fe7

View file

@ -1,7 +0,0 @@
[package]
name = "panic_abort"
version = "0.0.0"
authors = ["Jeremy Soller <jackpot51@gmail.com>"]
[lib]
path = "../../rust/src/libpanic_abort/lib.rs"

View file

@ -1,11 +0,0 @@
[package]
name = "panic_unwind"
version = "0.0.0"
authors = ["Jeremy Soller <jackpot51@gmail.com>"]
[lib]
path = "../../rust/src/libpanic_unwind/lib.rs"
[dependencies]
libc = { path = "../libc/" }
unwind = { path = "../unwind/" }

View file

@ -1,10 +0,0 @@
[package]
name = "unwind"
version = "0.0.0"
authors = ["Jeremy Soller <jackpot51@gmail.com>"]
[lib]
path = "../../rust/src/libunwind/lib.rs"
[dependencies]
libc = { path = "../libc/" }

@ -1 +1 @@
Subproject commit a421d6485bd72b1366f66a2572ca0677c55c4e59 Subproject commit ed85622c9f22400bfbe5c6ce393fb86a7d7b40a9

@ -1 +1 @@
Subproject commit 24293ce46a3f97ea39694599115b612183388b7a Subproject commit 814ef74af0905730ef6d32bdb47f76ddfe52c127

@ -1 +1 @@
Subproject commit 7d524f1af9cdc6310c0b5e9adc79025db0236db4 Subproject commit 632a426febb1da816b2702667529ad19a71eca00

2
rust

@ -1 +1 @@
Subproject commit 92c8e0f352b1aecfb13195266bf134e6c3597849 Subproject commit 63df8c19339c0d4876f6b3969c0654200dc4f2a0

View file

@ -4,3 +4,4 @@ version = "0.1.0"
[dependencies] [dependencies]
raw-cpuid = "2.*" raw-cpuid = "2.*"
redox_syscall = { path = "../../syscall/" }

View file

@ -8,7 +8,8 @@
"env": "", "env": "",
"vendor": "unknown", "vendor": "unknown",
"target-family": "redox", "target-family": "redox",
"pre-link-args": ["-m64", "-nostdlib", "-static"], "pre-link-args": ["-m64", "-Wl,--as-needed", "-Wl,-z,noexecstack", "-nostartfiles", "-nostdlib", "-static"],
"late-link-args": ["libc-artifacts/lib/crt0.o", "libc-artifacts/lib/libm.a", "libc-artifacts/lib/libc.a", "libc-artifacts/lib/libgcc.a"],
"features": "", "features": "",
"dynamic-linking": false, "dynamic-linking": false,
"executables": true, "executables": true,
@ -21,6 +22,8 @@
"no-compiler-rt": true, "no-compiler-rt": true,
"no-default-libraries": true, "no-default-libraries": true,
"position-independent-executables": false, "position-independent-executables": false,
"lib-allocation-crate": "alloc_system",
"exe-allocation-crate": "alloc_system",
"has-elf-tls": true, "has-elf-tls": true,
"panic-strategy": "abort" "panic-strategy": "abort"
} }