aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2025-05-13 01:40:43 +0200
committerAlex Rønne Petersen <alex@alexrp.com>2025-05-17 04:41:27 +0200
commite20fb7071cc9d9eab6efd0f4b57f49be20ad866f (patch)
treefd593c373e7aae15b8046a9a2ad36ae877444bd0 /src/Compilation.zig
parentc36d483ba0d7101ec8c8664fe3de88237a310272 (diff)
downloadzig-e20fb7071cc9d9eab6efd0f4b57f49be20ad866f.tar.gz
zig-e20fb7071cc9d9eab6efd0f4b57f49be20ad866f.zip
compiler: Define __NetBSD_Version__ when targeting NetBSD libc.
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index 351b81c122..5c7707ec16 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -5921,6 +5921,14 @@ pub fn addCCArgs(
// symbols would be inconsistent with header declarations.
min_ver.major * 100_000,
}));
+ } else if (target.isNetBSDLibC()) {
+ const min_ver = target.os.version_range.semver.min;
+ try argv.append(try std.fmt.allocPrint(arena, "-D__NetBSD_Version__={d}", .{
+ // We don't currently respect the patch component. This wouldn't be particularly helpful because
+ // our abilists file only tracks major and minor NetBSD releases, so the link-time stub symbols
+ // would be inconsistent with header declarations.
+ (min_ver.major * 100_000_000) + (min_ver.minor * 1_000_000),
+ }));
}
}