This adds LIBC_CONF_PRINTF_MODULAR, which causes floating point support
(later, others) to be weakly linked into the implementation.
__printf_modular becomes the main entry point of the implementaiton, an
printf itself wraps __printf_modular. printf it also contains a
BFD_RELOC_NONE relocation to bring in the float aspect.
See issue #146159 for context.
Added entrypoints:
- baremetal/arm
- baremetal/aarch64
- baremetal/riscv
- darwin/aarch64
- linux/aarch64
- linux/arm
- linux/riscv
- linux/x86_64
- windows
Also added the unit test for iswpunct.
Part of the issue: #185136
- Added entry points for `iswalnum` for the following platforms:
- baremetal/arm
- baremetal/riscv
- dawin/aarch64
- linux/x86_64
- linux/arm
- linux/aarch64
- linux/riscv
- windows
- Added a unit test for `iswalnum`
part of #185136
This PR intends to add entrypoints and some smoke tests for `iswxdigit`
function
Changes made are :-
- Added entrypoint for `iswxdigit` in wctype.yaml
- Added CMake entrypoint object for `iswxdigit`
- Added Header and implementation in `iswxdigit.h` and `iswxdigit.cpp`
- Added test for `iswxdigit` in iswxdigit_test.cpp
- Added `iswxdigit` in entrypoints.txt for available platforms
Tested using = `ninja libc.test.src.wctype.iswxdigit_test.__unit__`
passes all tests
part of #185136
part of https://github.com/llvm/llvm-project/issues/185136;
This PR adds public entrypoints for the wide character classification
function iswgraph in LLVM libc, using the same pattern as the existing
iswalpha entrypoint.
using bellow cmd to test:
```shell
ninja libc.test.src.wctype.iswgraph_test.__unit__
```
`asctime_r`, `gmtime`, and `gmtime_r` were missing const-qualifiers for
a first function argument. Add them to fix generated `<time.h>` header.
Implementation headers / source files are declaring arguments correctly.
Changes include:
- Added iswlower entrypoint in wctype.yaml to expose the function
- Created iswlower.h header and iswlower.cpp implementation
- Added CMake entrypoint object for iswlower
- Created unit test in iswlower_test.cpp
- Added test entry to wctype CMakeLists.txt
this PR helps in exposing iswlower which internally calls islower on
wide character
built using : ninja -C build libc
tested using : ninja libc_wctype_unittests and all the 3 tests passed
resolves issue #185136
* Add several `AT_` macro values from `<sys/auxv.h>`. In particular,
this allows to make internal Linux auxv header parsing more hermetic by
removing one of Linux header includes.
* Add constants between `DT_ADDRNGLO` and `DT_ADDRNGHI`, in particular
`DT_GNU_HASH`, which is de-facto standard on many platforms.
* Add `Elf32_auxv_t` and `Elf64_auxv_t` types which define the auxv
entries and can be used by VDSO parsing code. Note that this PR doesn't
yet update libc's own Linux auxv header support (in
`src/__support/OSUtil/linux/auxv.h`).
This fixes some of the missing definitions when building code working
with Elf files, such as Abseil's debugging support in
https://github.com/abseil/abseil-cpp/tree/master/absl/debugging/internal.
`sockaddr_un` structure is supposed to be provided by the `<sys/un.h>`
header. Add this header to llvm-libc, and move the declaration of
`sockaddr_un` there from `<sys/socket.h>`. See
https://man7.org/linux/man-pages/man0/sys_un.h.0p.html
Add proxy headers for the `<sys/socket.h>` macro (like `AF_UNIX`) and
for the `struct sockaddr_un` so that the tests can be more hermetic and
avoid system header inclusion.
Older code may use `st_atime` which recorded timestamps with one-second
precision, instead of `struct timespec st_atim` that is available in
later POSIX versions.
Add `#define st_atime` (& friends) to type declaration as suggested in
https://man7.org/linux/man-pages/man3/stat.3type.html
Resolves ifunc targets before `main()` runs in static libc
This enables static binaries to use ifunc-based dispatch during early
process startup, so optimized implementations can be selected based on
CPU features. Without this relocation step in startup, those targets are
not ready when program code begins executing.
This change:
- adds IRELATIVE relocation handling for x86_64, AArch64, ARMv7 and RISC-V,
- reads `AT_HWCAP` / `AT_HWCAP2` from auxv and passes them to resolvers
where required (notably AArch64),
- runs IRELATIVE processing after base-address discovery and before TLS
setup,
- adds integration tests for both the ifunc path and the no-ifunc path,
- Changed the load bias type for ptrdiff_t to intptr_t to align with
IRELATIVE handling, which uses intptr_t for load bias calculations.
Remove pthread.h.def and use pure generation. Fix YAML records
for standards to correct syntax and remove redundancies.
Don't declare NULL, which is not specified for <pthread.h>.
Do declare PTHREAD_NULL.
In a recent PR (https://github.com/llvm/llvm-project/pull/174772), we
introduced GnuPropertySection using ElfW(Xword). Since we are currently
missing Elf32_Xword, this is failing on 32bit architectures.
This commit adds the missing Elf32_Xword type that should always hold
64bit even on 32bit architectures.
In order to add Control-flow Enforcement Technology (CET) Shadow Stack
(SHSTK) support, we need to parse the `PT_GNU_PROPERTY` program header
and the corresponding section to evaluate if the binary being started
was compiled with the necessary support.
PS: This is my first PR to llvm-libc, I might have made obvious styling
mistakes so I'd appreciate any feedback or suggestions to improve it.
I have a prototype branch using this change to enable SHSTK support:
https://github.com/jakos-sec/llvm-project/tree/add-shstk-support
Add the boilerplate for declaring these POSIX functions and
providing implementations. So far the only implementations are
just stubs that fail with ENOTSUP, and they are neither tested
nor included in any CMake entrypoints lists. More work is still
required to add the actual fields to the pthread_attr_t and
implement the support in the Linux pthread_create et al, but that
is not done here. It's not an especially large amount of work,
but more than just trivial.
The scaffolding here paves the way for that later work, but is
also immediately useful for filling out the subset of POSIX
pthread_attr_* functions that Fuchsia's libc already supports.
This patch adds the `IN6_IS_ADDR_MC*` macro, which checks whether an
address is multicast node-local address, multicast link-local address,
multicast site-local address, multicast organization-local address and
multicast global address.
This patch moves abs_timeout and monotonicity out of the linux dir into
common. Both of these functions depend on clock_gettime which is the
actual os-dependent component. As other features in `__support/threads`
may want to use these, it's better to share it in common.
This patch adds support for clock_gettime for Darwin. Darwin syscall
'gettimeofday' is used to query the time from the system.
Many headers in llvm-libc-types, namely clockid_t, struct_timespec,
struct_timeval, suseconds_t, time_t_32, time_t_64, are modified to
include
header guards as Darwin has its own implementation of primitive types.
Add dependency on headers with `in_addr` and `in_addr_t` type
definitions to ensure that these headers will be properly installed by
"install-libc" CMake target.
This patch provides definitions for `pkey_*` functions for linux x86_64.
`pkey_alloc`, `pkey_free`, and `pkey_mprotect` are simple syscall
wrappers. `pkey_set` and `pkey_get` modify architecture-specific
registers. The logic for these live in architecture specific
directories:
* `libc/src/sys/mman/linux/x86_64/pkey_common.h` has a real
implementation
* `libc/src/sys/mman/linux/generic/pkey_common.h` contains stubs that
just return `ENOSYS`.