diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-02-25 01:52:27 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-02-28 14:51:53 -0500 |
| commit | 4616af0ca459358ffa09ba27f9daa8527a38fd35 (patch) | |
| tree | 2705847ded931e30dc924bd44acf24847743855c /src/main.cpp | |
| parent | fba39ff331a84f1a32d076ccbb8b87cd02ea7121 (diff) | |
| download | zig-4616af0ca459358ffa09ba27f9daa8527a38fd35.tar.gz zig-4616af0ca459358ffa09ba27f9daa8527a38fd35.zip | |
introduce operating system version ranges as part of the target
* re-introduce `std.build.Target` which is distinct from `std.Target`.
`std.build.Target` wraps `std.Target` so that it can be annotated as
"the native target" or an explicitly specified target.
* `std.Target.Os` is moved to `std.Target.Os.Tag`. The former is now a
struct which has the tag as well as version range information.
* `std.elf` gains some more ELF header constants.
* `std.Target.parse` gains the ability to parse operating system
version ranges as well as glibc version.
* Added `std.Target.isGnuLibC()`.
* self-hosted dynamic linker detection and glibc version detection.
This also adds the improved logic using `/usr/bin/env` rather than
invoking the system C compiler to find the dynamic linker when zig
is statically linked. Related: #2084
Note: this `/usr/bin/env` code is work-in-progress.
* `-target-glibc` CLI option is removed in favor of the new `-target`
syntax. Example: `-target x86_64-linux-gnu.2.27`
closes #1907
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 29 |
1 files changed, 1 insertions, 28 deletions
diff --git a/src/main.cpp b/src/main.cpp index a4ab719123..11612402ee 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -89,8 +89,7 @@ static int print_full_usage(const char *arg0, FILE *file, int return_code) { " --single-threaded source may assume it is only used single-threaded\n" " -dynamic create a shared library (.so; .dll; .dylib)\n" " --strip exclude debug symbols\n" - " -target [name] <arch><sub>-<os>-<abi> see the targets command\n" - " -target-glibc [version] target a specific glibc version (default: 2.17)\n" + " -target [name] <arch>-<os>-<abi> see the targets command\n" " --verbose-tokenize enable compiler debug output for tokenization\n" " --verbose-ast enable compiler debug output for AST parsing\n" " --verbose-link enable compiler debug output for linking\n" @@ -419,7 +418,6 @@ static int main0(int argc, char **argv) { const char *mios_version_min = nullptr; const char *linker_script = nullptr; Buf *version_script = nullptr; - const char *target_glibc = nullptr; ZigList<const char *> rpath_list = {0}; bool each_lib_rpath = false; ZigList<const char *> objects = {0}; @@ -853,8 +851,6 @@ static int main0(int argc, char **argv) { linker_script = argv[i]; } else if (strcmp(arg, "--version-script") == 0) { version_script = buf_create_from_str(argv[i]); - } else if (strcmp(arg, "-target-glibc") == 0) { - target_glibc = argv[i]; } else if (strcmp(arg, "-rpath") == 0) { rpath_list.append(argv[i]); } else if (strcmp(arg, "--test-filter") == 0) { @@ -982,29 +978,6 @@ static int main0(int argc, char **argv) { "See `%s targets` to display valid targets.\n", err_str(err), arg0); return print_error_usage(arg0); } - if (target_is_glibc(&target)) { - target.glibc_version = heap::c_allocator.create<ZigGLibCVersion>(); - - if (target_glibc != nullptr) { - if ((err = target_parse_glibc_version(target.glibc_version, target_glibc))) { - fprintf(stderr, "invalid glibc version '%s': %s\n", target_glibc, err_str(err)); - return print_error_usage(arg0); - } - } else { - target_init_default_glibc_version(&target); -#if defined(ZIG_OS_LINUX) - if (target.is_native) { - // TODO self-host glibc version detection, and then this logic can go away - if ((err = glibc_detect_native_version(target.glibc_version))) { - // Fall back to the default version. - } - } -#endif - } - } else if (target_glibc != nullptr) { - fprintf(stderr, "'%s' is not a glibc-compatible target", target_string); - return print_error_usage(arg0); - } Buf zig_triple_buf = BUF_INIT; target_triple_zig(&zig_triple_buf, &target); |
