Skip to content

[libc] Add proxy headers to handle memory allocation associated with the header `#include <stdlib.h> #114690

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
9 commits merged into from Nov 3, 2024
Merged

Conversation

ghost
Copy link

@ghost ghost commented Nov 3, 2024

This finishes the work from #114453 by adding proxy headers for malloc, realloc, free and aligned_alloc.

@llvmbot llvmbot added the libc label Nov 3, 2024
@ghost ghost requested a review from lntue November 3, 2024 01:16
@llvmbot
Copy link
Member

llvmbot commented Nov 3, 2024

@llvm/pr-subscribers-libc

Author: Job Henandez Lara (Jobhdez)

Changes

This finishes the work from #114453 by adding proxy headers for malloc, realloc, free and aligned_alloc.


Full diff: https://github.com/llvm/llvm-project/pull/114690.diff

15 Files Affected:

  • (modified) libc/hdr/CMakeLists.txt (+40)
  • (added) libc/hdr/aligned_alloc.h (+21)
  • (added) libc/hdr/free.h (+21)
  • (added) libc/hdr/malloc.h (+21)
  • (added) libc/hdr/realloc.h (+21)
  • (modified) libc/src/__support/CMakeLists.txt (+3)
  • (modified) libc/src/__support/CPP/CMakeLists.txt (+6-2)
  • (modified) libc/src/__support/CPP/new.cpp (+1-1)
  • (modified) libc/src/__support/CPP/new.h (+3-1)
  • (modified) libc/src/__support/CPP/string.h (+3-1)
  • (modified) libc/src/__support/File/CMakeLists.txt (+1)
  • (modified) libc/src/__support/File/file.cpp (+1)
  • (modified) libc/src/__support/char_vector.h (+4-1)
  • (modified) libc/src/stdio/printf_core/CMakeLists.txt (+3-2)
  • (modified) libc/src/stdio/printf_core/vasprintf_internal.h (+4-1)
diff --git a/libc/hdr/CMakeLists.txt b/libc/hdr/CMakeLists.txt
index c63eadab6f5d77..34dd60ae629b1e 100644
--- a/libc/hdr/CMakeLists.txt
+++ b/libc/hdr/CMakeLists.txt
@@ -23,6 +23,16 @@ function(add_proxy_header_library target_name)
   )
 endfunction()
 
+add_proxy_header_library(
+  aligned_alloc
+  HDRS
+    aligned_alloc.h
+  DEPENDS
+    .stdlib_overlay.h
+  FULL_BUILD_DEPENDS
+    libc.include.stdlib
+)
+
 add_proxy_header_library(
   math_macros
   HDRS
@@ -152,6 +162,16 @@ add_proxy_header_library(
     libc.include.float
 )
 
+add_proxy_header_library(
+  free
+  HDRS
+    free.h
+  DEPENDS
+    .stdlib_overlay.h
+  FULL_BUILD_DEPENDS
+    libc.include.stdlib
+)
+
 add_proxy_header_library(
   limits_macros
   HDRS
@@ -170,6 +190,26 @@ add_proxy_header_library(
     libc.include.link
 )
 
+add_proxy_header_library(
+  malloc
+  HDRS
+    malloc.h
+  DEPENDS
+    .stdlib_overlay.h
+  FULL_BUILD_DEPENDS
+    libc.include.stdlib
+)
+
+add_proxy_header_library(
+  realloc
+  HDRS
+    realloc.h
+  DEPENDS
+    .stdlib_overlay.h
+  FULL_BUILD_DEPENDS
+    libc.include.stdlib
+)
+
 add_proxy_header_library(
   sys_auxv_macros
   HDRS
diff --git a/libc/hdr/aligned_alloc.h b/libc/hdr/aligned_alloc.h
new file mode 100644
index 00000000000000..11d0d0331bd81f
--- /dev/null
+++ b/libc/hdr/aligned_alloc.h
@@ -0,0 +1,21 @@
+//===-- Definition of the aligned_alloc.h proxy ---------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_HDR_ALIGNED_ALLOC_H
+#define LLVM_LIBC_HDR_ALIGNED_ALLOC_H
+
+#ifdef LIBC_FULL_BUILD
+extern "C" void *aligned_alloc(size_t, size_t);
+
+#else // Overlay mode
+
+#include "stdlib_overlay.h"
+
+#endif
+
+#endif
diff --git a/libc/hdr/free.h b/libc/hdr/free.h
new file mode 100644
index 00000000000000..f40593ff96aeca
--- /dev/null
+++ b/libc/hdr/free.h
@@ -0,0 +1,21 @@
+//===-- Definition of the free.h proxy ------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_HDR_FREE_H
+#define LLVM_LIBC_HDR_FREE_H
+
+#ifdef LIBC_FULL_BUILD
+extern "C" void free(void *);
+
+#else // Overlay mode
+
+#include "stdlib_overlay.h"
+
+#endif
+
+#endif
diff --git a/libc/hdr/malloc.h b/libc/hdr/malloc.h
new file mode 100644
index 00000000000000..be002440cd25bf
--- /dev/null
+++ b/libc/hdr/malloc.h
@@ -0,0 +1,21 @@
+//===-- Definition of the malloc.h proxy ----------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_HDR_MALLOC_H
+#define LLVM_LIBC_HDR_MALLOC_H
+
+#ifdef LIBC_FULL_BUILD
+extern "C" void *malloc(size_t);
+
+#else // Overlay mode
+
+#include "stdlib_overlay.h"
+
+#endif
+
+#endif
diff --git a/libc/hdr/realloc.h b/libc/hdr/realloc.h
new file mode 100644
index 00000000000000..140d175d5462b7
--- /dev/null
+++ b/libc/hdr/realloc.h
@@ -0,0 +1,21 @@
+//===-- Definition of the realloc.h proxy ---------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_HDR_REALLOC_H
+#define LLVM_LIBC_HDR_REALLOC_H
+
+#ifdef LIBC_FULL_BUILD
+extern "C" void *realloc(void *ptr, size_t new_size);
+
+#else // Overlay mode
+
+#include "stdlib_overlay.h"
+
+#endif
+
+#endif
diff --git a/libc/src/__support/CMakeLists.txt b/libc/src/__support/CMakeLists.txt
index 14a3acff8fae93..448cfa64c32157 100644
--- a/libc/src/__support/CMakeLists.txt
+++ b/libc/src/__support/CMakeLists.txt
@@ -236,6 +236,9 @@ add_header_library(
   HDRS
     char_vector.h
   DEPENDS
+    libc.hdr.free
+    libc.hdr.malloc
+    libc.hdr.realloc
     libc.src.__support.common
 )
 
diff --git a/libc/src/__support/CPP/CMakeLists.txt b/libc/src/__support/CPP/CMakeLists.txt
index 774668be42e56d..cc2e48bb81abf1 100644
--- a/libc/src/__support/CPP/CMakeLists.txt
+++ b/libc/src/__support/CPP/CMakeLists.txt
@@ -80,7 +80,9 @@ add_header_library(
   HDRS
     string.h
   DEPENDS
-    libc.include.stdlib
+    libc.hdr.free
+    libc.hdr.malloc
+    libc.hdr.realloc 
     .string_view
     libc.src.__support.common
     libc.src.__support.integer_to_string
@@ -199,7 +201,9 @@ add_object_library(
   HDRS
     new.h
   DEPENDS
-    libc.include.stdlib
+    libc.hdr.free
+    libc.hdr.malloc
+    libc.hdr.aligned_alloc 
     libc.src.__support.common
     libc.src.__support.macros.properties.os
 )
diff --git a/libc/src/__support/CPP/new.cpp b/libc/src/__support/CPP/new.cpp
index 8316329fb10b0b..969bd5b1231562 100644
--- a/libc/src/__support/CPP/new.cpp
+++ b/libc/src/__support/CPP/new.cpp
@@ -7,7 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "new.h"
-#include <stdlib.h> // For free, etc
+#include "hdr/free.h" // For free, etc
 
 void operator delete(void *mem) noexcept { ::free(mem); }
 
diff --git a/libc/src/__support/CPP/new.h b/libc/src/__support/CPP/new.h
index c1b6b95033f84c..71e9c1e23c27df 100644
--- a/libc/src/__support/CPP/new.h
+++ b/libc/src/__support/CPP/new.h
@@ -13,8 +13,10 @@
 #include "src/__support/macros/config.h"
 #include "src/__support/macros/properties/os.h"
 
+#include "hdr/aligned_alloc.h"
+#include "hdr/free.h"
+#include "hdr/malloc.h"
 #include <stddef.h> // For size_t
-#include <stdlib.h> // For malloc, free etc.
 
 // Defining members in the std namespace is not preferred. But, we do it here
 // so that we can use it to define the operator new which takes std::align_val_t
diff --git a/libc/src/__support/CPP/string.h b/libc/src/__support/CPP/string.h
index 64d4c276e84281..ea3096b6ca68c4 100644
--- a/libc/src/__support/CPP/string.h
+++ b/libc/src/__support/CPP/string.h
@@ -16,8 +16,10 @@
 #include "src/string/memory_utils/inline_memset.h"
 #include "src/string/string_utils.h" // string_length
 
+#include "hdr/free.h"
+#include "hdr/malloc.h"
+#include "hdr/realloc.h"
 #include <stddef.h> // size_t
-#include <stdlib.h> // malloc, free
 
 namespace LIBC_NAMESPACE_DECL {
 namespace cpp {
diff --git a/libc/src/__support/File/CMakeLists.txt b/libc/src/__support/File/CMakeLists.txt
index 1b390a12424d04..b04606ab27ae6b 100644
--- a/libc/src/__support/File/CMakeLists.txt
+++ b/libc/src/__support/File/CMakeLists.txt
@@ -18,6 +18,7 @@ add_object_library(
     libc.src.__support.error_or
     libc.hdr.types.off_t
     libc.hdr.stdio_macros
+    libc.hdr.realloc
 )
 
 add_object_library(
diff --git a/libc/src/__support/File/file.cpp b/libc/src/__support/File/file.cpp
index 51811a27c1acd6..7528780df2b0bc 100644
--- a/libc/src/__support/File/file.cpp
+++ b/libc/src/__support/File/file.cpp
@@ -8,6 +8,7 @@
 
 #include "file.h"
 
+#include "hdr/realloc.h"
 #include "hdr/stdio_macros.h"
 #include "hdr/types/off_t.h"
 #include "src/__support/CPP/new.h"
diff --git a/libc/src/__support/char_vector.h b/libc/src/__support/char_vector.h
index df109da5d81278..e44d037a9a042f 100644
--- a/libc/src/__support/char_vector.h
+++ b/libc/src/__support/char_vector.h
@@ -13,7 +13,10 @@
 #include "src/__support/macros/config.h"
 
 #include <stddef.h> // size_t
-#include <stdlib.h> // malloc, realloc, free
+
+#include "hdr/free.h"
+#include "hdr/malloc.h"
+#include "hdr/realloc.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
diff --git a/libc/src/stdio/printf_core/CMakeLists.txt b/libc/src/stdio/printf_core/CMakeLists.txt
index 8172fda1e866ed..a192ea863be3f9 100644
--- a/libc/src/stdio/printf_core/CMakeLists.txt
+++ b/libc/src/stdio/printf_core/CMakeLists.txt
@@ -132,8 +132,9 @@ add_header_library(
     libc.src.__support.arg_list
     libc.src.stdio.printf_core.printf_main
     libc.src.stdio.printf_core.writer
-    libc.src.stdlib.malloc
-    libc.src.stdlib.realloc
+    libc.hdr.malloc
+    libc.hdr.free
+    libc.hdr.realloc
 )
 
 if(NOT (TARGET libc.src.__support.File.file) AND LLVM_LIBC_FULL_BUILD)
diff --git a/libc/src/stdio/printf_core/vasprintf_internal.h b/libc/src/stdio/printf_core/vasprintf_internal.h
index e3448eebd302b7..26cf7b98053de4 100644
--- a/libc/src/stdio/printf_core/vasprintf_internal.h
+++ b/libc/src/stdio/printf_core/vasprintf_internal.h
@@ -11,7 +11,10 @@
 #include "src/stdio/printf_core/core_structs.h"
 #include "src/stdio/printf_core/printf_main.h"
 #include "src/stdio/printf_core/writer.h"
-#include <stdlib.h> // malloc, realloc, free
+// #include <stdlib.h> // malloc, realloc, free
+#include "hdr/free.h"
+#include "hdr/malloc.h"
+#include "hdr/realloc.h"
 
 namespace LIBC_NAMESPACE_DECL {
 namespace printf_core {

HDRS
aligned_alloc.h
DEPENDS
.stdlib_overlay
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: move this target after stdlib_overlay target.

#define LLVM_LIBC_HDR_FUNC_FREE_H

#ifdef LIBC_FULL_BUILD
#include "hdr/types/size_t.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

size_t is not needed

DEPENDS
libc.hdr.stdlib_overlay
FULL_BUILD_DEPENDS
libc.include.stdlib
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

size_t header dependency.

DEPENDS
libc.hdr.stdlib_overlay
FULL_BUILD_DEPENDS
libc.include.stdlib
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

size_t header dependency

@@ -387,6 +387,7 @@ if(LLVM_LIBC_FULL_BUILD)
libc.src.stdlib.exit
libc.src.stdlib.atexit
libc.src.__support.CPP.array
libc.hdr.func._Exit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put libc.hdr above libc.src and probably remove libc.include.stdlib

@@ -401,6 +402,7 @@ if(LLVM_LIBC_FULL_BUILD)
libc.src.stdlib.quick_exit
libc.src.stdlib.at_quick_exit
libc.src.__support.CPP.array
libc.hdr.func._Exit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: put libc.hdr above libc.src

@ghost ghost merged commit 9cfe302 into llvm:main Nov 3, 2024
7 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 3, 2024

LLVM Buildbot has detected a new failure on builder libc-x86_64-debian-gcc-fullbuild-dbg running on libc-x86_64-debian-fullbuild while building libc at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/131/builds/9605

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
[       OK ] LlvmLibcRandTest.SetSeed (5 us)
Ran 2 tests.  PASS: 2  FAIL: 0
[2687/3341] Running unit test libc.test.src.stdlib._Exit_test.__unit__
[==========] Running 1 test from 1 test suite.
[ RUN      ] LlvmLibcStdlib._Exit
[       OK ] LlvmLibcStdlib._Exit (662 us)
Ran 1 tests.  PASS: 1  FAIL: 0
[2688/3341] Linking CXX executable projects/libc/test/src/stdlib/libc.test.src.stdlib.qsort_r_test.__unit__.__build__
[2689/3341] Linking CXX executable projects/libc/test/src/stdlib/libc.test.src.stdlib.qsort_test.__unit__.__build__
[2690/3341] Building CXX object projects/libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.at_quick_exit_test.__unit__.__build__.dir/at_quick_exit_test.cpp.o
FAILED: projects/libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.at_quick_exit_test.__unit__.__build__.dir/at_quick_exit_test.cpp.o 
/usr/bin/g++ -DLIBC_NAMESPACE=__llvm_libc_19_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/projects/libc/test/src/stdlib -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/projects/libc/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g -fpie -DLIBC_FULL_BUILD -ffreestanding -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -fext-numeric-literals -Wno-pedantic -std=c++17 -MD -MT projects/libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.at_quick_exit_test.__unit__.__build__.dir/at_quick_exit_test.cpp.o -MF projects/libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.at_quick_exit_test.__unit__.__build__.dir/at_quick_exit_test.cpp.o.d -o projects/libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.at_quick_exit_test.__unit__.__build__.dir/at_quick_exit_test.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/at_quick_exit_test.cpp
In file included from /usr/lib/gcc/x86_64-linux-gnu/12/include/mm_malloc.h:27,
                 from /usr/lib/gcc/x86_64-linux-gnu/12/include/xmmintrin.h:34,
                 from /usr/lib/gcc/x86_64-linux-gnu/12/include/immintrin.h:31,
                 from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/string/memory_utils/op_x86.h:26,
                 from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/string/memory_utils/x86_64/inline_memcpy.h:14,
                 from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/string/memory_utils/inline_memcpy.h:22,
                 from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/CPP/string.h:18,
                 from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:29,
                 from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/Test.h:37,
                 from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/at_quick_exit_test.cpp:14:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/projects/libc/include/stdlib.h:101:16: error: function ‘void _Exit(int)’ declared ‘[[noreturn]]’ but its first declaration was not
  101 | _Noreturn void _Exit(int) __NOEXCEPT;
      |                ^~~~~
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/at_quick_exit_test.cpp:9:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/hdr/func/_Exit.h:13:17: note: previous declaration of ‘void _Exit(int)’
   13 | extern "C" void _Exit(int);
      |                 ^~~~~
[2691/3341] Running unit test libc.test.src.stdlib.strtoul_test.__unit__
[==========] Running 7 tests from 1 test suite.
[ RUN      ] LlvmLibcStrtoulTest.InvalidBase
[       OK ] LlvmLibcStrtoulTest.InvalidBase (5 us)
[ RUN      ] LlvmLibcStrtoulTest.CleanBaseTenDecode
[       OK ] LlvmLibcStrtoulTest.CleanBaseTenDecode (10 us)
[ RUN      ] LlvmLibcStrtoulTest.MessyBaseTenDecode
[       OK ] LlvmLibcStrtoulTest.MessyBaseTenDecode (7 us)
[ RUN      ] LlvmLibcStrtoulTest.DecodeInOtherBases
[       OK ] LlvmLibcStrtoulTest.DecodeInOtherBases (480 ms)
[ RUN      ] LlvmLibcStrtoulTest.CleanBaseSixteenDecode
[       OK ] LlvmLibcStrtoulTest.CleanBaseSixteenDecode (13 us)
[ RUN      ] LlvmLibcStrtoulTest.MessyBaseSixteenDecode
[       OK ] LlvmLibcStrtoulTest.MessyBaseSixteenDecode (4 us)
[ RUN      ] LlvmLibcStrtoulTest.AutomaticBaseSelection
[       OK ] LlvmLibcStrtoulTest.AutomaticBaseSelection (6 us)
Ran 7 tests.  PASS: 7  FAIL: 0
[2692/3341] Running unit test libc.test.src.stdlib.abort_test.__unit__
[==========] Running 1 test from 1 test suite.
[ RUN      ] LlvmLibcStdlib.abort
Step 8 (libc-unit-tests) failure: libc-unit-tests (failure)
...
[       OK ] LlvmLibcRandTest.SetSeed (5 us)
Ran 2 tests.  PASS: 2  FAIL: 0
[2687/3341] Running unit test libc.test.src.stdlib._Exit_test.__unit__
[==========] Running 1 test from 1 test suite.
[ RUN      ] LlvmLibcStdlib._Exit
[       OK ] LlvmLibcStdlib._Exit (662 us)
Ran 1 tests.  PASS: 1  FAIL: 0
[2688/3341] Linking CXX executable projects/libc/test/src/stdlib/libc.test.src.stdlib.qsort_r_test.__unit__.__build__
[2689/3341] Linking CXX executable projects/libc/test/src/stdlib/libc.test.src.stdlib.qsort_test.__unit__.__build__
[2690/3341] Building CXX object projects/libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.at_quick_exit_test.__unit__.__build__.dir/at_quick_exit_test.cpp.o
FAILED: projects/libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.at_quick_exit_test.__unit__.__build__.dir/at_quick_exit_test.cpp.o 
/usr/bin/g++ -DLIBC_NAMESPACE=__llvm_libc_19_0_0_git -D_DEBUG -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/projects/libc/test/src/stdlib -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib -I/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc -isystem /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/projects/libc/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g -fpie -DLIBC_FULL_BUILD -ffreestanding -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -fext-numeric-literals -Wno-pedantic -std=c++17 -MD -MT projects/libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.at_quick_exit_test.__unit__.__build__.dir/at_quick_exit_test.cpp.o -MF projects/libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.at_quick_exit_test.__unit__.__build__.dir/at_quick_exit_test.cpp.o.d -o projects/libc/test/src/stdlib/CMakeFiles/libc.test.src.stdlib.at_quick_exit_test.__unit__.__build__.dir/at_quick_exit_test.cpp.o -c /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/at_quick_exit_test.cpp
In file included from /usr/lib/gcc/x86_64-linux-gnu/12/include/mm_malloc.h:27,
                 from /usr/lib/gcc/x86_64-linux-gnu/12/include/xmmintrin.h:34,
                 from /usr/lib/gcc/x86_64-linux-gnu/12/include/immintrin.h:31,
                 from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/string/memory_utils/op_x86.h:26,
                 from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/string/memory_utils/x86_64/inline_memcpy.h:14,
                 from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/string/memory_utils/inline_memcpy.h:22,
                 from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/src/__support/CPP/string.h:18,
                 from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/LibcTest.h:29,
                 from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/UnitTest/Test.h:37,
                 from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/at_quick_exit_test.cpp:14:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/build/projects/libc/include/stdlib.h:101:16: error: function ‘void _Exit(int)’ declared ‘[[noreturn]]’ but its first declaration was not
  101 | _Noreturn void _Exit(int) __NOEXCEPT;
      |                ^~~~~
In file included from /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/test/src/stdlib/at_quick_exit_test.cpp:9:
/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-gcc-fullbuild-dbg/llvm-project/libc/hdr/func/_Exit.h:13:17: note: previous declaration of ‘void _Exit(int)’
   13 | extern "C" void _Exit(int);
      |                 ^~~~~
[2691/3341] Running unit test libc.test.src.stdlib.strtoul_test.__unit__
[==========] Running 7 tests from 1 test suite.
[ RUN      ] LlvmLibcStrtoulTest.InvalidBase
[       OK ] LlvmLibcStrtoulTest.InvalidBase (5 us)
[ RUN      ] LlvmLibcStrtoulTest.CleanBaseTenDecode
[       OK ] LlvmLibcStrtoulTest.CleanBaseTenDecode (10 us)
[ RUN      ] LlvmLibcStrtoulTest.MessyBaseTenDecode
[       OK ] LlvmLibcStrtoulTest.MessyBaseTenDecode (7 us)
[ RUN      ] LlvmLibcStrtoulTest.DecodeInOtherBases
[       OK ] LlvmLibcStrtoulTest.DecodeInOtherBases (480 ms)
[ RUN      ] LlvmLibcStrtoulTest.CleanBaseSixteenDecode
[       OK ] LlvmLibcStrtoulTest.CleanBaseSixteenDecode (13 us)
[ RUN      ] LlvmLibcStrtoulTest.MessyBaseSixteenDecode
[       OK ] LlvmLibcStrtoulTest.MessyBaseSixteenDecode (4 us)
[ RUN      ] LlvmLibcStrtoulTest.AutomaticBaseSelection
[       OK ] LlvmLibcStrtoulTest.AutomaticBaseSelection (6 us)
Ran 7 tests.  PASS: 7  FAIL: 0
[2692/3341] Running unit test libc.test.src.stdlib.abort_test.__unit__
[==========] Running 1 test from 1 test suite.
[ RUN      ] LlvmLibcStdlib.abort

PhilippRados pushed a commit to PhilippRados/llvm-project that referenced this pull request Nov 6, 2024
…the header `#include <stdlib.h> (llvm#114690)

This finishes the work from
llvm#114453 by adding proxy headers
for `malloc`, `realloc`, `free` and `aligned_alloc`.
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants