mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
minor cosmetic fixups
* fix typos and redundancies in docs * use Target.isGnuLibc
This commit is contained in:
parent
cbaaf6477f
commit
362460ec24
2 changed files with 6 additions and 8 deletions
12
lib/libc/glibc/README.md
vendored
12
lib/libc/glibc/README.md
vendored
|
|
@ -1,15 +1,13 @@
|
||||||
# Zig GNU C Library ("glibc") Support
|
# Zig GNU C Library ("glibc") Support
|
||||||
|
|
||||||
*Date*: November, 2023
|
|
||||||
|
|
||||||
Zig supports building binaries that will dynamically link against the
|
Zig supports building binaries that will dynamically link against the
|
||||||
[GNU C Library ("glibc")](https://www.gnu.org/software/libc/) when run.
|
[GNU C Library ("glibc")](https://www.gnu.org/software/libc/) when run.
|
||||||
This support extends across a range of glibc versions.
|
This support extends across a range of glibc versions.
|
||||||
|
|
||||||
By default, Zig binaries will not depend on any external C library, but
|
By default, Zig binaries will not depend on any external C library, but
|
||||||
they can be linked against one with the `-lc` option. The compilation
|
they can be linked against one with the `-lc` option. The target ABI defines
|
||||||
target defines which C library: `musl` for the
|
which C library: `musl` for the [musl C library](https://musl.libc.org/) or
|
||||||
[musl C library](https://musl.libc.org/) or `gnu` for the GNU C library.
|
`gnu` for the GNU C library.
|
||||||
|
|
||||||
A specific GNU C library version can be chosen with an appropriate
|
A specific GNU C library version can be chosen with an appropriate
|
||||||
`-target`. For example, `-target native-native-gnu.2.19` will use the
|
`-target`. For example, `-target native-native-gnu.2.19` will use the
|
||||||
|
|
@ -30,7 +28,7 @@ do not reference an actual implementation.
|
||||||
## Targets
|
## Targets
|
||||||
|
|
||||||
The GNU C Library supports a very wide set of platforms and architectures.
|
The GNU C Library supports a very wide set of platforms and architectures.
|
||||||
The current Zig support for glibc only supports Linux.
|
The current Zig support for glibc only includes Linux.
|
||||||
|
|
||||||
Zig supports glibc versions back to v2.17 (2012) as the Zig standard
|
Zig supports glibc versions back to v2.17 (2012) as the Zig standard
|
||||||
library depends on symbols that were introduced in 2.17.
|
library depends on symbols that were introduced in 2.17.
|
||||||
|
|
@ -58,7 +56,7 @@ family of functions).
|
||||||
|
|
||||||
The related Zig https://github.com/ziglang/universal-headers is a project
|
The related Zig https://github.com/ziglang/universal-headers is a project
|
||||||
designed to more robustly build multi-version header files suitable for
|
designed to more robustly build multi-version header files suitable for
|
||||||
compliation across a variety of target C library versions.
|
compilation across a variety of target C library versions.
|
||||||
|
|
||||||
## Glibc static C-Runtime object files and libraries
|
## Glibc static C-Runtime object files and libraries
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@ pub fn canBuildLibC(target: std.Target) bool {
|
||||||
return ver.min.order(libc.os_ver.?) != .lt;
|
return ver.min.order(libc.os_ver.?) != .lt;
|
||||||
}
|
}
|
||||||
// Ensure glibc (aka *-linux-gnu) version is supported
|
// Ensure glibc (aka *-linux-gnu) version is supported
|
||||||
if ((target.os.tag == .linux) and target.abi.isGnu()) {
|
if (target.isGnuLibC()) {
|
||||||
const min_glibc_ver = libc.glibc_min orelse glibc_min_version;
|
const min_glibc_ver = libc.glibc_min orelse glibc_min_version;
|
||||||
const target_glibc_ver = target.os.version_range.linux.glibc;
|
const target_glibc_ver = target.os.version_range.linux.glibc;
|
||||||
return target_glibc_ver.order(min_glibc_ver) != .lt;
|
return target_glibc_ver.order(min_glibc_ver) != .lt;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue