aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
diff options
context:
space:
mode:
Diffstat (limited to 'src/codegen')
-rw-r--r--src/codegen/llvm.zig13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 40fffcfd5f..beb3e5e9f6 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -15,6 +15,7 @@ const link = @import("../link.zig");
const Compilation = @import("../Compilation.zig");
const build_options = @import("build_options");
const Module = @import("../Module.zig");
+const Zcu = Module;
const InternPool = @import("../InternPool.zig");
const Package = @import("../Package.zig");
const TypedValue = @import("../TypedValue.zig");
@@ -1723,7 +1724,7 @@ pub const Object = struct {
try global_index.rename(decl_name, &self.builder);
global_index.setLinkage(.external, &self.builder);
global_index.setUnnamedAddr(.default, &self.builder);
- if (mod.wantDllExports()) global_index.setDllStorageClass(.default, &self.builder);
+ if (wantDllExports(mod)) global_index.setDllStorageClass(.default, &self.builder);
if (self.di_map.get(decl)) |di_node| {
const decl_name_slice = decl_name.slice(&self.builder).?;
if (try decl.isFunction(mod)) {
@@ -1789,7 +1790,7 @@ pub const Object = struct {
);
try global_index.rename(fqn, &self.builder);
global_index.setLinkage(.internal, &self.builder);
- if (mod.wantDllExports()) global_index.setDllStorageClass(.default, &self.builder);
+ if (wantDllExports(mod)) global_index.setDllStorageClass(.default, &self.builder);
global_index.setUnnamedAddr(.unnamed_addr, &self.builder);
if (decl.val.getVariable(mod)) |decl_var| {
const decl_namespace = mod.namespacePtr(decl.namespace_index);
@@ -1848,7 +1849,7 @@ pub const Object = struct {
exports: []const *Module.Export,
) link.File.UpdateExportsError!void {
global_index.setUnnamedAddr(.default, &o.builder);
- if (mod.wantDllExports()) global_index.setDllStorageClass(.dllexport, &o.builder);
+ if (wantDllExports(mod)) global_index.setDllStorageClass(.dllexport, &o.builder);
global_index.setLinkage(switch (exports[0].opts.linkage) {
.Internal => unreachable,
.Strong => .external,
@@ -11767,3 +11768,9 @@ fn constraintAllowsRegister(constraint: []const u8) bool {
}
} else return false;
}
+
+fn wantDllExports(zcu: *const Zcu) bool {
+ const lf = zcu.bin_file.?;
+ const coff = lf.cast(link.File.Coff) orelse return false;
+ return coff.dll_export_fns;
+}