diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2025-05-05 14:58:13 +0200 |
|---|---|---|
| committer | Alex Rønne Petersen <alex@alexrp.com> | 2025-05-10 12:19:26 +0200 |
| commit | 9e23e1d16c77d05ab0b4c2bcc861f2aaf4ad5c16 (patch) | |
| tree | 3a66c9a2c2281cd264769008ad25f12c951386a2 | |
| parent | be566a4c119a280ae34778f5e01dedb1480e4904 (diff) | |
| download | zig-9e23e1d16c77d05ab0b4c2bcc861f2aaf4ad5c16.tar.gz zig-9e23e1d16c77d05ab0b4c2bcc861f2aaf4ad5c16.zip | |
compiler: Define __FreeBSD_version when targeting FreeBSD libc.
| -rw-r--r-- | src/Compilation.zig | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index 0a63d29e13..bd7d5221e7 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -5852,6 +5852,15 @@ pub fn addCCArgs( try argv.append( try std.fmt.allocPrint(arena, "-D_WIN32_WINNT=0x{x:0>4}", .{minver}), ); + } else if (target.isFreeBSDLibC()) { + // https://docs.freebsd.org/en/books/porters-handbook/versions + const min_ver = target.os.version_range.semver.min; + try argv.append(try std.fmt.allocPrint(arena, "-D__FreeBSD_version={d}", .{ + // 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, + })); } } |
