| author | |
| committer | |
| log | d3a99c7bd5396f2e458d844368ce2743934e43e2 |
| tree | af7d6aef6498a84d0d8ae779a2efecd2efff0ad6 |
| parent | cfbcb4116017a27a403f8be11a32f25f6c1c8671 |
and add missing usage help text3 files changed, 27 insertions(+), 52 deletions(-)
BRANCH_TODO+2-46| ... | ... | @@ -1,47 +1,3 @@ |
| 1 | * audit the CLI options for stage2 | |
| 1 | * building risc-v musl regression | |
| 2 | * go ahead and use allocSentinel now that the stage1 bug is fixed | |
| 2 | 3 | * audit the base cache hash |
| 3 | * try building some software with zig cc to make sure it didn't regress | |
| 4 | ||
| 5 | * On operating systems that support it, do an execve for `zig test` and `zig run` rather than child process. | |
| 6 | * implement proper parsing of clang stderr/stdout and exposing compile errors with the Compilation API | |
| 7 | * implement proper parsing of LLD stderr/stdout and exposing compile errors with the Compilation API | |
| 8 | * support cross compiling stage2 with `zig build` | |
| 9 | * implement proper compile errors for failing to build glibc crt files and shared libs | |
| 10 | * implement -fno-emit-bin | |
| 11 | * improve the stage2 tests to support testing with LLVM extensions enabled | |
| 12 | * implement emit-h in stage2 | |
| 13 | * multi-thread building C objects | |
| 14 | * implement serialization/deserialization of incremental compilation metadata | |
| 15 | * incremental compilation - implement detection of which source files changed | |
| 16 | * improve the cache hash logic for c objects with respect to extra flags and file parameters | |
| 17 | * LLVM codegen backend: put a sub-arch in the triple in some cases | |
| 18 | * implement an LLVM backend for stage2 | |
| 19 | * implement outputting dynamic libraries in self-hosted linker | |
| 20 | * implement outputting static libraries (archive files) in self-hosted linker | |
| 21 | * support linking against object files in self-hosted linker | |
| 22 | * avoid invoking lld when it's just 1 object file (the `zig cc -c` case) | |
| 23 | * `zig fmt --check` should output to stdout not stderr. | |
| 24 | * main.zig: If there was an argsAllocZ we could avoid this allocation | |
| 25 | * improve robustness of response file parsing | |
| 26 | * there are a couple panic("TODO") in clang options parsing | |
| 27 | * std.testing needs improvement to support exposing directory path for its tmp dir (look for "bogus") | |
| 28 | * integrate target features into building assembly code | |
| 29 | * libc_installation.zig: make it look for msvc only if msvc abi is chosen | |
| 30 | * switch the default C ABI for windows to be mingw-w64 | |
| 31 | - make it .obj instead of .o always for coff | |
| 32 | * change glibc log errors to normal exposed compile errors | |
| 33 | * improve Directory.join to only use 1 allocation in a clean way. | |
| 34 | * tracy builds with lc++ | |
| 35 | * some kind of "zig identifier escape" function rather than unconditionally using @"" syntax | |
| 36 | in builtin.zig | |
| 37 | * rename std.builtin.Mode to std.builtin.OptimizeMode | |
| 38 | * implement `zig run` and `zig test` when combined with `--watch` | |
| 39 | * close the --pkg-begin --pkg-end Package directory handles | |
| 40 | * make std.Progress support multithreaded | |
| 41 | * update musl.zig static data to use native path separator in static data rather than replacing '/' at runtime | |
| 42 | * linking hello world with LLD, lld is silently calling exit(1) instead of reporting ok=false. when run standalone the error message is: ld.lld: error: section [index 3] has a sh_offset (0x57000) + sh_size (0x68) that is greater than the file size (0x57060) | |
| 43 | * submit PR to godbolt and update the CLI options (see changes to test/cli.zig) | |
| 44 | * make proposal about log levels | |
| 45 | * proposal for changing fs Z/W functions to be native paths and have a way to do native path string literals | |
| 46 | * proposal for block { break x; } | |
| 47 | * generally look for the "TODO surface this as a real compile error message" and fix all that stuff |
src/Compilation.zig+3-4| ... | ... | @@ -347,6 +347,7 @@ pub const InitOptions = struct { |
| 347 | 347 | rdynamic: bool = false, |
| 348 | 348 | strip: bool = false, |
| 349 | 349 | single_threaded: bool = false, |
| 350 | function_sections: bool = false, | |
| 350 | 351 | is_native_os: bool, |
| 351 | 352 | time_report: bool = false, |
| 352 | 353 | stack_report: bool = false, |
| ... | ... | @@ -355,7 +356,6 @@ pub const InitOptions = struct { |
| 355 | 356 | version_script: ?[]const u8 = null, |
| 356 | 357 | override_soname: ?[]const u8 = null, |
| 357 | 358 | linker_gc_sections: ?bool = null, |
| 358 | function_sections: ?bool = null, | |
| 359 | 359 | linker_allow_shlib_undefined: ?bool = null, |
| 360 | 360 | linker_bind_global_refs_locally: ?bool = null, |
| 361 | 361 | each_lib_rpath: ?bool = null, |
| ... | ... | @@ -538,7 +538,6 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { |
| 538 | 538 | }; |
| 539 | 539 | |
| 540 | 540 | const single_threaded = options.single_threaded or target_util.isSingleThreaded(options.target); |
| 541 | const function_sections = options.function_sections orelse false; | |
| 542 | 541 | |
| 543 | 542 | const llvm_cpu_features: ?[*:0]const u8 = if (build_options.have_llvm and use_llvm) blk: { |
| 544 | 543 | var buf = std.ArrayList(u8).init(arena); |
| ... | ... | @@ -589,7 +588,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { |
| 589 | 588 | cache.hash.add(pic); |
| 590 | 589 | cache.hash.add(stack_check); |
| 591 | 590 | cache.hash.add(link_mode); |
| 592 | cache.hash.add(function_sections); | |
| 591 | cache.hash.add(options.function_sections); | |
| 593 | 592 | cache.hash.add(strip); |
| 594 | 593 | cache.hash.add(link_libc); |
| 595 | 594 | cache.hash.add(options.link_libcpp); |
| ... | ... | @@ -757,7 +756,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { |
| 757 | 756 | .rpath_list = options.rpath_list, |
| 758 | 757 | .strip = strip, |
| 759 | 758 | .is_native_os = options.is_native_os, |
| 760 | .function_sections = options.function_sections orelse false, | |
| 759 | .function_sections = options.function_sections, | |
| 761 | 760 | .allow_shlib_undefined = options.linker_allow_shlib_undefined, |
| 762 | 761 | .bind_global_refs_locally = options.linker_bind_global_refs_locally orelse false, |
| 763 | 762 | .z_nodelete = options.linker_z_nodelete, |
src/main.zig+22-2| ... | ... | @@ -260,11 +260,13 @@ const usage_build_generic = |
| 260 | 260 | \\ -D[macro]=[value] Define C [macro] to [value] (1 if [value] omitted) |
| 261 | 261 | \\ --libc [file] Provide a file which specifies libc paths |
| 262 | 262 | \\ -cflags [flags] -- Set extra flags for the next positional C source files |
| 263 | \\ -ffunction-sections Places each function in a separate section | |
| 263 | 264 | \\ |
| 264 | 265 | \\Link Options: |
| 265 | 266 | \\ -l[lib], --library [lib] Link against system library |
| 266 | 267 | \\ -L[d], --library-directory [d] Add a directory to the library search path |
| 267 | \\ -T[script] Use a custom linker script | |
| 268 | \\ -T[script], --script [script] Use a custom linker script | |
| 269 | \\ --version-script [path] Provide a version .map file | |
| 268 | 270 | \\ --dynamic-linker [path] Set the dynamic interpreter path (usually ld.so) |
| 269 | 271 | \\ --each-lib-rpath Add rpath for each used dynamic library |
| 270 | 272 | \\ --version [ver] Dynamic library semver |
| ... | ... | @@ -273,7 +275,11 @@ const usage_build_generic = |
| 273 | 275 | \\ --eh-frame-hdr Enable C++ exception handling by passing --eh-frame-hdr to linker |
| 274 | 276 | \\ -dynamic Force output to be dynamically linked |
| 275 | 277 | \\ -static Force output to be statically linked |
| 278 | \\ -Bsymbolic Bind global references locally | |
| 276 | 279 | \\ --subsystem [subsystem] (windows) /SUBSYSTEM:<subsystem> to the linker\n" |
| 280 | \\ --stack [size] Override default stack size | |
| 281 | \\ -framework [name] (darwin) link against framework | |
| 282 | \\ -F[dir] (darwin) add search path for frameworks | |
| 277 | 283 | \\ |
| 278 | 284 | \\Test Options: |
| 279 | 285 | \\ --test-filter [text] Skip tests that do not match filter |
| ... | ... | @@ -381,6 +387,7 @@ fn buildOutputType( |
| 381 | 387 | var have_version = false; |
| 382 | 388 | var strip = false; |
| 383 | 389 | var single_threaded = false; |
| 390 | var function_sections = false; | |
| 384 | 391 | var watch = false; |
| 385 | 392 | var verbose_link = false; |
| 386 | 393 | var verbose_cc = false; |
| ... | ... | @@ -634,7 +641,15 @@ fn buildOutputType( |
| 634 | 641 | if (i + 1 >= args.len) fatal("expected parameter after {}", .{arg}); |
| 635 | 642 | i += 1; |
| 636 | 643 | try lib_dirs.append(args[i]); |
| 637 | } else if (mem.eql(u8, arg, "-T")) { | |
| 644 | } else if (mem.eql(u8, arg, "-F")) { | |
| 645 | if (i + 1 >= args.len) fatal("expected parameter after {}", .{arg}); | |
| 646 | i += 1; | |
| 647 | try framework_dirs.append(args[i]); | |
| 648 | } else if (mem.eql(u8, arg, "-framework")) { | |
| 649 | if (i + 1 >= args.len) fatal("expected parameter after {}", .{arg}); | |
| 650 | i += 1; | |
| 651 | try frameworks.append(args[i]); | |
| 652 | } else if (mem.eql(u8, arg, "-T") or mem.eql(u8, arg, "--script")) { | |
| 638 | 653 | if (i + 1 >= args.len) fatal("expected parameter after {}", .{arg}); |
| 639 | 654 | i += 1; |
| 640 | 655 | linker_script = args[i]; |
| ... | ... | @@ -819,6 +834,8 @@ fn buildOutputType( |
| 819 | 834 | strip = true; |
| 820 | 835 | } else if (mem.eql(u8, arg, "--single-threaded")) { |
| 821 | 836 | single_threaded = true; |
| 837 | } else if (mem.eql(u8, arg, "-ffunction-sections")) { | |
| 838 | function_sections = true; | |
| 822 | 839 | } else if (mem.eql(u8, arg, "--eh-frame-hdr")) { |
| 823 | 840 | link_eh_frame_hdr = true; |
| 824 | 841 | } else if (mem.eql(u8, arg, "-Bsymbolic")) { |
| ... | ... | @@ -843,6 +860,8 @@ fn buildOutputType( |
| 843 | 860 | linker_script = arg[2..]; |
| 844 | 861 | } else if (mem.startsWith(u8, arg, "-L")) { |
| 845 | 862 | try lib_dirs.append(arg[2..]); |
| 863 | } else if (mem.startsWith(u8, arg, "-F")) { | |
| 864 | try framework_dirs.append(arg[2..]); | |
| 846 | 865 | } else if (mem.startsWith(u8, arg, "-l")) { |
| 847 | 866 | // We don't know whether this library is part of libc or libc++ until we resolve the target. |
| 848 | 867 | // So we simply append to the list for now. |
| ... | ... | @@ -1555,6 +1574,7 @@ fn buildOutputType( |
| 1555 | 1574 | .stack_size_override = stack_size_override, |
| 1556 | 1575 | .strip = strip, |
| 1557 | 1576 | .single_threaded = single_threaded, |
| 1577 | .function_sections = function_sections, | |
| 1558 | 1578 | .self_exe_path = self_exe_path, |
| 1559 | 1579 | .rand = &default_prng.random, |
| 1560 | 1580 | .clang_passthrough_mode = arg_mode != .build, |