[libc-commits] [PATCH] D149863: [libc] Maintain proper alignment for the hermetic tests malloc
Joseph Huber via Phabricator via libc-commits
libc-commits at lists.llvm.org
Thu May 4 11:22:38 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGcbcf55d32b62: [libc] Maintain proper alignment for the hermetic tests malloc (authored by jhuber6).
Changed prior to commit:
https://reviews.llvm.org/D149863?vs=519546&id=519578#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149863/new/
https://reviews.llvm.org/D149863
Files:
libc/test/UnitTest/HermeticTestUtils.cpp
libc/test/src/__support/CMakeLists.txt
Index: libc/test/src/__support/CMakeLists.txt
===================================================================
--- libc/test/src/__support/CMakeLists.txt
+++ libc/test/src/__support/CMakeLists.txt
@@ -1,17 +1,14 @@
add_custom_target(libc-support-tests)
-# This test fails with a misaigned address on NVPTX.
-if(NOT LIBC_GPU_TARGET_ARCHITECTURE_IS_NVPTX)
- add_libc_test(
- blockstore_test
- SUITE
- libc-support-tests
- SRCS
- blockstore_test.cpp
- DEPENDS
- libc.src.__support.blockstore
- )
-endif()
+add_libc_test(
+ blockstore_test
+ SUITE
+ libc-support-tests
+ SRCS
+ blockstore_test.cpp
+ DEPENDS
+ libc.src.__support.blockstore
+)
add_libc_test(
endian_test
Index: libc/test/UnitTest/HermeticTestUtils.cpp
===================================================================
--- libc/test/UnitTest/HermeticTestUtils.cpp
+++ libc/test/UnitTest/HermeticTestUtils.cpp
@@ -61,7 +61,11 @@
// This is needed if the test was compiled with '-fno-use-cxa-atexit'.
int atexit(void (*func)(void)) { return __llvm_libc::atexit(func); }
+constexpr uint64_t ALIGNMENT = alignof(uintptr_t);
+
void *malloc(size_t s) {
+ // Keep the bump pointer aligned on an eight byte boundary.
+ s = ((s + ALIGNMENT - 1) / ALIGNMENT) * ALIGNMENT;
void *mem = ptr;
ptr += s;
return mem;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149863.519578.patch
Type: text/x-patch
Size: 1334 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230504/40881778/attachment.bin>
More information about the libc-commits
mailing list