authorgravatar for michael.dusan@gmail.comMichael Dusan <michael.dusan@gmail.com> 2023-01-02 19:18:32-05:00
committergravatar for michael.dusan@gmail.comMichael Dusan <michael.dusan@gmail.com> 2023-01-02 19:18:32-05:00
logd78a2619bad84e47f288cecd35d35a0233c17beb
tree7ab96508d4a23660710af49d5ce96e70dbe4cb8c
parentc1f404ad537ded5a584525f7f89dcf5705a2c405
signaturelock-open Commit is signed but in an unrecognized format.

link.Elf: resolve CsuObjects TODO


1 files changed, 6 insertions(+), 12 deletions(-)

src/link/Elf.zig+6-12
......@@ -3058,27 +3058,22 @@ const CsuObjects = struct {
30583058
30593059 var result: CsuObjects = .{};
30603060
3061 // TODO: https://github.com/ziglang/zig/issues/4629
3062 // - use inline enum type
3063 // - reduce to enum-literals for values
3064 const Mode = enum {
3061 // Flatten crt cases.
3062 const mode: enum {
30653063 dynamic_lib,
30663064 dynamic_exe,
30673065 dynamic_pie,
30683066 static_exe,
30693067 static_pie,
3070 };
3071
3072 // Flatten crt case types.
3073 const mode: Mode = switch (link_options.output_mode) {
3068 } = switch (link_options.output_mode) {
30743069 .Obj => return CsuObjects{},
30753070 .Lib => switch (link_options.link_mode) {
3076 .Dynamic => Mode.dynamic_lib,
3071 .Dynamic => .dynamic_lib,
30773072 .Static => return CsuObjects{},
30783073 },
30793074 .Exe => switch (link_options.link_mode) {
3080 .Dynamic => if (link_options.pie) Mode.dynamic_pie else Mode.dynamic_exe,
3081 .Static => if (link_options.pie) Mode.static_pie else Mode.static_exe,
3075 .Dynamic => if (link_options.pie) .dynamic_pie else .dynamic_exe,
3076 .Static => if (link_options.pie) .static_pie else .static_exe,
30823077 },
30833078 };
30843079
......@@ -3108,7 +3103,6 @@ const CsuObjects = struct {
31083103 // hosted-glibc provides crtbegin/end objects in platform/compiler-specific dirs
31093104 // and they are not known at comptime. For now null-out crtbegin/end objects;
31103105 // there is no feature loss, zig has never linked those objects in before.
3111 // TODO: probe for paths, ie. `cc -print-file-name`
31123106 result.crtbegin = null;
31133107 result.crtend = null;
31143108 } else {