From 0b4db94aba4220f21cdd4f5f6c11e2f5c1cb8f64 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Fri, 15 Apr 2016 09:13:28 -0500 Subject: [PATCH 1/2] librustc_back: expose all target options via JSON Not all TargetOptions are exposed via the JSON interface to create different targets. This exposes all the missing items and reorders them to match the structure so that it is easier in the future to identify missing items. Signed-off-by: Doug Goldstein --- src/librustc_back/target/mod.rs | 35 ++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs index 72c99d57963c5..81a1843a9dd9c 100644 --- a/src/librustc_back/target/mod.rs +++ b/src/librustc_back/target/mod.rs @@ -415,36 +415,47 @@ impl Target { } ); } - key!(cpu); - key!(ar); + key!(data_layout, optional); key!(linker); + key!(ar); + key!(pre_link_args, list); + key!(post_link_args, list); + key!(cpu); + key!(features); + key!(dynamic_linking, bool); + key!(executables, bool); key!(relocation_model); key!(code_model); + key!(disable_redzone, bool); + key!(eliminate_frame_pointer, bool); + key!(function_sections, bool); key!(dll_prefix); key!(dll_suffix); key!(exe_suffix); key!(staticlib_prefix); key!(staticlib_suffix); - key!(features); - key!(data_layout, optional); - key!(dynamic_linking, bool); - key!(executables, bool); - key!(disable_redzone, bool); - key!(eliminate_frame_pointer, bool); - key!(function_sections, bool); key!(target_family, optional); key!(is_like_osx, bool); + key!(is_like_solaris, bool); key!(is_like_windows, bool); + key!(is_like_android, bool); key!(is_like_msvc, bool); key!(linker_is_gnu, bool); key!(has_rpath, bool); key!(no_compiler_rt, bool); key!(no_default_libraries, bool); - key!(pre_link_args, list); - key!(post_link_args, list); + key!(position_independent_executables, bool); + key!(pre_link_objects_exe, list); + key!(pre_link_objects_dll, list); + key!(post_link_objects, list); + key!(late_link_args, list); key!(archive_format); - key!(allow_asm, bool); key!(custom_unwind_resume, bool); + key!(lib_allocation_crate); + key!(exe_allocation_crate); + key!(allow_asm, bool); + key!(has_elf_tls, bool); + key!(obj_is_bitcode, bool); base } From 492b985190a3fbce9d6e2bf10263b59463e89f47 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Fri, 15 Apr 2016 09:16:56 -0500 Subject: [PATCH 2/2] librustc_back: add note about updating from_json() func Hopefully the note helps people remember to add any additional fields to the Target::from_json() function. Signed-off-by: Doug Goldstein --- src/librustc_back/target/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs index 81a1843a9dd9c..3829b26a97af2 100644 --- a/src/librustc_back/target/mod.rs +++ b/src/librustc_back/target/mod.rs @@ -169,6 +169,7 @@ pub struct Target { /// /// This has an implementation of `Default`, see each field for what the default is. In general, /// these try to take "minimal defaults" that don't assume anything about the runtime they run in. +/// Fields added here must be added to `Target::from_json()` #[derive(Clone, Debug)] pub struct TargetOptions { /// [Data layout](http://llvm.org/docs/LangRef.html#data-layout) to pass to LLVM.