zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit d78a2619bad84e47f288cecd35d35a0233c17beb (tree)
parent c1f404ad537ded5a584525f7f89dcf5705a2c405
Author: Michael Dusan <michael.dusan@gmail.com>
Date:   Mon,  2 Jan 2023 19:18:32 -0500

link.Elf: resolve CsuObjects TODO

Diffstat:
Msrc/link/Elf.zig | 18++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/src/link/Elf.zig b/src/link/Elf.zig @@ -3058,27 +3058,22 @@ const CsuObjects = struct { var result: CsuObjects = .{}; - // TODO: https://github.com/ziglang/zig/issues/4629 - // - use inline enum type - // - reduce to enum-literals for values - const Mode = enum { + // Flatten crt cases. + const mode: enum { dynamic_lib, dynamic_exe, dynamic_pie, static_exe, static_pie, - }; - - // Flatten crt case types. - const mode: Mode = switch (link_options.output_mode) { + } = switch (link_options.output_mode) { .Obj => return CsuObjects{}, .Lib => switch (link_options.link_mode) { - .Dynamic => Mode.dynamic_lib, + .Dynamic => .dynamic_lib, .Static => return CsuObjects{}, }, .Exe => switch (link_options.link_mode) { - .Dynamic => if (link_options.pie) Mode.dynamic_pie else Mode.dynamic_exe, - .Static => if (link_options.pie) Mode.static_pie else Mode.static_exe, + .Dynamic => if (link_options.pie) .dynamic_pie else .dynamic_exe, + .Static => if (link_options.pie) .static_pie else .static_exe, }, }; @@ -3108,7 +3103,6 @@ const CsuObjects = struct { // hosted-glibc provides crtbegin/end objects in platform/compiler-specific dirs // and they are not known at comptime. For now null-out crtbegin/end objects; // there is no feature loss, zig has never linked those objects in before. - // TODO: probe for paths, ie. `cc -print-file-name` result.crtbegin = null; result.crtend = null; } else {