]> 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 7c369daa2a8f6e966cad3be1f220037f2a7631db..7c24c88f7aee07a2e28464b4f8f7df49bdac56a6 100644 (file)
@@ -21,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] = &[
@@ -56,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(),