21 Commits

Author SHA1 Message Date
Joseph Huber
79253cfe6b
[libc] Fix integration tests on w64 amdgpu targets (#152303)
Summary:
We need `malloc` to return a larger size now that it's aligned properly
and we use a bunch of threads. Also the `match_any` test was wrong
because it assumed a 32-bit lanemask.
2025-08-06 08:36:06 -05:00
Schrodinger ZHU Yifan
e797c71609
Reland "[libc] make integration test malloc work properly when threaded" (#152236)
Reverts llvm/llvm-project#152096
2025-08-05 23:12:19 -04:00
Jan Patrick Lehr
6393a9edde
Revert "[libc] make integration test malloc work properly when threaded" (#152096)
Reverts llvm/llvm-project#151622

This broke our libc on GPU bot:
https://lab.llvm.org/buildbot/#/builders/10/builds/10864
2025-08-05 09:26:59 +02:00
Schrodinger ZHU Yifan
8eab158396
[libc] make integration test malloc work properly when threaded (#151622)
Make the simple bump allocation backed by atomic operations.
2025-08-04 23:49:51 -04:00
lntue
66603dd1f1
[libc][NFC] Add stdint.h proxy header to fix dependency issue with <stdint.h> includes. (#150303)
https://github.com/llvm/llvm-project/issues/149993
2025-07-23 20:19:52 -04:00
Petr Hosek
5ff3ff33ff
[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98597)
This is a part of #97655.
2024-07-12 09:28:41 -07:00
Mehdi Amini
ce9035f5bd
Revert "[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration" (#98593)
Reverts llvm/llvm-project#98075

bots are broken
2024-07-12 09:12:13 +02:00
Petr Hosek
3f30effe1b
[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98075)
This is a part of #97655.
2024-07-11 12:35:22 -07:00
Joseph Huber
ffed34e025 [libc] Fix getauxval being defined in a namespace 2024-06-17 19:52:06 -05:00
Joseph Huber
44ca65661e
[libc] Only include getauxval on AARCH64 targets (#95844)
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-17 15:51:26 -05:00
Schrodinger ZHU Yifan
2efe3d7fc0
Reland "[libc] fix aarch64 linux full build (#95358)" (#95423)
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 20:34:32 -07:00
Schrodinger ZHU Yifan
9e5428e6b0
Revert "[libc] fix aarch64 linux full build (#95358)" (#95419) 2024-06-13 08:37:20 -07:00
Schrodinger ZHU Yifan
ca05204f9a
[libc] fix aarch64 linux full build (#95358) 2024-06-13 07:45:25 -07:00
Guillaume Chatelet
b6bc9d72f6
[libc] Mass replace enclosing namespace (#67032)
This is step 4 of
https://discourse.llvm.org/t/rfc-customizable-namespace-to-allow-testing-the-libc-when-the-system-libc-is-also-llvms-libc/73079
2023-09-26 11:45:04 +02:00
Joseph Huber
9417d9fc38 [libc] Make the bump pointer explicitly return null on buffer oveerrun
We use a simple bump ptr in the `libc` tests. If we run out of data we
can currently return other static memory and have weird failure cases.
We should fail more explicitly here by returning a null pointer instead.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D150529
2023-05-15 06:15:52 -05:00
Joseph Huber
2e1c0ec629 [libc] Support global constructors and destructors on NVPTX
This patch adds the necessary hacks to support global constructors and
destructors. This is an incredibly hacky process caused by the primary
fact that Nvidia does not provide any binary tools and very little
linker support. We first had to emit references to these functions and
their priority in D149451. Then we dig them out of the module once it's
loaded to manually create the list that the linker should have made for
us. This patch also contains a few Nvidia specific hacks, but it passes
the test, albeit with a stack size warning from `ptxas` for the
callback. But this should be fine given the resource usage of a common
test.

This also adds a dependency on LLVM to the NVPTX loader, which hopefully doesn't
cause problems with our CUDA buildbot.

Depends on D149451

Reviewed By: tra

Differential Revision: https://reviews.llvm.org/D149527
2023-05-04 07:13:00 -05:00
Joseph Huber
38d7f855b8 [libc] Add missing return statements to wrapper functions
Summary:
I forgot to add return statements to these memory comparison functions.
This should hopefully resolve some BB errors.
2023-03-15 22:16:27 -05:00
Joseph Huber
929ad8bc7c [libc] Add aliases to C memory functions for integration tests
The integration tests require the C memory functions as the compiler may
emit calls to them directly. The tests normally use the `__internal__`
variant that is built for testing, but these memory functions were
linked directly to preserve the entrypoint. Instead, we forward delcare
the internal versions and map the entrypoints to them manually inside
the integration test. This allows us to use the internal versions of
these files like the rest of the test objects.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D146177
2023-03-15 20:15:05 -05:00
Siva Chandra Reddy
5b1ad43c2b [libc] Declare __dso_handle in the integration test instead of startup.
Fixes #61355. The __dso_handle decl was introduced incorrectly into the startup
objects during the integration test cleanup which moved the integration tests
away from using an artificial sysroot to using -nostdlib. Having it in the
startup creates the duplicate symbol error when one does not use -nostdlib.
Since this is an integration test only problem, it is meaningful to keep it in
the integration test anyway.

Differential Revision: https://reviews.llvm.org/D145898
2023-03-13 07:47:00 +00:00
Siva Chandra Reddy
43de233e29 [libc][NFC] Remove allocator definition in the api-test.
The integration tests already have allocators so we will get all of them
from there.
2023-03-05 00:25:02 +00:00
Siva Chandra Reddy
af1315c28f [libc][NFC] Move UnitTest and IntegrationTest to the 'test' directory.
This part of the effort to make all test related pieces into the `test`
directory. This helps is excluding test related pieces in a straight
forward manner if LLVM_INCLUDE_TESTS is OFF. Future patches will also move
the MPFR wrapper and testutils into the 'test' directory.
2023-02-07 19:45:51 +00:00