File tree Expand file tree Collapse file tree 4 files changed +18
-24
lines changed Expand file tree Collapse file tree 4 files changed +18
-24
lines changed Original file line number Diff line number Diff line change 8
8
crate-type = [" staticlib" ]
9
9
10
10
[dependencies ]
11
+ compiler_builtins = { git = " https://github.com/rust-lang-nursery/compiler-builtins" }
11
12
rlibc = " 1.0.0"
12
13
spin = " 0.3.4"
13
14
volatile = " 0.1.0"
Original file line number Diff line number Diff line change 1
1
# Target and build files
2
2
arch ?= x86
3
3
target ?= i386
4
- system ?= linux
5
4
build ?= debug
6
5
7
6
# Flags
8
7
CFLAGS := --target=$(target ) -unknown-none-elf -ffreestanding
9
8
ASFLAGS := -masm=intel
10
- LDFLAGS := -n -nostdlib - -gc-sections -melf_$(target )
9
+ LDFLAGS := -n --gc-sections -melf_$(target )
11
10
12
11
# Rust target
13
12
rust_arch := $(target )
14
13
ifeq ($(rust_arch ) ,i386)
15
14
rust_arch := i686
16
- else
17
- CFLAGS += -mno-red-zone
18
15
endif
19
16
20
17
# Debug flags
@@ -28,15 +25,7 @@ kernel := build/rxinu-$(arch)-$(target).bin
28
25
iso := build/rxinu-$(arch ) -$(target ) .iso
29
26
30
27
# Rust Binaries
31
-
32
- # Target
33
- ifeq ($(system ) ,linux)
34
- rust_target ?= $(rust_arch)-unknown-linux-gnu
35
- endif
36
- ifeq ($(system ) ,apple)
37
- rust_target ?= $(rust_arch)-apple-darwin
38
- endif
39
-
28
+ rust_target ?= $(rust_arch ) -unknown-linux-gnu
40
29
rust_os := target/$(rust_target ) /debug/librxinu.a
41
30
42
31
# Source files
Original file line number Diff line number Diff line change @@ -13,31 +13,31 @@ SECTIONS
13
13
/* First put the multiboot header, as it is required to be put very early
14
14
early in the image or the bootloader won't recognize the file format.
15
15
Next we'll put the .text section. */
16
- .text :
16
+ .text BLOCK (4K) : ALIGN (4K)
17
17
{
18
18
KEEP(*(.multiboot_header))
19
19
*(.text .text.*)
20
20
}
21
21
22
22
/* Read-only data. */
23
- .rodata :
23
+ .rodata BLOCK (4K) : ALIGN (4K)
24
24
{
25
25
*(.rodata .rodata.*)
26
26
}
27
27
28
- .data.rel.ro :
29
- {
30
- *(.data.rel.ro.local*) *(.data.rel.ro .data.rel.ro.*)
31
- }
32
-
33
28
/* Read-write data (initialized) */
34
- .data :
29
+ .data BLOCK (4K) : ALIGN (4K)
30
+ {
31
+ *(.data .data.*)
32
+ }
33
+
34
+ .data.rel.ro BLOCK (4K) : ALIGN (4K)
35
35
{
36
- *(.data)
36
+ *(.data.rel.ro.local*) *(.data.rel.ro .data.rel.ro.* )
37
37
}
38
38
39
39
/* Read-write data (uninitialized) and stack */
40
- .bss :
40
+ .bss BLOCK (4K) : ALIGN (4K)
41
41
{
42
42
*(COMMON)
43
43
*(.bss)
Original file line number Diff line number Diff line change 3
3
#![ feature( unique) ]
4
4
#![ no_std]
5
5
6
+ #![ feature( compiler_builtins_lib) ]
7
+ extern crate compiler_builtins;
8
+
6
9
extern crate rlibc;
7
10
extern crate spin;
8
11
extern crate volatile;
@@ -20,7 +23,8 @@ pub extern fn rust_main() {
20
23
}
21
24
22
25
#[ lang = "eh_personality" ] extern fn eh_personality ( ) { }
23
- #[ lang = "panic_fmt" ] extern fn panic_fmt ( ) -> ! { loop { } }
26
+
27
+ #[ lang = "panic_fmt" ] #[ no_mangle] extern fn panic_fmt ( ) -> ! { loop { } }
24
28
25
29
#[ allow( non_snake_case) ]
26
30
#[ no_mangle]
You can’t perform that action at this time.
0 commit comments