Browse Source
Rust relies on atomic builtins, which are not implemented in libgcc for ARM. One is implemented in rust, which is sufficient to get the current rust test to run. Issue #1899devel
22 changed files with 198 additions and 7 deletions
@ -0,0 +1,27 @@
|
||||
build "core init test/rust" |
||||
|
||||
create_boot_directory |
||||
|
||||
install_config { |
||||
<config> |
||||
<parent-provides> |
||||
<service name="LOG"/> |
||||
<service name="RM"/> |
||||
<service name="ROM"/> |
||||
</parent-provides> |
||||
<default-route> |
||||
<any-service> <parent/> </any-service> |
||||
</default-route> |
||||
<start name="rust-test"> |
||||
<resource name="RAM" quantum="10M"/> |
||||
</start> |
||||
</config> |
||||
} |
||||
|
||||
build_boot_image "core init rust-test ld.lib.so libc.lib.so" |
||||
|
||||
append qemu_args "-nographic -m 64" |
||||
|
||||
run_genode_until { 42 } 10 |
||||
|
||||
puts "Test succeeded" |
@ -0,0 +1,9 @@
|
||||
{ |
||||
"llvm-target": "arm-pc-genode-elf", |
||||
"target-endian": "little", |
||||
"target-pointer-width": "32", |
||||
"arch": "arm", |
||||
"os": "genode", |
||||
"cpu": "generic", |
||||
"no_compiler_rt": true |
||||
} |
@ -0,0 +1,8 @@
|
||||
{ |
||||
"pre-link-args": ["-mriscv=RV64IAMFD"], |
||||
"llvm-target": "riscv-pc-genode-elf", |
||||
"target-endian": "little", |
||||
"target-pointer-width": "64", |
||||
"arch": "riscv", |
||||
"os": "genode" |
||||
} |
@ -0,0 +1,7 @@
|
||||
{ |
||||
"llvm-target": "i686-pc-genode-elf", |
||||
"target-endian": "little", |
||||
"target-pointer-width": "32", |
||||
"arch": "x86", |
||||
"os": "genode" |
||||
} |
@ -0,0 +1,8 @@
|
||||
{ |
||||
"pre-link-args": ["-m64"], |
||||
"llvm-target": "x86_64-pc-genode-elf", |
||||
"target-endian": "little", |
||||
"target-pointer-width": "64", |
||||
"arch": "x86_64", |
||||
"os": "genode" |
||||
} |
@ -0,0 +1,22 @@
|
||||
#![no_std] |
||||
#![feature(lang_items,collections)] |
||||
extern crate collections; |
||||
extern crate libc; |
||||
extern "C"{ |
||||
fn print_num(num: libc::c_int); |
||||
} |
||||
#[no_mangle] |
||||
pub fn main() -> libc::c_int{ |
||||
unsafe { |
||||
print_num(42); |
||||
} |
||||
0 |
||||
} |
||||
|
||||
#[lang="panic_fmt"] |
||||
#[no_mangle] |
||||
pub fn panic_fmt() -> ! { loop{} } |
||||
|
||||
#[lang="eh_personality"] |
||||
#[no_mangle] |
||||
pub fn eh_personality() -> ! { loop{} } |
@ -0,0 +1,4 @@
|
||||
#include <base/printf.h> |
||||
extern "C" void print_num(int num) { |
||||
Genode::printf("Number from rust: %d \n",num); |
||||
} |
@ -0,0 +1,4 @@
|
||||
TARGET = rust-test
|
||||
SRC_RS = main.rs
|
||||
SRC_CC = printf.cc
|
||||
LIBS = libcore-rust libcollections-rust base libc librustc_unicode-rust liballoc-rust liblibc-rust liballoc_system-rust
|
@ -0,0 +1,18 @@
|
||||
TARGET_DIR = src/lib/rust-targets/spec
|
||||
ifeq ($(filter-out $(SPECS),x86),) |
||||
ifeq ($(filter-out $(SPECS),32bit),)
|
||||
CC_RUSTC_OPT += --target $(call select_from_repositories,$(TARGET_DIR)/x86_32/target.json)
|
||||
endif # 32bit
|
||||
|
||||
ifeq ($(filter-out $(SPECS),64bit),)
|
||||
CC_RUSTC_OPT += --target $(call select_from_repositories,$(TARGET_DIR)/x86_64/target.json)
|
||||
endif # 64bit
|
||||
endif # x86
|
||||
|
||||
ifeq ($(filter-out $(SPECS),arm),) |
||||
CC_RUSTC_OPT += --target $(call select_from_repositories,$(TARGET_DIR)/arm/target.json)
|
||||
endif # ARM
|
||||
|
||||
ifeq ($(filter-out $(SPECS),riscv),) |
||||
CC_RUSTC_OPT += --target $(call select_from_repositories,$(TARGET_DIR)/riscv/target.json)
|
||||
endif # RISCV
|
@ -0,0 +1,3 @@
|
||||
LIBS = libcore-rust liballoc_system-rust
|
||||
RLIB = liballoc
|
||||
include $(REP_DIR)/lib/mk/rust.inc |
@ -0,0 +1,4 @@
|
||||
LIBS = libcore-rust liblibc-rust
|
||||
CC_RUSTC_OPT += --allow unused_features
|
||||
RLIB = liballoc_system
|
||||
include $(REP_DIR)/lib/mk/rust.inc |
@ -0,0 +1,3 @@
|
||||
LIBS = libcore-rust liballoc-rust librustc_unicode-rust
|
||||
RLIB = libcollections
|
||||
include $(REP_DIR)/lib/mk/rust.inc |
@ -0,0 +1,3 @@
|
||||
RLIB=libcore
|
||||
include $(REP_DIR)/lib/mk/rust.inc |
||||
include $(REP_DIR)/lib/import/import-libcore-rust.mk |
@ -0,0 +1,4 @@
|
||||
LIBS = libcore-rust libc ldso-startup
|
||||
RLIB = liblibc/src
|
||||
CC_RUSTC_OPT += --cfg 'target_os = "netbsd"'
|
||||
include $(REP_DIR)/lib/mk/rust.inc |
@ -0,0 +1,3 @@
|
||||
LIBS = libcore-rust
|
||||
RLIB = librustc_unicode
|
||||
include $(REP_DIR)/lib/mk/rust.inc |
@ -0,0 +1,4 @@
|
||||
SRC_RS = lib.rs |
||||
vpath % $(call select_from_ports,rust)/src/lib/rust/src/$(RLIB) |
||||
|
||||
# vi: set ft=make : |
@ -0,0 +1 @@
|
||||
613098635ba8ed06c7f8723670e240982ad0f112 |
@ -0,0 +1,8 @@
|
||||
LICENSE := MIT |
||||
VERSION := nightly |
||||
DATE := 2016-03-03 |
||||
DOWNLOADS := rust.archive |
||||
|
||||
URL(rust) := http://static.rust-lang.org/dist/$(DATE)/rustc-$(VERSION)-src.tar.gz |
||||
SHA(rust) := c75656f1238ce82e1cdede174d9cbc05f0b98ae2 |
||||
DIR(rust) := src/lib/rust |
Loading…
Reference in new issue