[libc-commits] [libc] ffed34e - [libc] Fix getauxval being defined in a namespace
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Mon Jun 17 17:52:19 PDT 2024
Author: Joseph Huber
Date: 2024-06-17T19:52:06-05:00
New Revision: ffed34e0250820161c68d799ad883eb00086ac05
URL: https://github.com/llvm/llvm-project/commit/ffed34e0250820161c68d799ad883eb00086ac05
DIFF: https://github.com/llvm/llvm-project/commit/ffed34e0250820161c68d799ad883eb00086ac05.diff
LOG: [libc] Fix getauxval being defined in a namespace
Added:
Modified:
libc/test/IntegrationTest/test.cpp
libc/test/UnitTest/HermeticTestUtils.cpp
Removed:
################################################################################
diff --git a/libc/test/IntegrationTest/test.cpp b/libc/test/IntegrationTest/test.cpp
index 0c961dbafb840..2751f3180a8e3 100644
--- a/libc/test/IntegrationTest/test.cpp
+++ b/libc/test/IntegrationTest/test.cpp
@@ -10,6 +10,10 @@
#include <stddef.h>
#include <stdint.h>
+#ifdef LIBC_TARGET_ARCH_IS_AARCH64
+#include "src/sys/auxv/getauxval.h"
+#endif
+
// Integration tests rely on the following memory functions. This is because the
// compiler code generation can emit calls to them. We want to map the external
// entrypoint to the internal implementation of the function used for testing.
@@ -82,8 +86,6 @@ void *realloc(void *ptr, size_t s) {
void *__dso_handle = nullptr;
#ifdef LIBC_TARGET_ARCH_IS_AARCH64
-#include "src/sys/auxv/getauxval.h"
-
// Due to historical reasons, libgcc on aarch64 may expect __getauxval to be
// defined. See also https://gcc.gnu.org/pipermail/gcc-cvs/2020-June/300635.html
unsigned long __getauxval(unsigned long id) {
diff --git a/libc/test/UnitTest/HermeticTestUtils.cpp b/libc/test/UnitTest/HermeticTestUtils.cpp
index 191e54b7344a6..ca854ad94393e 100644
--- a/libc/test/UnitTest/HermeticTestUtils.cpp
+++ b/libc/test/UnitTest/HermeticTestUtils.cpp
@@ -10,6 +10,10 @@
#include <stddef.h>
#include <stdint.h>
+#ifdef LIBC_TARGET_ARCH_IS_AARCH64
+#include "src/sys/auxv/getauxval.h"
+#endif
+
namespace LIBC_NAMESPACE {
int bcmp(const void *lhs, const void *rhs, size_t count);
@@ -110,8 +114,6 @@ void __cxa_pure_virtual() {
void *__dso_handle = nullptr;
#ifdef LIBC_TARGET_ARCH_IS_AARCH64
-#include "src/sys/auxv/getauxval.h"
-
// Due to historical reasons, libgcc on aarch64 may expect __getauxval to be
// defined. See also https://gcc.gnu.org/pipermail/gcc-cvs/2020-June/300635.html
unsigned long __getauxval(unsigned long id) {
More information about the libc-commits
mailing list