Build application at 0x0 in release mode.

This commit is contained in:
Yifan Wu 2020-12-02 09:40:00 +08:00
parent 1cef77eac7
commit 850559e5da
4 changed files with 3 additions and 40 deletions

View file

@ -11,7 +11,6 @@ mod lang_items;
#[no_mangle]
#[link_section = ".text.entry"]
pub extern "C" fn _start() -> ! {
clear_bss();
syscall::sys_exit(main());
panic!("unreachable after sys_exit!");
}
@ -22,14 +21,5 @@ fn main() -> i32 {
panic!("Cannot find main!");
}
fn clear_bss() {
extern "C" {
fn start_bss();
fn end_bss();
}
(start_bss as usize..end_bss as usize).for_each(|addr| {
unsafe { (addr as *mut u8).write_volatile(0); }
});
}
pub use syscall::*;

View file

@ -2,7 +2,7 @@
OUTPUT_ARCH(riscv)
ENTRY(_start)
BASE_ADDRESS = 0x80100000;
BASE_ADDRESS = 0x0;
SECTIONS
{
@ -18,9 +18,7 @@ SECTIONS
*(.data .data.*)
}
.bss : {
start_bss = .;
*(.bss .bss.*)
end_bss = .;
}
/DISCARD/ : {
*(.eh_frame)