| author | |
| committer | |
| log | 4d48948b526337947ef59a83f7dbc81b70aa5723 |
| tree | 9c5701f84d9ab7e9feee64443c143941bd46f9c0 |
| parent | 694f424fc788f6c64908b3f6d076f4836df33b68 |
instead of hard-coding it. This means that C code has accurate glibc
version information in the preprocessor.3 files changed, 11 insertions(+), 3 deletions(-)
lib/libc/glibc/include/features.h+1-1| ... | ... | @@ -477,7 +477,7 @@ |
| 477 | 477 | /* Major and minor version number of the GNU C library package. Use |
| 478 | 478 | these macros to test for features in specific releases. */ |
| 479 | 479 | #define	__GLIBC__	2 |
| 480 | #define	__GLIBC_MINOR__	34 | |
| 480 | /* Zig patch: we pass `-D__GLIBC_MINOR__=XX` depending on the target. */ | |
| 481 | 481 | |
| 482 | 482 | #define __GLIBC_PREREQ(maj, min) \ |
| 483 | 483 | 	((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min)) |
lib/libc/include/generic-glibc/features.h+2-2| ... | ... | @@ -477,7 +477,7 @@ |
| 477 | 477 | /* Major and minor version number of the GNU C library package. Use |
| 478 | 478 | these macros to test for features in specific releases. */ |
| 479 | 479 | #define	__GLIBC__	2 |
| 480 | #define	__GLIBC_MINOR__	34 | |
| 480 | /* Zig patch: we pass `-D__GLIBC_MINOR__=XX` depending on the target. */ | |
| 481 | 481 | |
| 482 | 482 | #define __GLIBC_PREREQ(maj, min) \ |
| 483 | 483 | 	((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min)) |
| ... | ... | @@ -512,4 +512,4 @@ |
| 512 | 512 | #include <gnu/stubs.h> |
| 513 | 513 | |
| 514 | 514 | |
| 515 | #endif	/* features.h */ | |
| \ No newline at end of file | ||
| 515 | #endif	/* features.h */ |
src/Compilation.zig+8| ... | ... | @@ -3397,6 +3397,14 @@ pub fn addCCArgs( |
| 3397 | 3397 | try argv.append(libunwind_include_path); |
| 3398 | 3398 | } |
| 3399 | 3399 | |
| 3400 | if (comp.bin_file.options.link_libc and target.isGnuLibC()) { | |
| 3401 | const target_version = target.os.version_range.linux.glibc; | |
| 3402 | const glibc_minor_define = try std.fmt.allocPrint(arena, "-D__GLIBC_MINOR__={d}", .{ | |
| 3403 | target_version.minor, | |
| 3404 | }); | |
| 3405 | try argv.append(glibc_minor_define); | |
| 3406 | } | |
| 3407 | ||
| 3400 | 3408 | const llvm_triple = try @import("codegen/llvm.zig").targetTriple(arena, target); |
| 3401 | 3409 | try argv.appendSlice(&[_][]const u8{ "-target", llvm_triple }); |
| 3402 | 3410 |