Skip to content

Commit

Permalink
Add L4Re Support in librustc_back
Browse files Browse the repository at this point in the history
Add support for x86_64-unknown-l4re-uclibc target, which covers
the L4 Runtime Environment.
  • Loading branch information
Tobias Schaffner committed Aug 4, 2017
1 parent eae446c commit c151220
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/librustc_back/target/l4re_base.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use PanicStrategy;
use LinkerFlavor;
use target::{LinkArgs, TargetOptions};
use std::default::Default;

pub fn opts() -> TargetOptions {
let mut pre_link_args = LinkArgs::new();
pre_link_args.insert(LinkerFlavor::Ld, vec![
"-nostdlib".to_string(),
]);

TargetOptions {
executables: true,
has_elf_tls: false,
exe_allocation_crate: Some("alloc_system".to_string()),
panic_strategy: PanicStrategy::Abort,
linker: "ld".to_string(),
pre_link_args: pre_link_args,
target_family: Some("unix".to_string()),
.. Default::default()
}
}
3 changes: 3 additions & 0 deletions src/librustc_back/target/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ mod solaris_base;
mod windows_base;
mod windows_msvc_base;
mod thumb_base;
mod l4re_base;
mod fuchsia_base;
mod redox_base;

Expand Down Expand Up @@ -193,6 +194,8 @@ supported_targets! {
("aarch64-unknown-fuchsia", aarch64_unknown_fuchsia),
("x86_64-unknown-fuchsia", x86_64_unknown_fuchsia),

("x86_64-unknown-l4re-uclibc", x86_64_unknown_l4re_uclibc),

("x86_64-unknown-redox", x86_64_unknown_redox),

("i386-apple-ios", i386_apple_ios),
Expand Down
31 changes: 31 additions & 0 deletions src/librustc_back/target/x86_64_unknown_l4re_uclibc.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use LinkerFlavor;
use target::{Target, TargetResult};

pub fn target() -> TargetResult {
let mut base = super::l4re_base::opts();
base.cpu = "x86-64".to_string();
base.max_atomic_width = Some(64);

Ok(Target {
llvm_target: "x86_64-unknown-l4re-uclibc".to_string(),
target_endian: "little".to_string(),
target_pointer_width: "64".to_string(),
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".to_string(),
arch: "x86_64".to_string(),
target_os: "l4re".to_string(),
target_env: "uclibc".to_string(),
target_vendor: "unknown".to_string(),
linker_flavor: LinkerFlavor::Ld,
options: base,
})
}

0 comments on commit c151220

Please sign in to comment.