Skip to content

Commit

Permalink
Fix error message for invalid code/reloc models
Browse files Browse the repository at this point in the history
  • Loading branch information
Amanieu committed Nov 3, 2017
1 parent 8b22e70 commit 37b015f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 6 additions & 0 deletions src/librustc_back/target/mod.rs
Expand Up @@ -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.
Expand Down Expand Up @@ -450,6 +453,7 @@ impl Default for 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,
Expand Down Expand Up @@ -696,6 +700,7 @@ impl Target {
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);
Expand Down Expand Up @@ -888,6 +893,7 @@ impl ToJson for Target {
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);
Expand Down
4 changes: 1 addition & 3 deletions src/librustc_trans/back/write.rs
Expand Up @@ -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!();
}
Expand Down
4 changes: 1 addition & 3 deletions src/librustc_trans/context.rs
Expand Up @@ -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!();
}
Expand Down

0 comments on commit 37b015f

Please sign in to comment.