aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Huber <huberjn@outlook.com>2024-06-17 15:51:26 -0500
committerGitHub <noreply@github.com>2024-06-17 15:51:26 -0500
commit44ca65661e2cdd5636f592f573a2837e6ae948ba (patch)
treecd1d473d3f19225f89ad46df2c00ea004f15be05
parentdcb6c0d71c8dbb6bb17391c968c3716cfafd3765 (diff)
downloadllvm-44ca65661e2cdd5636f592f573a2837e6ae948ba.zip
llvm-44ca65661e2cdd5636f592f573a2837e6ae948ba.tar.gz
llvm-44ca65661e2cdd5636f592f573a2837e6ae948ba.tar.bz2
[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.
-rw-r--r--libc/test/IntegrationTest/test.cpp3
-rw-r--r--libc/test/UnitTest/HermeticTestUtils.cpp3
2 files changed, 4 insertions, 2 deletions
diff --git a/libc/test/IntegrationTest/test.cpp b/libc/test/IntegrationTest/test.cpp
index a8b2f29..0c961db 100644
--- a/libc/test/IntegrationTest/test.cpp
+++ b/libc/test/IntegrationTest/test.cpp
@@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
#include "src/__support/common.h"
-#include "src/sys/auxv/getauxval.h"
#include <stddef.h>
#include <stdint.h>
@@ -83,6 +82,8 @@ 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 6e815e6..191e54b 100644
--- a/libc/test/UnitTest/HermeticTestUtils.cpp
+++ b/libc/test/UnitTest/HermeticTestUtils.cpp
@@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
#include "src/__support/common.h"
-#include "src/sys/auxv/getauxval.h"
#include <stddef.h>
#include <stdint.h>
@@ -111,6 +110,8 @@ 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) {