-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pushing changes to diagnose rustc ICE
- Loading branch information
Showing
5 changed files
with
65 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
rustc main.rs --opt-level 3 --emit=obj --target=arm-unknown-linux-gnueabi | ||
#rustc --crate-type rlib ./boards/realview-eb-mpcore/board.rs --target=arm-unknown-linux-gnueabi | ||
#rustc --crate-type rlib ./core/core.rs --target=arm-unknown-linux-gnueabi | ||
rustc -L . main.rs --opt-level 3 --emit=obj --target=arm-unknown-linux-gnueabi | ||
arm-ld main.o -o rustk.elf | ||
arm-objcopy -j .text -O binary rustk.elf rustk.bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#![feature(lang_items)] | ||
#![no_std] | ||
|
||
#[lang="sized"] | ||
trait Sized {} | ||
#[lang="sync"] | ||
trait Sync {} | ||
|
||
#[lang = "stack_exhausted"] extern fn stack_exhausted() {} | ||
#[lang = "eh_personality"] extern fn eh_personality() {} | ||
#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} } | ||
|
||
#[lang = "exchange_heap"] | ||
#[experimental = "may be renamed; uncertain about custom allocator design"] | ||
pub static HEAP: () = (); | ||
|
||
/// A type that represents a uniquely-owned value. | ||
#[lang = "owned_box"] | ||
#[unstable = "custom allocators will add an additional type parameter (with default)"] | ||
pub struct Box<T>(*mut T); | ||
|
||
struct Global { | ||
heapoffset: uint, | ||
curheapndx: uint | ||
} | ||
|
||
static mut GLOBAL: Global = Global { | ||
heapoffset: 0, | ||
curheapndx: 0 | ||
}; | ||
|
||
#[lang="exchange_malloc"] | ||
#[inline] | ||
unsafe fn exchange_malloc(size: uint, align: uint) -> *mut u8 { | ||
// The most simple heap possible! | ||
let ptr: uint; | ||
ptr = GLOBAL.heapoffset + GLOBAL.curheapndx; | ||
GLOBAL.curheapndx += size; | ||
|
||
ptr as *mut u8 | ||
} | ||
|
||
#[lang="exchange_free"] | ||
#[inline] | ||
unsafe fn exchange_free(ptr: *mut u8, old_size: uint, align: uint) { | ||
// The most simple heap possible. It does not support | ||
// deallocation! | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters