diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-12-15 17:52:27 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-12-15 17:52:27 -0700 |
| commit | 4d48948b526337947ef59a83f7dbc81b70aa5723 (patch) | |
| tree | 9c5701f84d9ab7e9feee64443c143941bd46f9c0 /src | |
| parent | 694f424fc788f6c64908b3f6d076f4836df33b68 (diff) | |
| download | zig-4d48948b526337947ef59a83f7dbc81b70aa5723.tar.gz zig-4d48948b526337947ef59a83f7dbc81b70aa5723.zip | |
glibc: pass -D__GLIBC_MINOR__=XX
instead of hard-coding it. This means that C code has accurate glibc
version information in the preprocessor.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Compilation.zig | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index d58394de65..d87ad78a71 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -3397,6 +3397,14 @@ pub fn addCCArgs( try argv.append(libunwind_include_path); } + if (comp.bin_file.options.link_libc and target.isGnuLibC()) { + const target_version = target.os.version_range.linux.glibc; + const glibc_minor_define = try std.fmt.allocPrint(arena, "-D__GLIBC_MINOR__={d}", .{ + target_version.minor, + }); + try argv.append(glibc_minor_define); + } + const llvm_triple = try @import("codegen/llvm.zig").targetTriple(arena, target); try argv.appendSlice(&[_][]const u8{ "-target", llvm_triple }); |
