diff options
| author | Layne Gustafson <lgustaf1@binghamton.edu> | 2020-01-08 21:35:26 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-01-19 20:53:19 -0500 |
| commit | 03dd376b55a57cbc10269f771f72ced1eaa7aabb (patch) | |
| tree | 658d37e3db712e3b35d47fbb7b3514c7b741677c /src/main.cpp | |
| parent | c61856ebcf54a55f1c17a5fd6a3b3300115b2c65 (diff) | |
| download | zig-03dd376b55a57cbc10269f771f72ced1eaa7aabb.tar.gz zig-03dd376b55a57cbc10269f771f72ced1eaa7aabb.zip | |
Add builtin.zig support
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/src/main.cpp b/src/main.cpp index da8b354796..f40f62a653 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1074,6 +1074,24 @@ int main(int argc, char **argv) { } } + Stage2TargetDetails *target_details = nullptr; + if (cpu && features) { + fprintf(stderr, "--cpu and --features options not allowed together\n"); + return main_exit(root_progress_node, EXIT_FAILURE); + } else if (cpu) { + target_details = stage2_target_details_parse_cpu(target_arch_name(target.arch), cpu); + if (!target_details) { + fprintf(stderr, "invalid --cpu value\n"); + return main_exit(root_progress_node, EXIT_FAILURE); + } + } else if (features) { + target_details = stage2_target_details_parse_features(target_arch_name(target.arch), features); + if (!target_details) { + fprintf(stderr, "invalid --features value\n"); + return main_exit(root_progress_node, EXIT_FAILURE); + } + } + if (output_dir != nullptr && enable_cache == CacheOptOn) { fprintf(stderr, "`--output-dir` is incompatible with --cache on.\n"); return print_error_usage(arg0); @@ -1124,6 +1142,7 @@ int main(int argc, char **argv) { g->want_stack_check = want_stack_check; g->want_sanitize_c = want_sanitize_c; g->want_single_threaded = want_single_threaded; + g->target_details = target_details; Buf *builtin_source = codegen_generate_builtin_source(g); if (fwrite(buf_ptr(builtin_source), 1, buf_len(builtin_source), stdout) != buf_len(builtin_source)) { fprintf(stderr, "unable to write to stdout: %s\n", strerror(ferror(stdout))); @@ -1278,24 +1297,6 @@ int main(int argc, char **argv) { codegen_add_rpath(g, rpath_list.at(i)); } - Stage2TargetDetails *target_details = nullptr; - if (cpu && features) { - fprintf(stderr, "--cpu and --features options not allowed together\n"); - return main_exit(root_progress_node, EXIT_FAILURE); - } else if (cpu) { - target_details = stage2_target_details_parse_cpu(target_arch_name(target.arch), cpu); - if (!target_details) { - fprintf(stderr, "invalid --cpu value\n"); - return main_exit(root_progress_node, EXIT_FAILURE); - } - } else if (features) { - target_details = stage2_target_details_parse_features(target_arch_name(target.arch), features); - if (!target_details) { - fprintf(stderr, "invalid --features value\n"); - return main_exit(root_progress_node, EXIT_FAILURE); - } - } - g->target_details = target_details; codegen_set_rdynamic(g, rdynamic); |
