Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
bc18857
Return &T / &mut T in ManuallyDrop Deref(Mut) impl
petertodd Oct 29, 2018
b937be8
Clarifying documentation for collections::hash_map::Entry::or_insert
meltinglava Nov 8, 2018
8b750a7
The example values are now easyer to differenciate
meltinglava Nov 13, 2018
a9a48ed
Fix VecDeque pretty-printer
tromey Nov 14, 2018
052bdff
lint based on closure pipe span
csmoe Nov 15, 2018
dbd9abd
update closure arg suggesstion ui test
csmoe Nov 15, 2018
7cb068e
add ui test
lcnr Nov 16, 2018
80c2101
change expected error message
lcnr Nov 16, 2018
218e35e
eat CloseDelim
lcnr Nov 16, 2018
675319e
lint if a private item has doctests
GuillaumeGomez Oct 25, 2018
4c4aff9
remove license
lcnr Nov 16, 2018
646d68f
add a note to the error message
lcnr Nov 16, 2018
fe23ffb
improve error when self is used as not the first argument
lcnr Nov 16, 2018
2be930b
fix tidy (remove whitespace)
lcnr Nov 16, 2018
5bfdcc1
remove stray file with UI testing output
lcnr Nov 17, 2018
d93e5b0
reserve whitespaces between prefix and pipe
csmoe Nov 17, 2018
7c9bcc5
Update any.rs documentation using keyword dyn
0xrgb Nov 19, 2018
a44e446
Add `override_export_symbols` option to Rust target specification
Nov 19, 2018
b8da719
Fix error message for `-C panic=xxx`.
ehuss Nov 19, 2018
88d6094
improve error note
lcnr Nov 20, 2018
8a0909d
Remove incorrect doc comment
bjorn3 Nov 20, 2018
9ce7b11
Remove incorrect doc comment in rustc_mir::monomorphize::item
bjorn3 Nov 20, 2018
9e2e575
Add x86_64-fortanix-unknown-sgx target to the compiler
Nov 19, 2018
e538a4a
core/benches/num: Add `from_str/from_str_radix()` benchmarks
Turbo87 Nov 13, 2018
9aedfd5
Rollup merge of #55367 - GuillaumeGomez:private-item-doc-test-lint, r…
GuillaumeGomez Nov 22, 2018
1c57f0a
Rollup merge of #55485 - petertodd:2018-10-manuallydrop-deref, r=TimNN
GuillaumeGomez Nov 22, 2018
89e0fce
Rollup merge of #55784 - meltinglava:master, r=KodrAus
GuillaumeGomez Nov 22, 2018
fa3941c
Rollup merge of #55961 - tromey:Bug-55944-vecdeque, r=nikomatsakis
GuillaumeGomez Nov 22, 2018
636f0a9
Rollup merge of #55980 - csmoe:issue-55891, r=estebank
GuillaumeGomez Nov 22, 2018
75d226e
Rollup merge of #56002 - Axary:master, r=estebank
GuillaumeGomez Nov 22, 2018
1646fc9
Rollup merge of #56063 - 0xrgb:patch-1, r=joshtriplett
GuillaumeGomez Nov 22, 2018
b473157
Rollup merge of #56067 - jethrogb:jb/sgx-target-spec, r=alexcrichton
GuillaumeGomez Nov 22, 2018
1bc9708
Rollup merge of #56078 - ehuss:fix-panic-opt-msg, r=alexcrichton
GuillaumeGomez Nov 22, 2018
6afecfd
Rollup merge of #56106 - bjorn3:patch-1, r=alexcrichton
GuillaumeGomez Nov 22, 2018
61d7b3e
Rollup merge of #56126 - Turbo87:bench-parse, r=alexcrichton
GuillaumeGomez Nov 22, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/librustc_codegen_ssa/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,10 @@ impl<'a> Linker for WasmLd<'a> {
}

