aboutsummaryrefslogtreecommitdiff
path: root/libc/docs/dev
AgeCommit message (Collapse)AuthorFilesLines
2025-06-23[libc] Fix broken links in libc (#145199)Shubh Pachchigar1-3/+4
This PR fixes broken links in all files describing libc usage modes. Please let me know if there are any other places that need updating. --------- Co-authored-by: shubhp@perlmutter <shubhp@perlmutter.com>
2025-06-11[libc] Move libc_errno.h to libc/src/__support and make ↵lntue1-2/+2
LIBC_ERRNO_MODE_SYSTEM to be header-only. (#143187) This is the first step in preparation for: https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450
2025-05-14[libc] Fix typos in documentation (#139852)Kazu Hirata2-2/+2
2025-02-27[libc] implement l64a (#129099)Michael Jones1-0/+13
Adds l64a, which generates the base 64 string expected by a64l.
2025-02-26[libc][hdrgen] Allow to treat hdrgen Python code as a Python module. (#128955)Alexey Samsonov1-7/+6
Move the hdrgen code under a subdirectory to treat it as a Python module. This mimics the structure used by llvm/utils/lit and llvm/utils/mlgo-utils and simplifies integration of hdrgen to the build system which rely on Python modules. In addition to that, it clarifies which imports are coming from the hdrgen-specific helpers (e.g. "from type import ..." becomes "from hdrgen.type import ...". Leave the entrypoints (top-level main.py and yaml_to_classes.py) as-is: they can keep being referred by the CMake build system w/o any changes.
2025-02-14[libc] Implement strftime (#122556)Michael Jones1-0/+37
Implements the posix-specified strftime conversions for the default locale, along with comprehensive unit tests. This reuses a lot of design from printf, as well as the printf writer. Roughly based on #111305, but with major rewrites.
2025-01-23[libc][NFC] Strip all training whitespace and missing newlines (#124163)Joseph Huber2-3/+3
2025-01-01[libc] Move hdrgen yaml files into include/ (#121443)Roland McGrath1-3/+3
The .yaml files should live next to the corresponding .h.def files in libc/include/, rather than next to the implementation of the tool in libc/utils/hdrgen/. As with the .h.def files, there is no need for a yaml/ subdirectory under include/. This simpler layout is more natural for maintenance and also simplifies build integration outside the LLVM CMake build.
2024-12-30[libc] Move hdrgen into utils/ subdirectory (#121256)Roland McGrath2-23/+14
2024-12-19[libc] update host build docs (#120147)Michael Jones1-0/+1
Update the host build docs to better reflect the current recommended process.
2024-12-06[libc] Remove automemcpy folder (#118781)Guillaume Chatelet1-2/+1
The build is currently broken and we don't have the resources to keep it up to date :-/
2024-12-04[libc] rename newhdrgen to just hdrgen (#118545)Nick Desaulniers2-39/+33
Link: #117208 Fixes: #117254
2024-12-03[libc] delete hdrgen (#117220)Nick Desaulniers1-3/+0
Thanks to the effort of @RoseZhang03 and @aaryanshukla under the guidance of @michaelrj-google and @amykhuang, we now have newhdrgen and no longer have a dependency on TableGen and thus LLVM in order to start bootstrapping a full build. This PR removes: - LIBC_HDRGEN_EXE; the in tree newhdrgen is the only hdrgen that can be used. - LIBC_USE_NEW_HEADER_GEN; newhdrgen is the default and only option. - LIBC_HDRGEN_ONLY; there is no need to have a distinct build step for old hdrgen. - libc-api-test and libc-api-test-tidy build targets. - Deletes all .td files. It does not rename newhdrgen to just hdrgen. Will follow up with a distinct PR for that. Link: #117209 Link: #117254 Fixes: #117208
2024-09-19[libc] Add printf strerror conversion (%m) (#105891)Michael Jones1-0/+12
This patch adds the %m conversion to printf, which prints the strerror(errno). Explanation of why is below, this patch also updates the docs, tests, and build system to accomodate this. The standard for syslog in posix specifies it uses the same format as printf, but adds %m which prints the error message string for the current value of errno. For ease of implementation, it's standard practice for libc implementers to just add %m to printf instead of creating a separate parser for syslog.
2024-08-21[libc][docs] Update docs to reflect new headergen (#102381)Michael Jones6-75/+19
Since new headergen is now the default for building LLVM-libc, the docs need to be updated to reflect that. While I was editing those docs, I took a quick pass at updating other out-of-date pages.
2024-08-09[libc][newhdrgen]sorted function names in yaml (#102544)aaryanshukla1-0/+2
2024-08-06[libc] add spin lock family functions (#100509)Schrodinger ZHU Yifan1-0/+8
This PR: - add entrypoints for `pthread_spin_*` - additionally, the fixes a typo that has been disabling lock related tests
2024-08-02[libc] Fix printf handling of INT_MIN width (#101729)Michael Jones1-4/+8
Prevously, if INT_MIN was passed as a wildcard width to a printf conversion the parser would attempt to negate it to get the positive width (and set the left justify flag), but it would underflow and the width would be treated as 0. This patch corrects the issue by instead treating a width of INT_MIN as identical to -INT_MAX. Also includes docs changes to explain this behavior and adding b to the list of int conversions.
2024-07-28[libc] add pthread_rwlock_clockrdlock and pthread_rwlock_clockwrlock … ↵Eric9771-0/+5
(#100543)
2024-07-27revert all tid changes (#100915)Schrodinger ZHU Yifan1-23/+0
2024-07-26[libc] Updated GettingStarted.rst with PyYAML version (#100649)RoseZhang031-1/+1
New Headergen requires PyYAML version 5.1 or newer in order to generate header files .
2024-07-24[libc][newheadergen]: PyYaml Version Update (#100463)aaryanshukla1-1/+2
- a lot of builds had an issue using new headergen because they do not have PyYaml installed.
2024-07-22[libc] Updated header_generation.rst (#99712)RoseZhang031-85/+164
Added new headergen documentation.
2024-07-20reland "[libc] implement cached process/thread identity (#98989)" (#99765)Schrodinger ZHU Yifan1-0/+23
2024-07-18Revert "[libc] implement cached process/thread identity" (#99559)Schrodinger ZHU Yifan1-23/+0
Reverts llvm/llvm-project#98989
2024-07-18[libc] implement cached process/thread identity (#98989)Schrodinger ZHU Yifan1-0/+23
migrated from https://github.com/llvm/llvm-project/pull/95965 due to corrupted git history
2024-07-12[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98597)Petr Hosek1-7/+7
This is a part of #97655.
2024-07-12Revert "[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace ↵Mehdi Amini1-7/+7
declaration" (#98593) Reverts llvm/llvm-project#98075 bots are broken
2024-07-11[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98075)Petr Hosek1-7/+7
This is a part of #97655.
2024-07-06[libc] Add `dlfcn.h` placeholder (#97501)Izaak Schroeder1-0/+4
Adds `dlopen` and friends. This is needed as part of the effort to compile `libunwind` + `libc` without baremetal mode. This is part of https://github.com/llvm/llvm-project/issues/97191. This should still be spec compliant, since `dlopen` always returns `NULL` and `dlerror` always returns an error message. > If dlopen() fails for any reason, it returns NULL. > The function dlclose() returns 0 on success, and nonzero on error. > Since the value of the symbol could actually be NULL (so that a NULL return from dlsym() need not indicate an error), the correct way to test for an error is to call dlerror() to clear any old error conditions, then call dlsym(), and then call dlerror() again, saving its return value into a variable, and check whether this saved value is not NULL. See: - https://linux.die.net/man/3/dlopen
2024-07-03[libc] Add LIBC_NAMESPACE_DECL macro (#97109)PiJoules3-6/+42
This defines to LIBC_NAMESPACE with `__attribute__((visibility("hidden")))` so all the symbols under it have hidden visibility. This new macro should be used when declaring a new namespace that will have internal functions/globals and LIBC_NAMESPACE should be used as a means of accessing functions/globals declared within LIBC_NAMESPACE_DECL.
2024-04-22[libc][docs] codify Policy on Assembler Sources (#88185)Nick Desaulniers1-0/+41
It would be helpful in future code reviews to document a policy with regards to where and when Assembler sources are appropriate. That way when reviewers point out infractions, they can point to this written policy, which may help contributors understand that it's not solely the personal preferences of individual reviewers but instead rather a previously agreed upon rule by maintainers. Link: https://github.com/llvm/llvm-project/pull/87837 Link: https://github.com/llvm/llvm-project/pull/88157 Link: https://discourse.llvm.org/t/hand-written-in-assembly-in-libc-setjmp-longjmp/73249/12
2024-04-18[libc][docs] adds highlighting languages to `docs/dev/config_options.rst` ↵Michael Flanders1-9/+7
(#89136) Fixes #89135.
2024-04-11[libc] Codify header inclusion policy (#87017)Nick Desaulniers1-0/+33
When supporting "overlay" vs "fullbuild" modes, "what ABI are you using?" becomes a fundamental question to have concrete answers for. Overlay mode MUST match the ABI of the system being overlayed onto; fullbuild more flexible (the only system ABI relevant is the OS kernel). When implementing llvm-libc we generally prefer the include-what-you use style of avoiding transitive dependencies (since that makes refactoring headers more painful, and slows down build times). So what header do you include for any given type or function declaration? For any given userspace program, the answer is straightforward. But for llvm-libc which is trying to support multiple ABIs (at least one per configuration), the answer is perhaps less clear. This proposal seeks to add one layer of indirection relative to what's being done today. It then converts users of sigset_t and struct epoll_event and the epoll implemenations over to this convention as an example.
2024-03-29Add bit width length modifier to printf (#82461)Om Prakaash1-0/+4
Resolves #81685. This adds support for wN and wfN length modifiers in fprintf.
2024-03-27[libc] Remove obsolete LIBC_HAS_BUILTIN macro (#86554)Marc Auberer1-1/+1
Fixes #86546 and removes the macro `LIBC_HAS_BUILTIN`. This was necessary to support older compilers that did not support `__has_builtin`. All of the compilers we support already have this builtin. See: https://libc.llvm.org/compiler_support.html All uses now use `__has_builtin` directly cc @nickdesaulniers
2024-03-25[libc][math][c23] Add {,u}fromfp{,x}{,f,l,f128} functions (#86003)OverMighty1-0/+8
Fixes #85279. cc @lntue
2024-03-19[libc] Make 'printf' converter output "(null)" instead of "null" (#85845)Joseph Huber2-0/+9
Summary: Currently we print `null` for the null pointer in a `%s` expression. Although it's not defined by the standard, other implementations choose to use `(null)` to indicate this. We also currently print `(nullptr)` so I think it's more consistent to use parens in both cases.
2024-03-18[libc] Add `shm_open/shm_unlink` (#84974)Schrodinger ZHU Yifan1-0/+4
2024-02-29[libc][NFC] Rename `LIBC_COMPILER_HAS_FLOAT128` to `LIBC_TYPES_HAS_FLOAT128` ↵Guillaume Chatelet1-1/+1
(#83395) Umbrella bug #83182
2024-02-29[libc][NFC] rename `float.h` macro file to `types.h` (#83190)Guillaume Chatelet1-1/+1
2024-02-28[libc][docs] Document policy for non-standard func (#83212)Michael Jones1-1/+2
As encountered with <sys/queue.h>, we need a policy for how to handle implementing functions that users need, but has no specific standard. In that case, we should treat existing implementations as the standard and try to match their behavior as best as possible.
2024-02-27[libc] Add fixed point support to printf (#82707)Michael Jones1-0/+12
This patch adds the r, R, k, and K conversion specifiers to printf, with accompanying tests. They are guarded behind the LIBC_COPT_PRINTF_DISABLE_FIXED_POINT flag as well as automatic fixed point support detection.
2024-02-23[libc][NFC] Remove all trailing spaces from libc (#82831)Joseph Huber3-4/+4
Summary: There are a lot of random training spaces on various lines. This patch just got rid of all of them with `sed 's/\ \+$//g'.
2024-01-25[libc] Move printf long double to simple calc (#75414)michaelrj-google1-6/+17
The Ryu algorithm is very fast with its table, but that table grows too large for long doubles. This patch adds a method of calculating the digits of long doubles using just wide integers and fast modulo operations. This results in significant performance improvements vs the previous int calc mode, while taking up a similar amound of peak memory. It will be slow in some %e/%g cases, but reasonable fast for %f with no loss of accuracy.
2024-01-08Reapply "[libc] build with -Werror (#73966)" (#74506)Nick Desaulniers1-0/+8
This reverts commit 6886a52d6dbefff77f33de12ff85d654e2557f81. Most of the errors observed in postsubmit have been addressed. We can fix-forward the remaining ones. Link: https://lab.llvm.org/buildbot/#/changes/117129
2023-12-05[libc] [search] improve hsearch robustness (#73896)Schrodinger ZHU Yifan1-0/+7
Following up the discussion at https://github.com/llvm/llvm-project/pull/73469#discussion_r1409593911 by @nickdesaulniers. According to FreeBSD implementation (https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/upstream-freebsd/lib/libc/stdlib/hcreate.c), `hsearch` is able to handle the cases where the global table is not properly initialized. To do this, FreeBSD actually allows hash table to be dynamically resized. If the global table is uninitialized at the first call, the table will be initialized with a minimal size; hence subsequent insertion will be reasonable as the table grows automatically. This patch mimic such behaviors. More precisely, this patch introduces: 1. a full table iterator that scans each element in the table, 2. a resize routine that is automatically triggered whenever the load factor is reached where it iterates the old table and insert the entries into a new one, 3. more tests that cover the growth of the table.
2023-12-04Revert "[libc] build with -Werror (#73966)"Nick Desaulniers1-8/+0
This reverts commit 606653091d1a66d1a83a1bfdea2883cc8d46687e. Post submit buildbots are now red. We can use these explicit errors to better clean up existing warnings, then reland this. Link: #73966
2023-12-04[libc] build with -Werror (#73966)Nick Desaulniers1-0/+8
A recent commit introduced warnings observable when building unit tests. If the unit tests don't fail when warnings are introduced into the build, then we might fail to notice them in the stream of output from check-libc. Link: https://github.com/llvm/llvm-project/pull/72763/files#r1410932348
2023-11-28[libc][docs] Update implementation docs (#73590)michaelrj-google5-67/+100
Some of the files in the docs/ directory are from 2019 and haven't been updated since. This patch updates implementation_standard.rst, source_tree_layout.rst, and has some minor fixes for strings.rst. It also marks the most severely out of date files with a warning. These files will be updated in a later patch.