Remove support for Native Client

Native Client has been fully removed from Chromium.

PiperOrigin-RevId: 803093147
Change-Id: I7fea87a8a66b35b2f0cc3d815c23f90e5e4d2043
This commit is contained in:
Abseil Team
2025-09-04 10:53:43 -07:00
committed by Copybara-Service
parent 9dc9586eff
commit f8c283dabf
15 changed files with 27 additions and 92 deletions

View File

@@ -360,7 +360,6 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
// Darwin (macOS and iOS) __APPLE__
// Akaros (http://akaros.org) __ros__
// Windows _WIN32
// NaCL __native_client__
// AsmJS __asmjs__
// WebAssembly (Emscripten) __EMSCRIPTEN__
// Fuchsia __Fuchsia__
@@ -375,12 +374,12 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
// POSIX.1-2001.
#ifdef ABSL_HAVE_MMAP
#error ABSL_HAVE_MMAP cannot be directly set
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
defined(_AIX) || defined(__ros__) || defined(__native_client__) || \
defined(__asmjs__) || defined(__EMSCRIPTEN__) || defined(__Fuchsia__) || \
defined(__sun) || defined(__myriad2__) || defined(__HAIKU__) || \
defined(__OpenBSD__) || defined(__NetBSD__) || defined(__QNX__) || \
defined(__VXWORKS__) || defined(__hexagon__) || defined(__XTENSA__) || \
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
defined(_AIX) || defined(__ros__) || defined(__asmjs__) || \
defined(__EMSCRIPTEN__) || defined(__Fuchsia__) || defined(__sun) || \
defined(__myriad2__) || defined(__HAIKU__) || defined(__OpenBSD__) || \
defined(__NetBSD__) || defined(__QNX__) || defined(__VXWORKS__) || \
defined(__hexagon__) || defined(__XTENSA__) || \
defined(_WASI_EMULATED_MMAN)
#define ABSL_HAVE_MMAP 1
#endif
@@ -457,8 +456,6 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
// WASI doesn't support signals
#elif defined(__Fuchsia__)
// Signals don't exist on fuchsia.
#elif defined(__native_client__)
// Signals don't exist on hexagon/QuRT
#elif defined(__hexagon__)
#else
// other standard libraries

View File

@@ -89,7 +89,7 @@
#endif
// Memory annotations are also made available to LLVM's Memory Sanitizer
#if defined(ABSL_HAVE_MEMORY_SANITIZER) && !defined(__native_client__)
#if defined(ABSL_HAVE_MEMORY_SANITIZER)
#define ABSL_INTERNAL_MEMORY_ANNOTATIONS_ENABLED 1
#endif

View File

@@ -41,9 +41,8 @@
//
// This preprocessor token is also defined in raw_io.cc. If you need to copy
// this, consider moving both to config.h instead.
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
defined(__hexagon__) || defined(__Fuchsia__) || \
defined(__native_client__) || defined(__OpenBSD__) || \
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
defined(__hexagon__) || defined(__Fuchsia__) || defined(__OpenBSD__) || \
defined(__EMSCRIPTEN__) || defined(__ASYLO__)
#include <unistd.h>

View File

