]> git.lizzy.rs Git - rust.git/commitdiff
Fix error message for invalid code/reloc models
authorAmanieu d'Antras <amanieu@gmail.com>
Tue, 31 Oct 2017 17:45:19 +0000 (17:45 +0000)
committerAmanieu d'Antras <amanieu@gmail.com>
Fri, 3 Nov 2017 00:28:50 +0000 (00:28 +0000)
src/librustc_back/target/mod.rs
src/librustc_trans/back/write.rs
src/librustc_trans/context.rs

index a56d067815819c9df04f2f814917a2c9caf00af3..8fd4aad89c643d4cec7a775794a33c00f816a845 100644 (file)
@@ -311,6 +311,9 @@ pub struct TargetOptions {
     pub relocation_model: String,
     /// Code model to use. Corresponds to `llc -code-model=$code_model`. Defaults to "default".
     pub code_model: String,
+    /// TLS model to use. Options are "global-dynamic" (default), "local-dynamic", "initial-exec"
+    /// and "local-exec". This is similar to the -ftls-model option in GCC/Clang.
+    pub tls_model: String,
     /// Do not emit code that uses the "red zone", if the ABI has one. Defaults to false.
     pub disable_redzone: bool,
     /// Eliminate frame pointers from stack frames if possible. Defaults to true.
@@ -450,6 +453,7 @@ fn default() -> TargetOptions {
             executables: false,
             relocation_model: "pic".to_string(),
             code_model: "default".to_string(),
+            tls_model: "global-dynamic".to_string(),
             disable_redzone: false,
             eliminate_frame_pointer: true,
             function_sections: true,
@@ -696,6 +700,7 @@ macro_rules! key {
         key!(executables, bool);
         key!(relocation_model);
         key!(code_model);
+        key!(tls_model);
         key!(disable_redzone, bool);
         key!(eliminate_frame_pointer, bool);
         key!(function_sections, bool);
@@ -888,6 +893,7 @@ macro_rules! target_option_val {
         target_option_val!(executables);
         target_option_val!(relocation_model);
         target_option_val!(code_model);
+        target_option_val!(tls_model);
         target_option_val!(disable_redzone);
         target_option_val!(eliminate_frame_pointer);
         target_option_val!(function_sections);
index 5550ab9fa55e6752863dc192fd75f9d29ee8eec9..6153d3dcdbba2da2d514671a2ca110623093eb6a 100644 (file)
@@ -173,9 +173,7 @@ pub fn target_machine_factory(sess: &Session)
         Some(x) => x.1,
         _ => {
             sess.err(&format!("{:?} is not a valid code model",
-                             sess.opts
-                                 .cg
-                                 .code_model));
+                              code_model_arg));
             sess.abort_if_errors();
             bug!();
         }
index 9df057c77a95d36c2909921fcfbbb237ecb2ce30..cd9cb8c0df531aed9c99f7abb4c123887ee9f7bf 100644 (file)
@@ -159,9 +159,7 @@ pub fn get_reloc_model(sess: &Session) -> llvm::RelocMode {
         Some(x) => x.1,
         _ => {
             sess.err(&format!("{:?} is not a valid relocation mode",
-                             sess.opts
-                                 .cg
-                                 .code_model));
+                              reloc_model_arg));
             sess.abort_if_errors();
             bug!();
         }