aboutsummaryrefslogtreecommitdiff
path: root/libc
AgeCommit message (Collapse)AuthorFilesLines
2024-06-19[libc] Fix scheduler test incorrectly guessing user privileges (#95562)OverMighty1-21/+27
Non-root users may be able to set real-time scheduling policies. Don't expect failure to set real-time scheduling policies based on UID. Instead, check that if it fails, it is either due to missing privileges, or unsupported parameters if the scheduling policy is not mandated by POSIX. Fixes #95564.
2024-06-18[libc][fcntl] fix -Wshorten-64-to-32 for 32b ARM (#95945)Nick Desaulniers (paternity leave)1-2/+2
Fixes: llvm-project/libc/src/__support/OSUtil/linux/fcntl.cpp:63:26: error: implicit conversion loses integer precision: '__off64_t' (aka 'long long') to '__off_t' (aka 'long') [-Werror,-Wshorten-64-to-32] flk->l_start = flk64.l_start; ~ ~~~~~~^~~~~~~ llvm-project/libc/src/__support/OSUtil/linux/fcntl.cpp:64:24: error: implicit conversion loses integer precision: '__off64_t' (aka 'long long') to '__off_t' (aka 'long') [-Werror,-Wshorten-64-to-32] flk->l_len = flk64.l_len; ~ ~~~~~~^~~~~ We already have an overflow check, just need the cast to be explicit. This warning was observed on the 32b ARM build in overlay mode.
2024-06-18[libc] Remove unnecessary check in printf floats (#95841)Michael Jones1-19/+16
Fixes https://github.com/llvm/llvm-project/issues/95638 The check was `if(unsigned_num >= 0)` which will always be true. The intent was to check for zero, but the `for` loop inside the `if` was already doing that.
2024-06-17[libc] Fix getauxval being defined in a namespaceJoseph Huber2-4/+8
2024-06-17[libc][stdlib] Run freelist_heap_test only in full build mode. (#95850)lntue1-14/+16
2024-06-17[libc][stdlib] Only add internal malloc in full build mode. Use the system ↵lntue1-9/+17
malloc in overlay mode. (#95845) This causes an issue in overlay mode: https://github.com/llvm/llvm-project/pull/95736#issuecomment-2172739705
2024-06-17[libc] Only include getauxval on AARCH64 targets (#95844)Joseph Huber2-2/+4
Summary: Not all platforms support this function or header, but it was being included by every test. Move it inside of the `ifdef` for the only user, which is aarch64.
2024-06-14[libc][__support][bit] Switch popcount to Brian Kernighan’s Algorithm (#95625)Ryan Beltran1-3/+4
2024-06-14[libc] Add the implementation of the fdopen function (#94186)Xu Zhang18-77/+367
Fixes #93711 . This patch implements the ``fdopen`` function. Given that ``fdopen`` internally calls ``fcntl``, the implementation of ``fcntl`` has been moved to the ``__support/OSUtil``, where it serves as an internal public function.
2024-06-14Reapply "[libc] printf, putchar and vprintf in bareemetal entrypoints… ↵Haowei2-0/+6
(#95619) This reverts commit eca988aa4420f33810f9830c80ff9f149b7928ff. The underlying libc issue was fixed by PR#95576. The original PR is #95436 , which adds printf, putchar and vprintf in bareemetal entrypoints
2024-06-14[libc] fix build errors (#95613)Schrodinger ZHU Yifan5-3/+6
2024-06-14[libc] fix build errors (#95600)Schrodinger ZHU Yifan2-3/+3
Bitfield conversion problem tested at: https://godbolt.org/z/dxjhs5Ghr
2024-06-14[libc] fix preferred_type attribute detection (#95599)Schrodinger ZHU Yifan1-1/+1
2024-06-14[libc] add rwlock (#94156)Schrodinger ZHU Yifan35-5/+1836
2024-06-14[libc] add LIBC_INLINE annotations to BlockStore (#95573)Michael Jones1-18/+19
Add the LIBC_INLINE annotation to all the functions in blockstore.
2024-06-14[libc] Remove unnecessary include from putchar.h (#95576)Michael Jones1-2/+0
The putchar header was including the public stdio.h. It doesn't need to do that and it was causing build failures for downstream baremetal users so this patch fixes it.
2024-06-14[libc][stdlib] Make the FreeListHeap constant-initializable (#95453)PiJoules10-114/+283
This refactors some of the FreeListHeap, FreeList, and Block classes to have constexpr ctors so we can constinit a global allocator that does not require running some global function or global ctor to initialize. This is needed to prevent worrying about initialization order and any other module-ctor can invoke malloc without worry.
2024-06-14Revert "[libc] printf, putchar and vprintf in bareemetal entrypoints (#95436)"Haowei Wu2-6/+0
This reverts commit b1de42a81d838bb0c6dea7d2436820a2456c730b, which breaks libc build for baremetal targets.
2024-06-14[libc] Fixed NamedType usage in Fenv HeaderSpec Types (#95487)RoseZhang031-2/+2
Issue: NamedType<"fenv_t"> and NamedType<"fexcept_t"> were used in Fenv HeaderSpec Types section instead of the actual NamedType Fixed: Changed to FEnvT and FExceptT
2024-06-14[libc][math][c23] Add f16fmaf C23 math function (#95483)OverMighty29-300/+501
Part of #93566.
2024-06-13[libc] printf, putchar and vprintf in bareemetal entrypoints (#95436)Petr Hosek2-0/+6
We now have baremetal implementations of these entrypoints.
2024-06-13[libc] Provide vprintf for baremetal (#95363)Petr Hosek3-1/+63
This is similar to baremetal printf that was implemented in #94078.
2024-06-13Reland "[libc] fix aarch64 linux full build (#95358)" (#95423)Schrodinger ZHU Yifan7-1/+49
Reverts llvm/llvm-project#95419 and Reland #95358. This PR is full of temporal fixes. After a discussion with @lntue, it is better to avoid further changes to the cmake infrastructure for now as a rework to the cmake utilities will be landed in the future.
2024-06-13[libc][stdlib] Fix UB in freelist (#95330)PiJoules2-36/+20
Some of the freelist code uses type punning which is UB in C++, namely because we read from a union member that is not the active union member.
2024-06-13[libc] Fix build breaks caused by f16sqrtf changes (#95459)OverMighty3-2/+6
See Buildbot failures: - https://lab.llvm.org/buildbot/#/builders/78/builds/13 - https://lab.llvm.org/buildbot/#/builders/182/builds/7
2024-06-13[llvm-project] Fix typo "seperate" (#95373)Jay Foad3-7/+7
2024-06-13[libc][math][c23] Add f16sqrtf C23 math function (#95251)OverMighty29-123/+352
Part of #95250.
2024-06-13Revert "[libc] fix aarch64 linux full build (#95358)" (#95419)Schrodinger ZHU Yifan3-14/+0
2024-06-13[libc] fix aarch64 linux full build (#95358)Schrodinger ZHU Yifan3-0/+14
2024-06-12[libc][stdlib] Add the FreelistHeap (#95066)PiJoules4-0/+449
This is the actual freelist allocator which utilizes the generic FreeList and the Block classes. We will eventually wrap the malloc interface around this. This is a part of #94270 to land in smaller patches.
2024-06-12[libc][macros] Define LIBC_CONSTINIT (#95316)PiJoules1-0/+12
2024-06-12[libc][__support] Add constexpr to FixedVector members (#95315)PiJoules1-11/+11
2024-06-12[libc] Fix definition of `UINT_MAX` in limits.h (#95279)Joseph Huber1-3/+3
Summary: Currently we use `(~0U)` for this definition, however the ~ operator returns a different sign, meaning that preprocessor checks against this value will fail. See https://godbolt.org/z/TrjaY1d8q where the preprocessor thinks that it's not `0xffffffff` while the static assertion thinks it is. This is because the latter does implicit conversion but the preprocessor does not. This is now consistent with other headers.
2024-06-12[libc] Add baremetal putchar (#95182)Michael Jones3-8/+37
In #94685 I discussed my ideas for cleaner baremetal output writing. This patch is not that. This patch just uses `write_to_stderr` for outputting from putchar and printf on baremetal. I'm still planning to create a proper design for writing to stdout and stderr on various platforms, but that will be a followup patch.
2024-06-11[libc][math][c23] Add {totalorder,totalordermag}f16 C23 math functions (#95014)OverMighty18-4/+480
Part of #93566.
2024-06-10[libc][stdlib] Change old unsigned short variables to size_t (#95065)PiJoules1-3/+3
They were assigned from calls to find_chunk_ptr_for_size which return size_t now.
2024-06-10[libc][stdlib] Add freelist class (#95041)PiJoules4-0/+386
This implements a traditional freelist to be used by the freelist allocator. It operates on spans of bytes which can be anything. The freelist allocator will store Blocks inside them. This is a part of #94270 to land in smaller patches.
2024-06-10[libc][stdlib] Move LIBC_INLINE after template and before constexpr (#95037)PiJoules1-2/+2
2024-06-10[NFC][libc][stdlib] LLVM_LIBC_SRC_STDLIB_LDIV_H -> LLVM_LIBC_SRC_STDL… ↵PiJoules1-1/+1
(#95038) …IB_FREE_H
2024-06-10[libc][math][c23] Add MPFR unit tests for ↵OverMighty9-35/+222
{rint,lrint,llrint,lround,llround}f16 (#94473)
2024-06-10[libc][stdlib] Add Block class (#94407)PiJoules4-0/+1077
A block represents a chunk of memory used by the freelist allocator. It contains header information denoting the usable space and pointers as offsets to the next and previous block. On it's own, this doesn't do much. This is a part of https://github.com/llvm/llvm-project/pull/94270 to land in smaller patches. This is a subset of pigweed's freelist allocator implementation.
2024-06-10Reapply "[libc][math][c23] Add MPFR unit tests for ↵OverMighty12-53/+264
{ceil,floor,round,roundeven,trunc}f16 (#94383)" (#94807) This reverts commit cbe97e959dc67503d7cc44a3810e3124b6d3340e.
2024-06-10[libc][math][c23] Temporarily disable float16 on 32-bit Arm (#95027)OverMighty1-1/+1
See Buildbot failure: https://lab.llvm.org/buildbot/#/builders/229/builds/27009.
2024-06-10[libc][math][c23] Add {remainder,remquo}f16 C23 math functions (#94773)OverMighty14-17/+151
Part of #93566.
2024-06-10[libc][math][c23] Temporarily disable float16 on RISC-V (#94984)OverMighty1-1/+2
See Buildbot failures: - https://lab.llvm.org/buildbot/#/builders/257/builds/13450 - https://lab.llvm.org/buildbot/#/builders/256/builds/14531
2024-06-10[libc] Add WordTypeSelector<16> specialization (#94979)OverMighty6-6/+25
2024-06-10[libc][math][c23] Temporarily disable modff16 on AArch64 (#94972)OverMighty1-1/+1
See Buildbot failure: https://lab.llvm.org/buildbot/#/builders/138/builds/67428.
2024-06-10[libc][math][c23] Add {frexp,ilogb,llogb,logb,modf}f16 C23 math functions ↵OverMighty31-36/+480
(#94758) Part of #93566.
2024-06-10[libc][math][c23] Add nanf16 C23 math function (#94767)OverMighty11-2/+129
Part of #93566.
2024-06-08[libc][math][C23] Implemented remquof128 function (#94809)Hendrik Hübner10-1/+83
Added remquof128 function. Closes #94312