commit e331e8171987a59a882c63e1156e7a3a8eb871a1 (tree)
parent cbcd67ea90979eca4a2b46838c54472058886fed
Author: Andrew Kelley <andrew@ziglang.org>
Date: Wed, 16 Oct 2024 14:47:34 -0700
link.Elf: refactor output mode checking
Diffstat:
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/link/Elf.zig b/src/link/Elf.zig
@@ -790,8 +790,15 @@ pub fn flushModule(self: *Elf, arena: Allocator, tid: Zcu.PerThread.Id, prog_nod
if (comp.verbose_link) try self.dumpArgv(comp);
if (self.zigObjectPtr()) |zig_object| try zig_object.flush(self, tid);
- if (self.base.isStaticLib()) return relocatable.flushStaticLib(self, comp, module_obj_path);
- if (self.base.isObject()) return relocatable.flushObject(self, comp, module_obj_path);
+
+ switch (comp.config.output_mode) {
+ .Obj => return relocatable.flushObject(self, comp, module_obj_path),
+ .Lib => switch (comp.config.link_mode) {
+ .dynamic => {},
+ .static => return relocatable.flushStaticLib(self, comp, module_obj_path),
+ },
+ .Exe => {},
+ }
const csu = try comp.getCrtPaths(arena);