authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-04 17:26:06-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-04 17:26:06-07:00
log362460ec24d802e6fba7f45ddff5f969642839df
tree2cdeb8469c1cda5b6d50b86f38d87c4b5a3ea2b1
parentcbaaf6477fa314257a550515886563d6e7a06fc7

minor cosmetic fixups

* fix typos and redundancies in docs * use Target.isGnuLibc

2 files changed, 6 insertions(+), 8 deletions(-)

lib/libc/glibc/README.md+5-7
...@@ -1,15 +1,13 @@...@@ -1,15 +1,13 @@
1# Zig GNU C Library ("glibc") Support1# Zig GNU C Library ("glibc") Support
22
3*Date*: November, 2023
4
5Zig supports building binaries that will dynamically link against the3Zig supports building binaries that will dynamically link against the
6[GNU C Library ("glibc")](https://www.gnu.org/software/libc/) when run.4[GNU C Library ("glibc")](https://www.gnu.org/software/libc/) when run.
7This support extends across a range of glibc versions.5This support extends across a range of glibc versions.
86
9By default, Zig binaries will not depend on any external C library, but7By default, Zig binaries will not depend on any external C library, but
10they can be linked against one with the `-lc` option. The compilation8they can be linked against one with the `-lc` option. The target ABI defines
11target defines which C library: `musl` for the9which C library: `musl` for the [musl C library](https://musl.libc.org/) or
12[musl C library](https://musl.libc.org/) or `gnu` for the GNU C library.10`gnu` for the GNU C library.
1311
14A specific GNU C library version can be chosen with an appropriate12A specific GNU C library version can be chosen with an appropriate
15`-target`. For example, `-target native-native-gnu.2.19` will use the13`-target`. For example, `-target native-native-gnu.2.19` will use the
...@@ -30,7 +28,7 @@ do not reference an actual implementation....@@ -30,7 +28,7 @@ do not reference an actual implementation.
30## Targets28## Targets
3129
32The GNU C Library supports a very wide set of platforms and architectures.30The GNU C Library supports a very wide set of platforms and architectures.
33The current Zig support for glibc only supports Linux.31The current Zig support for glibc only includes Linux.
3432
35Zig supports glibc versions back to v2.17 (2012) as the Zig standard33Zig supports glibc versions back to v2.17 (2012) as the Zig standard
36library depends on symbols that were introduced in 2.17.34library depends on symbols that were introduced in 2.17.
...@@ -58,7 +56,7 @@ family of functions)....@@ -58,7 +56,7 @@ family of functions).
5856
59The related Zig https://github.com/ziglang/universal-headers is a project57The related Zig https://github.com/ziglang/universal-headers is a project
60designed to more robustly build multi-version header files suitable for58designed to more robustly build multi-version header files suitable for
61compliation across a variety of target C library versions.59compilation across a variety of target C library versions.
6260
63## Glibc static C-Runtime object files and libraries61## Glibc static C-Runtime object files and libraries
6462
src/target.zig+1-1
...@@ -164,7 +164,7 @@ pub fn canBuildLibC(target: std.Target) bool {...@@ -164,7 +164,7 @@ pub fn canBuildLibC(target: std.Target) bool {
164 return ver.min.order(libc.os_ver.?) != .lt;164 return ver.min.order(libc.os_ver.?) != .lt;
165 }165 }
166 // Ensure glibc (aka *-linux-gnu) version is supported166 // Ensure glibc (aka *-linux-gnu) version is supported
167 if ((target.os.tag == .linux) and target.abi.isGnu()) {167 if (target.isGnuLibC()) {
168 const min_glibc_ver = libc.glibc_min orelse glibc_min_version;168 const min_glibc_ver = libc.glibc_min orelse glibc_min_version;
169 const target_glibc_ver = target.os.version_range.linux.glibc;169 const target_glibc_ver = target.os.version_range.linux.glibc;
170 return target_glibc_ver.order(min_glibc_ver) != .lt;170 return target_glibc_ver.order(min_glibc_ver) != .lt;