66 Commits

Author SHA1 Message Date
Shubh Pachchigar
98e8ef2273 [libc] Fix broken links in libc (#145199)
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-23 15:51:43 -07:00
lntue
d87eea35fa [libc] Move libc_errno.h to libc/src/__support and make 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-06-11 16:25:27 -04:00
Kazu Hirata
c5229e92ce [libc] Fix typos in documentation (#139852) 2025-05-14 07:14:43 -07:00
Michael Jones
64ae0a102f [libc] implement l64a (#129099)
Adds l64a, which generates the base 64 string expected by a64l.
2025-02-27 12:48:39 -08:00
Alexey Samsonov
829e2a5526 [libc][hdrgen] Allow to treat hdrgen Python code as a Python module. (#128955)
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-26 15:41:30 -08:00
Michael Jones
398f865499 [libc] Implement strftime (#122556)
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-02-14 15:56:55 -08:00
Joseph Huber
db6b7a84e6 [libc][NFC] Strip all training whitespace and missing newlines (#124163) 2025-01-23 12:02:54 -06:00
Roland McGrath
62cd050b63 [libc] Move hdrgen yaml files into include/ (#121443)
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.
2025-01-01 17:03:35 -08:00
Roland McGrath
9abcca5e25 [libc] Move hdrgen into utils/ subdirectory (#121256) 2024-12-30 15:36:53 -08:00
Michael Jones
0a94ee694f [libc] update host build docs (#120147)
Update the host build docs to better reflect the current recommended
process.
2024-12-19 13:13:55 -08:00
Guillaume Chatelet
4873968649 [libc] Remove automemcpy folder (#118781)
The build is currently broken and we don't have the resources to keep it
up to date :-/
2024-12-06 09:30:13 +01:00
Nick Desaulniers
06c831d7fb [libc] rename newhdrgen to just hdrgen (#118545)
Link: #117208
Fixes: #117254
2024-12-04 08:48:12 -08:00
Nick Desaulniers
e0ae7793fc [libc] delete hdrgen (#117220)
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-12-03 12:34:26 -08:00
Michael Jones
f009f72df5 [libc] Add printf strerror conversion (%m) (#105891)
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-09-19 10:48:08 -07:00
Michael Jones
b89fef8f67 [libc][docs] Update docs to reflect new headergen (#102381)
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-21 10:50:39 -07:00
aaryanshukla
b6cbd014b9 [libc][newhdrgen]sorted function names in yaml (#102544) 2024-08-09 11:27:36 -07:00
Schrodinger ZHU Yifan
03841e7ab8 [libc] add spin lock family functions (#100509)
This PR:
- add entrypoints for `pthread_spin_*`
- additionally, the fixes a typo that has been disabling lock related
tests
2024-08-06 21:02:54 -07:00
Michael Jones
a21fc4c0a6 [libc] Fix printf handling of INT_MIN width (#101729)
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-08-02 13:45:54 -07:00
Eric977
44df89cc30 [libc] add pthread_rwlock_clockrdlock and pthread_rwlock_clockwrlock … (#100543) 2024-07-28 11:58:09 -07:00
Schrodinger ZHU Yifan
3db5c1eeb0 revert all tid changes (#100915) 2024-07-27 22:29:21 -07:00
RoseZhang03
134b4484d8 [libc] Updated GettingStarted.rst with PyYAML version (#100649)
New Headergen requires PyYAML version 5.1 or newer in order to generate
header files .
2024-07-26 18:31:00 +00:00
aaryanshukla
8b094c9df3 [libc][newheadergen]: PyYaml Version Update (#100463)
- a lot of builds had an issue using new headergen because they do not
have PyYaml installed.
2024-07-24 15:04:05 -07:00
RoseZhang03
8972979c37 [libc] Updated header_generation.rst (#99712)
Added new headergen documentation.
2024-07-22 20:15:26 +00:00
Schrodinger ZHU Yifan
29be889c2c reland "[libc] implement cached process/thread identity (#98989)" (#99765) 2024-07-20 10:25:40 -07:00
Schrodinger ZHU Yifan
415ca24f8e Revert "[libc] implement cached process/thread identity" (#99559)
Reverts llvm/llvm-project#98989
2024-07-18 13:31:04 -07:00