@@ -456,15 +456,6 @@ pid_t GetTID() { return getthrid(); }
pid_t GetTID() { return static_cast<pid_t>(_lwp_self()); }
#elif defined(__native_client__)
pid_t GetTID() {
auto* thread = pthread_self();
static_assert(sizeof(pid_t) == sizeof(thread),
"In NaCL int expected to be the same size as a pointer");
return reinterpret_cast<pid_t>(thread);
}
#elif defined(__Fuchsia__)
pid_t GetTID() {

View File

@@ -39,12 +39,6 @@ TEST(SysinfoTest, NumCPUs) {
TEST(SysinfoTest, GetTID) {
EXPECT_EQ(GetTID(), GetTID()); // Basic compile and equality test.
#ifdef __native_client__
// Native Client has a race condition bug that leads to memory
// exhaustion when repeatedly creating and joining threads.
// https://bugs.chromium.org/p/nativeclient/issues/detail?id=1027
return;
#endif
// Test that TIDs are unique to each thread.
// Uses a few loops to exercise implementations that reallocate IDs.
for (int i = 0; i < 10; ++i) {

View File

@@ -34,7 +34,7 @@
// CycleClock that runs at atleast 1 MHz. We've found some Android
// ARM64 devices where this is not the case, so we disable it by
// default on Android ARM64.
#if defined(__native_client__) || (defined(__APPLE__)) || \
#if defined(__APPLE__) || \
(defined(__ANDROID__) && defined(__aarch64__))
#define ABSL_USE_UNSCALED_CYCLECLOCK_DEFAULT 0
#else

View File

@@ -53,9 +53,7 @@
// ABSL_BLOCK_TAIL_CALL_OPTIMIZATION();
// return result;
// }
#if defined(__pnacl__)
#define ABSL_BLOCK_TAIL_CALL_OPTIMIZATION() if (volatile int x = 0) { (void)x; }
#elif defined(__clang__)
#if defined(__clang__)
// Clang will not tail call given inline volatile assembly.
#define ABSL_BLOCK_TAIL_CALL_OPTIMIZATION() __asm__ __volatile__("")
#elif defined(__GNUC__)

View File

@@ -32,10 +32,10 @@
#error ABSL_HAVE_ELF_MEM_IMAGE cannot be directly set
#endif
#if defined(__ELF__) && !defined(__OpenBSD__) && !defined(__QNX__) && \
!defined(__native_client__) && !defined(__asmjs__) && \
!defined(__wasm__) && !defined(__HAIKU__) && !defined(__sun) && \
!defined(__VXWORKS__) && !defined(__hexagon__) && !defined(__XTENSA__)
#if defined(__ELF__) && !defined(__OpenBSD__) && !defined(__QNX__) && \
!defined(__asmjs__) && !defined(__wasm__) && !defined(__HAIKU__) && \
!defined(__sun) && !defined(__VXWORKS__) && !defined(__hexagon__) && \
!defined(__XTENSA__)
#define ABSL_HAVE_ELF_MEM_IMAGE 1
#endif

View File

@@ -28,8 +28,8 @@
#ifdef ABSL_INTERNAL_HAVE_ELF_SYMBOLIZE
#error ABSL_INTERNAL_HAVE_ELF_SYMBOLIZE cannot be directly set
#elif defined(__ELF__) && defined(__GLIBC__) && !defined(__native_client__) \
&& !defined(__asmjs__) && !defined(__wasm__)
#elif defined(__ELF__) && defined(__GLIBC__) && !defined(__asmjs__) \
&& !defined(__wasm__)
#define ABSL_INTERNAL_HAVE_ELF_SYMBOLIZE 1
#include <elf.h>

View File

@@ -16,12 +16,10 @@
#include "gtest/gtest.h"
#if defined(__native_client__) || defined(__EMSCRIPTEN__)
// NACL has a less accurate implementation of std::log2 than most of
#if defined(__EMSCRIPTEN__)
// Emscripten has a less accurate implementation of std::log2 than most of
// the other platforms. For some values which should have integral results,
// sometimes NACL returns slightly larger values.
//
// The MUSL libc used by emscripten also has a similar bug.
// sometimes Emscripten returns slightly larger values.
#define ABSL_RANDOM_INACCURATE_LOG2
#endif

View File

@@ -35,7 +35,6 @@
// Darwin (macOS and iOS) __APPLE__
// Akaros (http://akaros.org) __ros__
// Windows _WIN32
// NaCL __native_client__
// AsmJS __asmjs__
// WebAssembly __wasm__
// Fuchsia __Fuchsia__
@@ -125,12 +124,6 @@
#endif
// NaCl does not allow AES.
#if defined(__native_client__)
#undef ABSL_HAVE_ACCELERATED_AES
#define ABSL_HAVE_ACCELERATED_AES 0
#endif
// ABSL_RANDOM_INTERNAL_AES_DISPATCH indicates whether the currently active
// platform has, or should use run-time dispatch for selecting the
// accelerated Randen implementation.
@@ -162,10 +155,4 @@
#define ABSL_RANDOM_INTERNAL_AES_DISPATCH 1
#endif
// NaCl does not allow dispatch.
#if defined(__native_client__)
#undef ABSL_RANDOM_INTERNAL_AES_DISPATCH
#define ABSL_RANDOM_INTERNAL_AES_DISPATCH 0
#endif
#endif // ABSL_RANDOM_INTERNAL_PLATFORM_H_

View File

@@ -632,7 +632,6 @@ TEST(RandenTest, IsFastOrSlow) {
//
// linux, optimized ~5ns
// ppc, optimized ~7ns
// nacl (slow), ~1100ns
//
// `kCount` is chosen below so that, in debug builds and without hardware
// acceleration, the test (assuming ~1us per call) should finish in ~0.1s

View File

@@ -41,12 +41,7 @@
#include "absl/types/optional.h"
#include "absl/types/span.h"
#if defined(__native_client__)
#include <nacl/nacl_random.h>
#define ABSL_RANDOM_USE_NACL_SECURE_RANDOM 1
#elif defined(_WIN32)
#if defined(_WIN32)
#include <windows.h>
#define ABSL_RANDOM_USE_BCRYPT 1
@@ -109,27 +104,6 @@ bool ReadSeedMaterialFromOSEntropyImpl(absl::Span<uint32_t> values) {
return BCRYPT_SUCCESS(ret);
}
#elif defined(ABSL_RANDOM_USE_NACL_SECURE_RANDOM)
// On NaCL use nacl_secure_random to acquire bytes.
bool ReadSeedMaterialFromOSEntropyImpl(absl::Span<uint32_t> values) {
auto buffer = reinterpret_cast<uint8_t*>(values.data());
size_t buffer_size = sizeof(uint32_t) * values.size();
uint8_t* output_ptr = buffer;
while (buffer_size > 0) {
size_t nread = 0;
const int error = nacl_secure_random(output_ptr, buffer_size, &nread);
if (error != 0 || nread > buffer_size) {
ABSL_RAW_LOG(ERROR, "Failed to read secure_random seed data: %d", error);
return false;
}
output_ptr += nread;
buffer_size -= nread;
}
return true;
}
#elif defined(__Fuchsia__)
bool ReadSeedMaterialFromOSEntropyImpl(absl::Span<uint32_t> values) {

View File

@@ -28,11 +28,9 @@
// We disable format checker under vscode intellisense compilation.
// See https://github.com/microsoft/vscode-cpptools/issues/3683 for
// more details.
#if ABSL_HAVE_ATTRIBUTE(enable_if) && !defined(__native_client__) && \
!defined(__INTELLISENSE__)
#if ABSL_HAVE_ATTRIBUTE(enable_if) && !defined(__INTELLISENSE__)
#define ABSL_INTERNAL_ENABLE_FORMAT_CHECKER 1
#endif // ABSL_HAVE_ATTRIBUTE(enable_if) && !defined(__native_client__) &&
// !defined(__INTELLISENSE__)
#endif // ABSL_HAVE_ATTRIBUTE(enable_if) && !defined(__INTELLISENSE__)
#endif // ABSL_INTERNAL_ENABLE_FORMAT_CHECKER
namespace absl {

View File

@@ -65,8 +65,8 @@ TEST_F(FormatEntryPointTest, UntypedFormat) {
"",
"a",
"%80d",
#if !defined(_MSC_VER) && !defined(__ANDROID__) && !defined(__native_client__)
// MSVC, NaCL and Android don't support positional syntax.
#if !defined(_MSC_VER) && !defined(__ANDROID__)
// MSVC and Android don't support positional syntax.
"complicated multipart %% %1$d format %1$0999d",
#endif // _MSC_VER
};
@@ -266,8 +266,8 @@ TEST_F(FormatEntryPointTest, Stream) {
"a",
"%80d",
"%d %u %c %s %f %g",
#if !defined(_MSC_VER) && !defined(__ANDROID__) && !defined(__native_client__)
// MSVC, NaCL and Android don't support positional syntax.
#if !defined(_MSC_VER) && !defined(__ANDROID__)
// MSVC and Android don't support positional syntax.
"complicated multipart %% %1$d format %1$080d",
#endif // _MSC_VER
};