aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/llvm.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-12-15 19:25:34 -0700
committerAndrew Kelley <andrew@ziglang.org>2024-01-01 17:51:20 -0700
commit638db680f4c6380bb193da520f29a7c587bfb719 (patch)
treec1b813f52c7970b061e928e8c7b9e0d859a82ded /src/codegen/llvm.zig
parentb54ad9317591873159594e673953088a21d66e7b (diff)
downloadzig-638db680f4c6380bb193da520f29a7c587bfb719.tar.gz
zig-638db680f4c6380bb193da520f29a7c587bfb719.zip
move dll_export_fns and rdynamic to Compilation.Config
Diffstat (limited to 'src/codegen/llvm.zig')
-rw-r--r--src/codegen/llvm.zig17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 42180c6529..7e25a4b59b 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -1672,6 +1672,7 @@ pub const Object = struct {
// because we call `updateExports` at the end of `updateFunc` and `updateDecl`.
const global_index = self.decl_map.get(decl_index) orelse return;
const decl = mod.declPtr(decl_index);
+ const comp = mod.comp;
if (decl.isExtern(mod)) {
const decl_name = decl_name: {
const decl_name = mod.intern_pool.stringToSlice(decl.name);
@@ -1696,7 +1697,8 @@ 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 (wantDllExports(mod)) global_index.setDllStorageClass(.default, &self.builder);
+ if (comp.config.dll_export_fns)
+ 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)) {
@@ -1762,7 +1764,8 @@ pub const Object = struct {
);
try global_index.rename(fqn, &self.builder);
global_index.setLinkage(.internal, &self.builder);
- if (wantDllExports(mod)) global_index.setDllStorageClass(.default, &self.builder);
+ if (comp.config.dll_export_fns)
+ 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.src_namespace);
@@ -1821,7 +1824,9 @@ pub const Object = struct {
exports: []const *Module.Export,
) link.File.UpdateExportsError!void {
global_index.setUnnamedAddr(.default, &o.builder);
- if (wantDllExports(mod)) global_index.setDllStorageClass(.dllexport, &o.builder);
+ const comp = mod.comp;
+ if (comp.config.dll_export_fns)
+ global_index.setDllStorageClass(.dllexport, &o.builder);
global_index.setLinkage(switch (exports[0].opts.linkage) {
.Internal => unreachable,
.Strong => .external,
@@ -11758,9 +11763,3 @@ 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;
-}