fn exported_symbols(tcx: TyCtxt, crate_type: CrateType) -> Vec<String> {
if let Some(ref exports) = tcx.sess.target.target.options.override_export_symbols {
return exports.clone()
}

let mut symbols = Vec::new();

let export_threshold = symbol_export::crates_export_threshold(&[crate_type]);
Expand Down
17 changes: 17 additions & 0 deletions src/librustc_target/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,8 @@ supported_targets! {
("riscv32imac-unknown-none-elf", riscv32imac_unknown_none_elf),

("aarch64-unknown-none", aarch64_unknown_none),

("x86_64-fortanix-unknown-sgx", x86_64_fortanix_unknown_sgx),
}

/// Everything `rustc` knows about how to compile for a specific target.
Expand Down Expand Up @@ -685,6 +687,10 @@ pub struct TargetOptions {
/// target features. This is `true` by default, and `false` for targets like
/// wasm32 where the whole program either has simd or not.
pub simd_types_indirect: bool,

/// If set, have the linker export exactly these symbols, instead of using
/// the usual logic to figure this out from the crate itself.
pub override_export_symbols: Option<Vec<String>>
}

impl Default for TargetOptions {
Expand Down Expand Up @@ -765,6 +771,7 @@ impl Default for TargetOptions {
emit_debug_gdb_scripts: true,
requires_uwtable: false,
simd_types_indirect: true,
override_export_symbols: None,
}
}
}
Expand Down Expand Up @@ -900,6 +907,14 @@ impl Target {
)
);
} );
($key_name:ident, opt_list) => ( {
let name = (stringify!($key_name)).replace("_", "-");
obj.find(&name[..]).map(|o| o.as_array()
.map(|v| base.options.$key_name = Some(v.iter()
.map(|a| a.as_string().unwrap().to_string()).collect())
)
);
} );
($key_name:ident, optional) => ( {
let name = (stringify!($key_name)).replace("_", "-");
if let Some(o) = obj.find(&name[..]) {
Expand Down Expand Up @@ -1046,6 +1061,7 @@ impl Target {
key!(emit_debug_gdb_scripts, bool);
key!(requires_uwtable, bool);
key!(simd_types_indirect, bool);
key!(override_export_symbols, opt_list);

if let Some(array) = obj.find("abi-blacklist").and_then(Json::as_array) {
for name in array.iter().filter_map(|abi| abi.as_string()) {
Expand Down Expand Up @@ -1255,6 +1271,7 @@ impl ToJson for Target {
target_option_val!(emit_debug_gdb_scripts);
target_option_val!(requires_uwtable);
target_option_val!(simd_types_indirect);
target_option_val!(override_export_symbols);

if default.abi_blacklist != self.options.abi_blacklist {
d.insert("abi-blacklist".to_string(), self.options.abi_blacklist.iter()
Expand Down
72 changes: 72 additions & 0 deletions src/librustc_target/spec/x86_64_fortanix_unknown_sgx.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright 2018 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 std::iter;

use super::{LinkerFlavor, Target, TargetOptions, PanicStrategy};

pub fn target() -> Result<Target, String> {
const PRE_LINK_ARGS: &[&str] = &[
"-Wl,--as-needed",
"-Wl,-z,noexecstack",
"-m64",
"-fuse-ld=gold",
"-nostdlib",
"-shared",
"-Wl,-e,sgx_entry",
"-Wl,-Bstatic",
"-Wl,--gc-sections",
"-Wl,-z,text",
"-Wl,-z,norelro",
"-Wl,--rosegment",
"-Wl,--no-undefined",
"-Wl,--error-unresolved-symbols",
"-Wl,--no-undefined-version",
"-Wl,-Bsymbolic",
"-Wl,--export-dynamic",
];
const EXPORT_SYMBOLS: &[&str] = &[
"sgx_entry",
"HEAP_BASE",
"HEAP_SIZE",
"RELA",
"RELACOUNT",
"ENCLAVE_SIZE",
"CFGDATA_BASE",
"DEBUG",
];
let opts = TargetOptions {
dynamic_linking: false,
executables: true,
linker_is_gnu: true,
max_atomic_width: Some(64),
panic_strategy: PanicStrategy::Abort,
cpu: "x86-64".into(),
position_independent_executables: true,
pre_link_args: iter::once(
(LinkerFlavor::Gcc, PRE_LINK_ARGS.iter().cloned().map(String::from).collect())
).collect(),
override_export_symbols: Some(EXPORT_SYMBOLS.iter().cloned().map(String::from).collect()),
..Default::default()
};
Ok(Target {
llvm_target: "x86_64-unknown-linux-gnu".into(),
target_endian: "little".into(),
target_pointer_width: "64".into(),
target_c_int_width: "32".into(),
target_os: "unknown".into(),
target_env: "sgx".into(),
target_vendor: "fortanix".into(),
data_layout: "e-m:e-i64:64-f80:128-n8:16:32:64-S128".into(),
arch: "x86_64".into(),
linker_flavor: LinkerFlavor::Gcc,
options: opts,
})
}