| ... | @@ -1,15 +1,13 @@ | ... | @@ -1,15 +1,13 @@ |
| 1 | # Zig GNU C Library ("glibc") Support | 1 | # Zig GNU C Library ("glibc") Support |
| 2 | | 2 | |
| 3 | *Date*: November, 2023 | | |
| 4 | | | |
| 5 | Zig supports building binaries that will dynamically link against the | 3 | Zig 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. |
| 7 | This support extends across a range of glibc versions. | 5 | This support extends across a range of glibc versions. |
| 8 | | 6 | |
| 9 | By default, Zig binaries will not depend on any external C library, but | 7 | By default, Zig binaries will not depend on any external C library, but |
| 10 | they can be linked against one with the `-lc` option. The compilation | 8 | they can be linked against one with the `-lc` option. The target ABI defines |
| 11 | target defines which C library: `musl` for the | 9 | which 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. |
| 13 | | 11 | |
| 14 | A specific GNU C library version can be chosen with an appropriate | 12 | A specific GNU C library version can be chosen with an appropriate |
| 15 | `-target`. For example, `-target native-native-gnu.2.19` will use the | 13 | `-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 | ## Targets | 28 | ## Targets |
| 31 | | 29 | |
| 32 | The GNU C Library supports a very wide set of platforms and architectures. | 30 | The GNU C Library supports a very wide set of platforms and architectures. |
| 33 | The current Zig support for glibc only supports Linux. | 31 | The current Zig support for glibc only includes Linux. |
| 34 | | 32 | |
| 35 | Zig supports glibc versions back to v2.17 (2012) as the Zig standard | 33 | Zig supports glibc versions back to v2.17 (2012) as the Zig standard |
| 36 | library depends on symbols that were introduced in 2.17. | 34 | library depends on symbols that were introduced in 2.17. |
| ... | @@ -58,7 +56,7 @@ family of functions). | ... | @@ -58,7 +56,7 @@ family of functions). |
| 58 | | 56 | |
| 59 | The related Zig https://github.com/ziglang/universal-headers is a project | 57 | The related Zig https://github.com/ziglang/universal-headers is a project |
| 60 | designed to more robustly build multi-version header files suitable for | 58 | designed to more robustly build multi-version header files suitable for |
| 61 | compliation across a variety of target C library versions. | 59 | compilation across a variety of target C library versions. |
| 62 | | 60 | |
| 63 | ## Glibc static C-Runtime object files and libraries | 61 | ## Glibc static C-Runtime object files and libraries |
| 64 | | 62 | |