From 6f769780487e7993a894ca965e92c2dee8678f8b Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Tue, 14 Mar 2023 11:44:30 -0700 Subject: [PATCH] Fix compile errors when building with Android aarch64 PiperOrigin-RevId: 516588240 --- test/syscalls/linux/exec_state_workload.cc | 9 ++++----- test/syscalls/linux/fpsig_fork.cc | 4 ++-- test/syscalls/linux/fpsig_nested.cc | 8 ++++---- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/test/syscalls/linux/exec_state_workload.cc b/test/syscalls/linux/exec_state_workload.cc index eafdc2bfa..948db99ea 100644 --- a/test/syscalls/linux/exec_state_workload.cc +++ b/test/syscalls/linux/exec_state_workload.cc @@ -26,9 +26,10 @@ #include "absl/strings/numbers.h" -#ifndef ANDROID // Conflicts with existing operator<< on Android. - -// Pretty-print a sigset_t. +// Pretty-print a sigset_t when it is a struct type. +// This is disabled for targets such as Android x86_64, which define sigset_t as +// an integral type, to prevent conflicts with the std library. +template ::value>> std::ostream& operator<<(std::ostream& out, const sigset_t& s) { out << "{ "; @@ -42,8 +43,6 @@ std::ostream& operator<<(std::ostream& out, const sigset_t& s) { return out; } -#endif - // Verify that the signo handler is handler. int CheckSigHandler(uint32_t signo, uintptr_t handler) { struct sigaction sa; diff --git a/test/syscalls/linux/fpsig_fork.cc b/test/syscalls/linux/fpsig_fork.cc index 7326452cb..d786b2c20 100644 --- a/test/syscalls/linux/fpsig_fork.cc +++ b/test/syscalls/linux/fpsig_fork.cc @@ -114,8 +114,8 @@ TEST(FPSigTest, Fork) { "mov x0, %1\n" "mov x1, %2\n" "mov x2, %3\n" - "svc #0\n" ::"r"(__NR_tgkill), - "r"(parent), "r"(parent_tid), "r"(SIGUSR1)); + "svc #0\n" ::"N"(__NR_tgkill), + "r"((uint64_t)parent), "r"((uint64_t)parent_tid), "N"(SIGUSR1)); #endif uint64_t got; diff --git a/test/syscalls/linux/fpsig_nested.cc b/test/syscalls/linux/fpsig_nested.cc index baa913c39..8222cf5ec 100644 --- a/test/syscalls/linux/fpsig_nested.cc +++ b/test/syscalls/linux/fpsig_nested.cc @@ -86,8 +86,8 @@ void sigusr1(int s, siginfo_t* siginfo, void* _uc) { "mov x0, %1\n" "mov x1, %2\n" "mov x2, %3\n" - "svc #0\n" ::"r"(__NR_tgkill), - "r"(pid), "r"(tid), "r"(SIGUSR2)); + "svc #0\n" ::"N"(__NR_tgkill), + "r"((uint64_t)pid), "r"((uint64_t)tid), "N"(SIGUSR2)); #endif // Record value of %xmm0 again to verify that the nested signal handler @@ -142,8 +142,8 @@ TEST(FPSigTest, NestedSignals) { "mov x0, %1\n" "mov x1, %2\n" "mov x2, %3\n" - "svc #0\n" ::"r"(__NR_tgkill), - "r"(pid), "r"(tid), "r"(SIGUSR1)); + "svc #0\n" ::"N"(__NR_tgkill), + "r"((uint64_t)pid), "r"((uint64_t)tid), "N"(SIGUSR1)); #endif uint64_t got;