freebsd: correctly define __FreeBSD_version to the first stable release

See: https://docs.freebsd.org/en/books/porters-handbook/versions

Closes #24819.
This commit is contained in:
Alex Rønne Petersen
2025-08-13 08:46:52 +02:00
parent e089d21439
commit b7602a17f8
2 changed files with 2 additions and 2 deletions

View File

@@ -6921,7 +6921,7 @@ pub fn addCCArgs(
// We don't currently respect the minor and patch components. This wouldn't be particularly
// helpful because our abilists file only tracks major FreeBSD releases, so the link-time stub
// symbols would be inconsistent with header declarations.
min_ver.major * 100_000,
min_ver.major * 100_000 + 500,
}));
} else if (target.isNetBSDLibC()) {
const min_ver = target.os.version_range.semver.min;

View File

@@ -92,7 +92,7 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre
try acflags.appendSlice(&.{
"-DLOCORE",
// See `Compilation.addCCArgs`.
try std.fmt.allocPrint(arena, "-D__FreeBSD_version={d}", .{target.os.version_range.semver.min.major * 100_000}),
try std.fmt.allocPrint(arena, "-D__FreeBSD_version={d}", .{target.os.version_range.semver.min.major * 100_000 + 500}),
});
inline for (.{ &cflags, &acflags }) |flags| {