Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Thog committed Apr 8, 2019
1 parent 00abbb0 commit 2459ffd
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
24 changes: 10 additions & 14 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ script = ["cp linker-scripts/bootstrap.ld link.T"]
workspace = false
script = ["cp linker-scripts/kernel.ld link.T"]

[tasks.userspace-linker]
workspace = false
script = ["cp linker-scripts/userspace.ld link.T"]

[tasks.install-rust-src]
install_crate = { rustup_component_name = "rust-src" }

Expand Down Expand Up @@ -55,70 +51,70 @@ args = ["xbuild", "--target=i386-unknown-none", "--package=sunrise-kernel", "--r
[tasks.vi]
workspace = false
description = "Compiles sunrise-vi"
dependencies = ["userspace-linker", "install-rust-src"]
dependencies = ["install-rust-src"]
command = "cargo"
args = ["xbuild", "--target=i386-unknown-none-user", "--package=sunrise-vi"]

[tasks.vi-release]
workspace = false
description = "Compiles sunrise-vi"
dependencies = ["userspace-linker", "install-rust-src"]
dependencies = ["install-rust-src"]
command = "cargo"
args = ["xbuild", "--target=i386-unknown-none-user", "--package=sunrise-vi", "--release"]

[tasks.sm]
workspace = false
description = "Compiles sunrise-sm"
dependencies = ["userspace-linker", "install-rust-src"]
dependencies = ["install-rust-src"]
command = "cargo"
args = ["xbuild", "--target=i386-unknown-none-user", "--package=sunrise-sm"]

[tasks.sm-release]
workspace = false
description = "Compiles sunrise-sm"
dependencies = ["userspace-linker", "install-rust-src"]
dependencies = ["install-rust-src"]
command = "cargo"
args = ["xbuild", "--target=i386-unknown-none-user", "--package=sunrise-sm", "--release"]

[tasks.shell]
workspace = false
description = "Compiles sunrise-shell"
dependencies = ["userspace-linker", "install-rust-src"]
dependencies = ["install-rust-src"]
command = "cargo"
args = ["xbuild", "--target=i386-unknown-none-user", "--package=sunrise-shell"]

[tasks.shell-release]
workspace = false
description = "Compiles sunrise-shell"
dependencies = ["userspace-linker", "install-rust-src"]
dependencies = ["install-rust-src"]
command = "cargo"
args = ["xbuild", "--target=i386-unknown-none-user", "--package=sunrise-shell", "--release"]

[tasks.clock]
workspace = false
description = "Compiles sunrise-clock"
dependencies = ["userspace-linker", "install-rust-src"]
dependencies = ["install-rust-src"]
command = "cargo"
args = ["xbuild", "--target=i386-unknown-none-user", "--package=sunrise-clock"]

[tasks.clock-release]
workspace = false
description = "Compiles sunrise-clock"
dependencies = ["userspace-linker", "install-rust-src"]
dependencies = ["install-rust-src"]
command = "cargo"
args = ["xbuild", "--target=i386-unknown-none-user", "--package=sunrise-clock", "--release"]

[tasks.ahci]
workspace = false
description = "Compiles sunrise-ahci"
dependencies = ["userspace-linker", "install-rust-src"]
dependencies = ["install-rust-src"]
command = "cargo"
args = ["xbuild", "--target=i386-unknown-none-user", "--package=sunrise-ahci"]

[tasks.ahci-release]
workspace = false
description = "Compiles sunrise-ahci"
dependencies = ["userspace-linker", "install-rust-src"]
dependencies = ["install-rust-src"]
command = "cargo"
args = ["xbuild", "--target=i386-unknown-none-user", "--package=sunrise-ahci", "--release"]

Expand Down
2 changes: 1 addition & 1 deletion i386-unknown-none-user.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"linker-is-gnu": true,
"pre-link-args": {
"ld.lld": [
"-Tlink.T"
"-Tlinker-scripts/userspace.ld"
]
},
"executables": true,
Expand Down
1 change: 1 addition & 0 deletions libuser/src/crt0/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub unsafe extern fn start() {
}

/// Clean module bss.
/// NOTE: Even if the bss should be cleared before calling anything in Rust, all functions used here are guaranteed to not use the bss.
#[cfg(target_os = "none")]
#[no_mangle]
#[link_section = ".text.crt0"]
Expand Down
15 changes: 9 additions & 6 deletions libuser/src/crt0/relocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,32 @@ mod module_header {
"#);
}

/// The definition of a MOD0 header.
/// The definition of a module header.
/// This is used by RTLD to do dynamic linking.
/// See https://switchbrew.org/wiki/NSO#MOD and https://switchbrew.org/wiki/Rtld
#[repr(C)]
#[derive(Debug)]
pub struct ModuleHeader {
/// The magic value of the MOD header.
pub magic: u32,

/// The offset of the dynamic section.
/// The offset of the dynamic section relative to ModuleHeader address.
pub dynamic_off: u32,

/// The offset of the start of the bss section.
/// The offset of the begining of the bss section relative to ModuleHeader address.
pub bss_start_off: u32,

/// The offset of the end of the bss section.
/// The offset of the end of the bss section relative to ModuleHeader address.
pub bss_end_off: u32,

/// The offset of the start of the eh_frame_hdr section.
/// The offset of the begining of the eh_frame_hdr section relative to ModuleHeader address.
pub unwind_start_off: u32,

/// The offset of the end of the eh_frame_hdr section.
/// The offset of the end of the eh_frame_hdr section relative to ModuleHeader address.
pub unwind_end_off: u32,

/// The offset of the module object that will be used by the rtld.
/// This offset is relative to ModuleHeader address.
pub module_object_off: u32
}

Expand Down

0 comments on commit 2459ffd

Please sign in to comment.