aboutsummaryrefslogtreecommitdiff
path: root/lib/libc
AgeCommit message (Collapse)Author
2022-08-25glibc/abilists: add libresolv stubsMotiejus Jakštys
Generated with https://github.com/ziglang/glibc-abi-tool/pull/2 Fixes #12628
2022-07-04update macOS libc headersAndrew Kelley
notably this adds copyfile.h fetch-them-macos-headers rev 900567517197df46e98006c53023fa10cb986004
2022-06-14Update the WASI libcFrank Denis
Update our copy of wasi-libc up to the commit 30094b6ed05f19cee102115215863d185f2db4f0 from the upstream repository.
2022-05-22Set macOS/iPhoneOS/tvOS/watchOS ABI to none (unspecified) by defaultJakub Konka
Prior to this change we would assume the ABI for Apple targets to be GNU which could result in subtle errors in LLVM emitting calls to non-existent system libc provided functions such as `_sincosf` which is a GNU extension and as such is not provided by macOS for example. This would result in linker errors where the linker would not be able to find the said symbol in `libSystem.tbd`. With this change, we now correctly identify macOS (and other Apple platforms) as having ABI `unknown` which translates to unspecified in LLVM under-the-hood: ``` // main.ll target triple = "aarch64-unknown-macos-unknown" ``` Note however that we never suffix the target OS with target version such as `macos11` or `macos12` which means we fail to instruct LLVM of potential optimisations provided by the OS such as the availability of function `___sincosf_stret`. I suggest we investigate that in a follow-up commit.
2022-05-04tools/gen_stubs: sort output by section/symbol nameIsaac Freund
This will make future diffs smaller and easier to review.
2022-05-04musl: update to 1.2.3Isaac Freund
This was a bit trickier than it should be due to symbol conflicts with zig's compiler-rt implementation. We attempt to use weak linkage in our compiler-rt, but this does not seem to be working in all cases. I manually disabled export of the problematic compiler-rt math functions in order to cross compile musl's libc.so for all targets as input to `tools/gen_stubs.zig`. Other than that, this update went fairly smoothly. Quite a few additional symbols were added to the blacklist in `tools/gen_stubs.zig` due to recent reorganization of zig's compiler-rt.
2022-01-28glibc: version-gate _DYNAMIC_STACK_SIZE_SOURCEAndrew Kelley
This is a patch to glibc features.h which makes _DYNAMIC_STACK_SIZE_SOURCE undefined unless the version is >= 2.34. This feature was introduced with glibc 2.34 and without this patch, code built against these headers but then run on an older glibc will end up making a call to sysconf() that returns -1 for the value of SIGSTKSZ and MINSIGSTKSZ. Closes #10713
2022-01-26[linux headers] rename arm64 to aarch64Motiejus Jakštys
Zig calls it aarch64. Linux calls it arm64. Currently lib/libc/include has both arm64 and aarch64, which is quite confusing. tools/update-linux-headers.zig was executed against the latest stable linux patch version, therefore some other minor header updates. I will update the wiki on how to do it once this PR is accepted.
2022-01-19glibc: fix passing of __GNU_MINOR__Daniel Saier
This was originally introduced in 4d48948b526337947ef59a83f7dbc81b70aa5723 but broken immediately afterwards in c8af00c66e8b6f62e4dd6ac4d86a3de03e9ea354.
2022-01-14glibc: clean up build logicAndrew Kelley
also use the common naming convention for glibc versions ("2.33" rather than "2-33"). I also verified that these files are exactly identical to the previous files from before zig updated to glibc 2.34.
2022-01-14glibc: restore compatibility with glibc<=2.33 for global initializersxavier
__libc_start_main() from glibc.2.33.so or older needs to have a __libc_csu_init function callback parameter. glibc-2.34 on the other hand has a different __libc_start_main() that does not use it, and the start.S file from glibc-2.34 no longer construct the init function and pass null when calling __libc_start_main. So, When targetting an older glibc, use the start.s files as they were in glibc-2.33 and construct the __libc_csu_init function. fixes #10386 #10512
2021-12-16glibc: update libc-modules.hAndrew Kelley
2021-12-16glibc: libc_nonshared.a: add missing includes for inttypes.hAndrew Kelley
I don't know where glibc thinks uintptr_t is coming from, but here it is.
2021-12-16glibc: add stat_t64_cp.c to libnonshared.aAndrew Kelley
Fixes 32-bit architectures.
2021-12-16glibc: patches to make fstatat.c and fstatat64.c compileAndrew Kelley
instead of importing every header file under the sun, I copied a couple inline functions into these files to make them work.
2021-12-16glibc: fix inconsistency of powerpc ABI mappingAndrew Kelley
See the commit message of 5b6d26e97bb97d79782f3c77b02a997e361a1497 for an explanation. This is the same thing but for powerpc instead of mips.
2021-12-15glibc: import sysdep.h from upstreamAndrew Kelley
it's needed for mipsel-linux-gnueabihf
2021-12-15glibc: fix inconsistency of mips ABI mappingAndrew Kelley
Before this commit, glibc headers did the following mapping: * (zig) mipsel-linux-gnu => (glibc) mipsel-linux-gnu * (zig) mipsel-linux-gnu-soft => (glibc) (none) * (zig) mips-linux-gnu => (glibc) mips-linux-gnu * (zig) mips-linux-gnu-soft => (glibc) (none) While the glibc ABI stubs used the (zig) gnueabi and gnueabihf ABIs, and the stage2 available_libcs array listed: * (zig) mipsel-linux-gnu * (zig) mips-linux-gnu The problem is the mismatch between the ABI component of the headers and the stubs. This commit makes the following clarifications: * (zig) mips-linux-gnueabi means soft-float * (zig) mipsel-linux-gnueabi means soft-float * (zig) mips-linux-gnueabihf means hard-float * (zig) mipsel-linux-gnueabihf means hard-float Consequently, the glibc headers now do this mapping: * (zig) mips-linux-gnueabihf => (glibc) mips-linux-gnu * (zig) mipsel-linux-gnueabihf => (glibc) mipsel-linux-gnu * (zig) mips-linux-gnueabi => (glibc) mips-linux-gnu-soft * (zig) mipsel-linux-gnueabi => (glibc) mipsel-linux-gnu-soft The glibc ABI stubs are unchanged, and the stage2 available_libcs array's 2 entries are modified and it gains 2 more: * (zig) mipsel-linux-gnueabi * (zig) mipsel-linux-gnueabihf * (zig) mips-linux-gnueabi * (zig) mips-linux-gnueabihf Now everything is consistent. Zig no longer recognizes a `mips-linux-gnu` triple; one must use `mips-linux-gnueabi` (soft float) or `mips-linux-gnueabihf` (hard float).
2021-12-15glibc: improve RISC-V supportAndrew Kelley
* omit crti.o / crtn.o for this architecture * add missing entry.h header from upstream
2021-12-15glibc: add missing riscv stubs headersAndrew Kelley
2021-12-15glibc: remove duplicate files between generic-glibc/ and glibc/include/Andrew Kelley
2021-12-15glibc: pass -D__GLIBC_MINOR__=XXAndrew Kelley
instead of hard-coding it. This means that C code has accurate glibc version information in the preprocessor.
2021-12-15glibc: update abilists fileAndrew Kelley
This one includes riscv32 and riscv64 targets.
2021-12-15glibc: use linux-specific files for nonsharedAndrew Kelley
Upstream, some of the nonshared functions moved to be different for hurd and for linux. Since our glibc is linux-only we update to use the linux-specific files. This fixes std lib tests for x86_64 when linking glibc.
2021-12-15update glibc start files to 2.34Andrew Kelley
This commit introduces tools/update_glibc.zig to update the start files for next time. Some notable changes in recent glibc: * abi-note.S has been changed to abi-note.c but we resist the change to keep it easier to compile the start files. * elf-init.c has been deleted upstream. Further testing should be done to verify that binaries against glibc omitting elf-init.c still run properly on oldel glibc linux systems. Closes #4926
2021-12-15update glibc headers to 2.34Andrew Kelley
closes #10308
2021-12-13stage2: improved glibc stubsAndrew Kelley
This commit upgrades glibc shared library stub-creating code to use the new abilists file which is generated by the new glibc-abi-tool project: https://github.com/ziglang/glibc-abi-tool/ The abilists file is different in these ways: * It additionally encodes whether a symbol is a function or an object, and if it is an object, it additionally encodes the size in bytes. * It additionally encodes migrations of symbols from one library to another between glibc versions. * It is binary data instead of ascii. * It is one file instead of three. * It is 165 KB instead of 200 KB. This solves three bugs: Fixes #7667 Fixes #8714 Fixes #8896
2021-12-09stage2: upgrade musl libc stub fileAndrew Kelley
This is the result of the work on tools/gen_stubs.zig. It now uses the preprocessor to emit different symbols and sizes depending on the architecture. The data is collected directly from multiple libc.so files on disk built with upstream musl. Closes #8178 Addresses #8896 for musl There is still room for further improvement to this, which is to put `.ds` directives after symbols that are not followed by aliases, to avoid the potential problem of a linker believing that all symbols are aliases of each other.
2021-12-08improve musl dynamic stubs file libc.sAndrew Kelley
tools/gen_stubs.zig now cuts out the middle man and operates directly on the libc.so ELF file. it outputs accurate .size directives for objects. std.elf gains an STV enum.
2021-11-30remove linux header files that have case conflictsAndrew Kelley
similar commit from the past: c73cd05468fba4bba5762a654aacdd9d90ecd272 This also modifies tools/update-linux-headers.zig to remove these same files for next time to prevent a regression. closes #10249
2021-11-29update libc linux headers to v5.16-rc3Andrew Kelley
* Add missing Linux headers. Closes #9837 * Update existing headers to latest Linux. * Consolidate headers that are the same for multiple Zig target CPU architectures. For example, Linux has only an x86 directory for both x86_64 and x86 CPU architectures. Now Zig only ships an x86 directory for Linux headers, and will emit the proper corresponding -isystem flags. * tools/update-linux-headers.zig is now available for upgrading to newer Linux headers, and the update process is now documented on the wiki.
2021-11-27Add missing macOS libc headersJakub Konka
* mach/thread_state.h * mach/vm_param.h * objc/objc-runtime.h
2021-11-26mingw-w64: add wsock32 def filesAndrew Kelley
closes #7877
2021-11-26mingw-w64: patch to silence implicit-function-declaration warningsAndrew Kelley
Closes #7356 I did this as a patch to the source rather than passing flags so that it would intentionally be reverted when we update to the next release of mingw-w64. At this time if any warnings are still emitted we should find out why and make sure upstream is aware of the problem.
2021-11-25mingw-w64: add glu32 def filesAndrew Kelley
closes #9372
2021-11-25Version libSystem shipped with zig toolchainJakub Konka
We will mimick the same solution as with the headers: * `libSystem.10.tbd` * `libSystem.11.tbd` * `libSystem.12.tbd` and so on...
2021-11-25add libc headers for all supported macOS versionsJakub Konka
`fetch-them-macos-headers` gitrev 7036517cc6a9aa154e7aef4c4593b5c4a5143ed4
2021-09-30Merge remote-tracking branch 'origin/master' into llvm13Andrew Kelley
2021-09-15Merge remote-tracking branch 'origin/master' into llvm13Andrew Kelley
Conflicts: * cmake/Findclang.cmake * cmake/Findlld.cmake * cmake/Findllvm.cmake In master branch, more search paths were added to these files with "12" in the path. In this commit I updated them to "13". * src/stage1/codegen.cpp * src/zig_llvm.cpp * src/zig_llvm.h In master branch, ZigLLVMBuildCmpXchg is improved to add `is_single_threaded`. However, the LLVM 13 C API has this already, and in the llvm13 branch, ZigLLVMBuildCmpXchg is deleted in favor of the C API. In this commit I updated stage2 to use the LLVM 13 C API rather than depending on an improved ZigLLVMBuildCmpXchg. Additionally, src/target.zig largestAtomicBits needed to be updated to include the new m68k ISA.
2021-09-15Added implementation for _fseeki64 and _ftelli64 from mingw-w64 9.0.0 ↵Michal Ziulek
(#9402). (#9766) * Added fseeki64.c from mingw-w64 9.0.0. This file was missing in Zig distribution. This file contains implementation for _fseeki64 and _ftelli64 functions.
2021-09-07changes to build zig-bootstrap aarch64-windowsJonathan Marler
2021-09-07Fix building aarch64-windows-gnu by adding missing libc files and ↵Jonathan Marler
compiler_rt functions (#9555) * fix issue 9519 Added some missing files from mingw * add missing compiler_rt functions * finish PR * add aarch64-windows-gnu to test targets * add more compiler_rt * add log2 * add pow * add modti3
2021-08-28Merge remote-tracking branch 'origin/master' into llvm13Andrew Kelley
Conflicts: lib/libcxx/include/__config d57c0cc3bfeff9af297279759ec2b631e6d95140 added support for DragonFlyBSD to libc++ by updating some ifdefs. This needed to be synced with llvm13.
2021-08-20Add compstui.defJonathan Marler
The compstui library contains 4 Windows functions which were recently added to the win32metadta project. I copied this def file from the mingw-w64 project.
2021-08-16add m68k glibc (2.33) headersAndrew Kelley
2021-08-16add m68k musl (1.2.2) headersAndrew Kelley
This commit also corrects a mistake from commit 6dc2236054dfcf911ce848f67a4078740a90783a which did not properly delete files when upgrading to the 1.2.2 musl headers.
2021-08-05Update x86_64-macos headersJakub Konka
2021-07-11wasi-libc: remove crt1.o as it's not WASI ABI compatibleTakeshi Yoneda
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2021-07-10mingw-w64: add odbc32 and dbghelp def filesAndrew Kelley
related: #9124
2021-06-24zld: parse libSystem tbd stub when linkingJakub Konka