diff options
| author | Michael Dusan <michael.dusan@gmail.com> | 2023-01-02 19:18:32 -0500 |
|---|---|---|
| committer | Michael Dusan <michael.dusan@gmail.com> | 2023-01-02 19:18:32 -0500 |
| commit | d78a2619bad84e47f288cecd35d35a0233c17beb (patch) | |
| tree | 7ab96508d4a23660710af49d5ce96e70dbe4cb8c /src/link/Elf.zig | |
| parent | c1f404ad537ded5a584525f7f89dcf5705a2c405 (diff) | |
| download | zig-d78a2619bad84e47f288cecd35d35a0233c17beb.tar.gz zig-d78a2619bad84e47f288cecd35d35a0233c17beb.zip | |
link.Elf: resolve CsuObjects TODO
Diffstat (limited to 'src/link/Elf.zig')
| -rw-r--r-- | src/link/Elf.zig | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/link/Elf.zig b/src/link/Elf.zig index 466442cd77..4910f4b599 100644 --- 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 { |
