| ... | @@ -3058,27 +3058,22 @@ const CsuObjects = struct { | ... | @@ -3058,27 +3058,22 @@ const CsuObjects = struct { |
| 3058 | | 3058 | |
| 3059 | var result: CsuObjects = .{}; | 3059 | var result: CsuObjects = .{}; |
| 3060 | | 3060 | |
| 3061 | // TODO: https://github.com/ziglang/zig/issues/4629 | 3061 | // Flatten crt cases. |
| 3062 | // - use inline enum type | 3062 | const mode: enum { |
| 3063 | // - reduce to enum-literals for values | | |
| 3064 | const Mode = enum { | | |
| 3065 | dynamic_lib, | 3063 | dynamic_lib, |
| 3066 | dynamic_exe, | 3064 | dynamic_exe, |
| 3067 | dynamic_pie, | 3065 | dynamic_pie, |
| 3068 | static_exe, | 3066 | static_exe, |
| 3069 | static_pie, | 3067 | static_pie, |
| 3070 | }; | 3068 | } = switch (link_options.output_mode) { |
| 3071 | | | |
| 3072 | // Flatten crt case types. | | |
| 3073 | const mode: Mode = switch (link_options.output_mode) { | | |
| 3074 | .Obj => return CsuObjects{}, | 3069 | .Obj => return CsuObjects{}, |
| 3075 | .Lib => switch (link_options.link_mode) { | 3070 | .Lib => switch (link_options.link_mode) { |
| 3076 | .Dynamic => Mode.dynamic_lib, | 3071 | .Dynamic => .dynamic_lib, |
| 3077 | .Static => return CsuObjects{}, | 3072 | .Static => return CsuObjects{}, |
| 3078 | }, | 3073 | }, |
| 3079 | .Exe => switch (link_options.link_mode) { | 3074 | .Exe => switch (link_options.link_mode) { |
| 3080 | .Dynamic => if (link_options.pie) Mode.dynamic_pie else Mode.dynamic_exe, | 3075 | .Dynamic => if (link_options.pie) .dynamic_pie else .dynamic_exe, |
| 3081 | .Static => if (link_options.pie) Mode.static_pie else Mode.static_exe, | 3076 | .Static => if (link_options.pie) .static_pie else .static_exe, |
| 3082 | }, | 3077 | }, |
| 3083 | }; | 3078 | }; |
| 3084 | | 3079 | |
| ... | @@ -3108,7 +3103,6 @@ const CsuObjects = struct { | ... | @@ -3108,7 +3103,6 @@ const CsuObjects = struct { |
| 3108 | // hosted-glibc provides crtbegin/end objects in platform/compiler-specific dirs | 3103 | // hosted-glibc provides crtbegin/end objects in platform/compiler-specific dirs |
| 3109 | // and they are not known at comptime. For now null-out crtbegin/end objects; | 3104 | // and they are not known at comptime. For now null-out crtbegin/end objects; |
| 3110 | // there is no feature loss, zig has never linked those objects in before. | 3105 | // there is no feature loss, zig has never linked those objects in before. |
| 3111 | // TODO: probe for paths, ie. `cc -print-file-name` | | |
| 3112 | result.crtbegin = null; | 3106 | result.crtbegin = null; |
| 3113 | result.crtend = null; | 3107 | result.crtend = null; |
| 3114 | } else { | 3108 | } else { |