Skip to content

Commit 44ca656

Browse files
authored
[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.
1 parent dcb6c0d commit 44ca656

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

libc/test/IntegrationTest/test.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "src/__support/common.h"
10-
#include "src/sys/auxv/getauxval.h"
1110
#include <stddef.h>
1211
#include <stdint.h>
1312

@@ -83,6 +82,8 @@ void *realloc(void *ptr, size_t s) {
8382
void *__dso_handle = nullptr;
8483

8584
#ifdef LIBC_TARGET_ARCH_IS_AARCH64
85+
#include "src/sys/auxv/getauxval.h"
86+
8687
// Due to historical reasons, libgcc on aarch64 may expect __getauxval to be
8788
// defined. See also https://gcc.gnu.org/pipermail/gcc-cvs/2020-June/300635.html
8889
unsigned long __getauxval(unsigned long id) {

libc/test/UnitTest/HermeticTestUtils.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "src/__support/common.h"
10-
#include "src/sys/auxv/getauxval.h"
1110
#include <stddef.h>
1211
#include <stdint.h>
1312

@@ -111,6 +110,8 @@ void __cxa_pure_virtual() {
111110
void *__dso_handle = nullptr;
112111

113112
#ifdef LIBC_TARGET_ARCH_IS_AARCH64
113+
#include "src/sys/auxv/getauxval.h"
114+
114115
// Due to historical reasons, libgcc on aarch64 may expect __getauxval to be
115116
// defined. See also https://gcc.gnu.org/pipermail/gcc-cvs/2020-June/300635.html
116117
unsigned long __getauxval(unsigned long id) {

0 commit comments

Comments
 (0)