Skip to content

Commit e20fb70

Browse files
committed
compiler: Define __NetBSD_Version__ when targeting NetBSD libc.
1 parent c36d483 commit e20fb70

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Compilation.zig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5921,6 +5921,14 @@ pub fn addCCArgs(
59215921
// symbols would be inconsistent with header declarations.
59225922
min_ver.major * 100_000,
59235923
}));
5924+
} else if (target.isNetBSDLibC()) {
5925+
const min_ver = target.os.version_range.semver.min;
5926+
try argv.append(try std.fmt.allocPrint(arena, "-D__NetBSD_Version__={d}", .{
5927+
// We don't currently respect the patch component. This wouldn't be particularly helpful because
5928+
// our abilists file only tracks major and minor NetBSD releases, so the link-time stub symbols
5929+
// would be inconsistent with header declarations.
5930+
(min_ver.major * 100_000_000) + (min_ver.minor * 1_000_000),
5931+
}));
59245932
}
59255933
}
59265934

0 commit comments

Comments
 (0)