]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_target/spec/x86_64_fortanix_unknown_sgx.rs
SGX target: don't pretend to be GNU/Linux to LLVM
[rust.git] / src / librustc_target / spec / x86_64_fortanix_unknown_sgx.rs
index 6a6aab2bea3664d9794162cb0f77825c2c7d6d0b..7c24c88f7aee07a2e28464b4f8f7df49bdac56a6 100644 (file)
@@ -1,13 +1,3 @@
-// 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, PanicStrategy, Target, TargetOptions};
@@ -31,6 +21,15 @@ pub fn target() -> Result<Target, String> {
         "-Wl,--no-undefined-version",
         "-Wl,-Bsymbolic",
         "-Wl,--export-dynamic",
+        // The following symbols are needed by libunwind, which is linked after
+        // libstd. Make sure they're included in the link.
+        "-Wl,-u,__rust_abort",
+        "-Wl,-u,__rust_c_alloc",
+        "-Wl,-u,__rust_c_dealloc",
+        "-Wl,-u,__rust_print_err",
+        "-Wl,-u,__rust_rwlock_rdlock",
+        "-Wl,-u,__rust_rwlock_unlock",
+        "-Wl,-u,__rust_rwlock_wrlock",
     ];
 
     const EXPORT_SYMBOLS: &[&str] = &[
@@ -66,7 +65,7 @@ pub fn target() -> Result<Target, String> {
         ..Default::default()
     };
     Ok(Target {
-        llvm_target: "x86_64-unknown-linux-gnu".into(),
+        llvm_target: "x86_64-elf".into(),
         target_endian: "little".into(),
         target_pointer_width: "64".into(),
         target_c_int_width: "32".into(),