Skip to content

Remove last few bits for Native Client support #148983

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2025
Merged

Conversation

brad0
Copy link
Contributor

@brad0 brad0 commented Jul 15, 2025

No description provided.

@brad0 brad0 requested a review from a team as a code owner July 15, 2025 22:50
@llvmbot llvmbot added libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. libc llvm:binary-utilities labels Jul 15, 2025
@brad0 brad0 requested a review from dschuff July 15, 2025 22:50
@llvmbot
Copy link
Member

llvmbot commented Jul 15, 2025

@llvm/pr-subscribers-libc

@llvm/pr-subscribers-libcxx

Author: Brad Smith (brad0)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/148983.diff

6 Files Affected:

  • (modified) libc/src/__support/macros/properties/architectures.h (+1-1)
  • (modified) libcxx/include/__config (-9)
  • (modified) libcxx/include/limits (+1-1)
  • (modified) libcxx/src/random.cpp (-26)
  • (modified) libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp (+1-2)
  • (modified) llvm/tools/llvm-readobj/ELFDumper.cpp (+1-1)
diff --git a/libc/src/__support/macros/properties/architectures.h b/libc/src/__support/macros/properties/architectures.h
index c88956ff41148..ecc93196be286 100644
--- a/libc/src/__support/macros/properties/architectures.h
+++ b/libc/src/__support/macros/properties/architectures.h
@@ -21,7 +21,7 @@
 #define LIBC_TARGET_ARCH_IS_GPU
 #endif
 
-#if defined(__pnacl__) || defined(__CLR_VER) || defined(LIBC_TARGET_ARCH_IS_GPU)
+#if defined(__CLR_VER) || defined(LIBC_TARGET_ARCH_IS_GPU)
 #define LIBC_TARGET_ARCH_IS_VM
 #endif
 
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 1d547eac30952..cdd65585293d5 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -265,13 +265,6 @@ _LIBCPP_HARDENING_MODE_DEBUG
 //      When this option is used, the token passed to `std::random_device`'s
 //      constructor *must* be "/dev/urandom" -- anything else is an error.
 //
-// _LIBCPP_USING_NACL_RANDOM
-//      NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access,
-//      including accesses to the special files under `/dev`. This implementation
-//      uses the NaCL syscall `nacl_secure_random_init()` to get entropy.
-//      When this option is used, the token passed to `std::random_device`'s
-//      constructor *must* be "/dev/urandom" -- anything else is an error.
-//
 // _LIBCPP_USING_WIN32_RANDOM
 //      Use rand_s(), for use on Windows.
 //      When this option is used, the token passed to `std::random_device`'s
@@ -283,8 +276,6 @@ _LIBCPP_HARDENING_MODE_DEBUG
 #    define _LIBCPP_USING_GETENTROPY
 #  elif defined(__Fuchsia__)
 #    define _LIBCPP_USING_FUCHSIA_CPRNG
-#  elif defined(__native_client__)
-#    define _LIBCPP_USING_NACL_RANDOM
 #  elif defined(_LIBCPP_WIN32API)
 #    define _LIBCPP_USING_WIN32_RANDOM
 #  else
diff --git a/libcxx/include/limits b/libcxx/include/limits
index 1205e6a0c2781..e8581cf9c321d 100644
--- a/libcxx/include/limits
+++ b/libcxx/include/limits
@@ -219,7 +219,7 @@ protected:
   static _LIBCPP_CONSTEXPR const bool is_bounded = true;
   static _LIBCPP_CONSTEXPR const bool is_modulo  = !std::is_signed<_Tp>::value;
 
-#  if defined(__i386__) || defined(__x86_64__) || defined(__pnacl__) || defined(__wasm__)
+#  if defined(__i386__) || defined(__x86_64__) || defined(__wasm__)
   static _LIBCPP_CONSTEXPR const bool traps = true;
 #  else
   static _LIBCPP_CONSTEXPR const bool traps = false;
diff --git a/libcxx/src/random.cpp b/libcxx/src/random.cpp
index 5c6644811bfee..79815aadc7323 100644
--- a/libcxx/src/random.cpp
+++ b/libcxx/src/random.cpp
@@ -31,8 +31,6 @@
 #    include <linux/random.h>
 #    include <sys/ioctl.h>
 #  endif
-#elif defined(_LIBCPP_USING_NACL_RANDOM)
-#  include <nacl/nacl_random.h>
 #elif defined(_LIBCPP_USING_FUCHSIA_CPRNG)
 #  include <zircon/syscalls.h>
 #endif
@@ -93,30 +91,6 @@ unsigned random_device::operator()() {
   return r;
 }
 
-#elif defined(_LIBCPP_USING_NACL_RANDOM)
-
-random_device::random_device(const string& __token) {
-  if (__token != "/dev/urandom")
-    std::__throw_system_error(ENOENT, ("random device not supported " + __token).c_str());
-  int error = nacl_secure_random_init();
-  if (error)
-    std::__throw_system_error(error, ("random device failed to open " + __token).c_str());
-}
-
-random_device::~random_device() {}
-
-unsigned random_device::operator()() {
-  unsigned r;
-  size_t n = sizeof(r);
-  size_t bytes_written;
-  int error = nacl_secure_random(&r, n, &bytes_written);
-  if (error != 0)
-    std::__throw_system_error(error, "random_device failed getting bytes");
-  else if (bytes_written != n)
-    std::__throw_runtime_error("random_device failed to obtain enough bytes");
-  return r;
-}
-
 #elif defined(_LIBCPP_USING_WIN32_RANDOM)
 
 random_device::random_device(const string& __token) {
diff --git a/libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp b/libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp
index a9b1e44602bd2..66e149bf58d1b 100644
--- a/libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp
@@ -14,8 +14,7 @@
 
 #include "test_macros.h"
 
-#if defined(__i386__) || defined(__x86_64__) || defined(__pnacl__) || \
-    defined(__wasm__)
+#if defined(__i386__) || defined(__x86_64__) || defined(__wasm__)
 static const bool integral_types_trap = true;
 #else
 static const bool integral_types_trap = false;
diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp
index 101079f09e1d2..f7d44d02c8a7c 100644
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -5510,7 +5510,7 @@ template <typename ELFT> static GNUAbiTag getGNUAbiTag(ArrayRef<uint8_t> Desc) {
     return {"", "", /*IsValid=*/false};
 
   static const char *OSNames[] = {
-      "Linux", "Hurd", "Solaris", "FreeBSD", "NetBSD", "Syllable", "NaCl",
+      "Linux", "Hurd", "Solaris", "FreeBSD", "NetBSD", "Syllable",
   };
   StringRef OSName = "Unknown";
   if (Words[0] < std::size(OSNames))

@llvmbot
Copy link
Member

llvmbot commented Jul 15, 2025

@llvm/pr-subscribers-llvm-binary-utilities

Author: Brad Smith (brad0)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/148983.diff

6 Files Affected:

  • (modified) libc/src/__support/macros/properties/architectures.h (+1-1)
  • (modified) libcxx/include/__config (-9)
  • (modified) libcxx/include/limits (+1-1)
  • (modified) libcxx/src/random.cpp (-26)
  • (modified) libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp (+1-2)
  • (modified) llvm/tools/llvm-readobj/ELFDumper.cpp (+1-1)
diff --git a/libc/src/__support/macros/properties/architectures.h b/libc/src/__support/macros/properties/architectures.h
index c88956ff41148..ecc93196be286 100644
--- a/libc/src/__support/macros/properties/architectures.h
+++ b/libc/src/__support/macros/properties/architectures.h
@@ -21,7 +21,7 @@
 #define LIBC_TARGET_ARCH_IS_GPU
 #endif
 
-#if defined(__pnacl__) || defined(__CLR_VER) || defined(LIBC_TARGET_ARCH_IS_GPU)
+#if defined(__CLR_VER) || defined(LIBC_TARGET_ARCH_IS_GPU)
 #define LIBC_TARGET_ARCH_IS_VM
 #endif
 
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 1d547eac30952..cdd65585293d5 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -265,13 +265,6 @@ _LIBCPP_HARDENING_MODE_DEBUG
 //      When this option is used, the token passed to `std::random_device`'s
 //      constructor *must* be "/dev/urandom" -- anything else is an error.
 //
-// _LIBCPP_USING_NACL_RANDOM
-//      NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access,
-//      including accesses to the special files under `/dev`. This implementation
-//      uses the NaCL syscall `nacl_secure_random_init()` to get entropy.
-//      When this option is used, the token passed to `std::random_device`'s
-//      constructor *must* be "/dev/urandom" -- anything else is an error.
-//
 // _LIBCPP_USING_WIN32_RANDOM
 //      Use rand_s(), for use on Windows.
 //      When this option is used, the token passed to `std::random_device`'s
@@ -283,8 +276,6 @@ _LIBCPP_HARDENING_MODE_DEBUG
 #    define _LIBCPP_USING_GETENTROPY
 #  elif defined(__Fuchsia__)
 #    define _LIBCPP_USING_FUCHSIA_CPRNG
-#  elif defined(__native_client__)
-#    define _LIBCPP_USING_NACL_RANDOM
 #  elif defined(_LIBCPP_WIN32API)
 #    define _LIBCPP_USING_WIN32_RANDOM
 #  else
diff --git a/libcxx/include/limits b/libcxx/include/limits
index 1205e6a0c2781..e8581cf9c321d 100644
--- a/libcxx/include/limits
+++ b/libcxx/include/limits
@@ -219,7 +219,7 @@ protected:
   static _LIBCPP_CONSTEXPR const bool is_bounded = true;
   static _LIBCPP_CONSTEXPR const bool is_modulo  = !std::is_signed<_Tp>::value;
 
-#  if defined(__i386__) || defined(__x86_64__) || defined(__pnacl__) || defined(__wasm__)
+#  if defined(__i386__) || defined(__x86_64__) || defined(__wasm__)
   static _LIBCPP_CONSTEXPR const bool traps = true;
 #  else
   static _LIBCPP_CONSTEXPR const bool traps = false;
diff --git a/libcxx/src/random.cpp b/libcxx/src/random.cpp
index 5c6644811bfee..79815aadc7323 100644
--- a/libcxx/src/random.cpp
+++ b/libcxx/src/random.cpp
@@ -31,8 +31,6 @@
 #    include <linux/random.h>
 #    include <sys/ioctl.h>
 #  endif
-#elif defined(_LIBCPP_USING_NACL_RANDOM)
-#  include <nacl/nacl_random.h>
 #elif defined(_LIBCPP_USING_FUCHSIA_CPRNG)
 #  include <zircon/syscalls.h>
 #endif
@@ -93,30 +91,6 @@ unsigned random_device::operator()() {
   return r;
 }
 
-#elif defined(_LIBCPP_USING_NACL_RANDOM)
-
-random_device::random_device(const string& __token) {
-  if (__token != "/dev/urandom")
-    std::__throw_system_error(ENOENT, ("random device not supported " + __token).c_str());
-  int error = nacl_secure_random_init();
-  if (error)
-    std::__throw_system_error(error, ("random device failed to open " + __token).c_str());
-}
-
-random_device::~random_device() {}
-
-unsigned random_device::operator()() {
-  unsigned r;
-  size_t n = sizeof(r);
-  size_t bytes_written;
-  int error = nacl_secure_random(&r, n, &bytes_written);
-  if (error != 0)
-    std::__throw_system_error(error, "random_device failed getting bytes");
-  else if (bytes_written != n)
-    std::__throw_runtime_error("random_device failed to obtain enough bytes");
-  return r;
-}
-
 #elif defined(_LIBCPP_USING_WIN32_RANDOM)
 
 random_device::random_device(const string& __token) {
diff --git a/libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp b/libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp
index a9b1e44602bd2..66e149bf58d1b 100644
--- a/libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/traps.pass.cpp
@@ -14,8 +14,7 @@
 
 #include "test_macros.h"
 
-#if defined(__i386__) || defined(__x86_64__) || defined(__pnacl__) || \
-    defined(__wasm__)
+#if defined(__i386__) || defined(__x86_64__) || defined(__wasm__)
 static const bool integral_types_trap = true;
 #else
 static const bool integral_types_trap = false;
diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp
index 101079f09e1d2..f7d44d02c8a7c 100644
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -5510,7 +5510,7 @@ template <typename ELFT> static GNUAbiTag getGNUAbiTag(ArrayRef<uint8_t> Desc) {
     return {"", "", /*IsValid=*/false};
 
   static const char *OSNames[] = {
-      "Linux", "Hurd", "Solaris", "FreeBSD", "NetBSD", "Syllable", "NaCl",
+      "Linux", "Hurd", "Solaris", "FreeBSD", "NetBSD", "Syllable",
   };
   StringRef OSName = "Unknown";
   if (Words[0] < std::size(OSNames))

@brad0 brad0 requested a review from MaskRay July 16, 2025 03:40
Copy link
Member

@MaskRay MaskRay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

llvm-readobj change looks good. libc++ maintainers need to approve the libc++ part.

For reviewers, the long-obsoleted NaCl is not long supported by chrome and the primary NaCl code has been deleted from llvm.

Copy link
Contributor

@lntue lntue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for the libc part.

@brad0
Copy link
Contributor Author

brad0 commented Jul 17, 2025

cc @ldionne

Copy link
Member

@ldionne ldionne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the cleanup!

@ldionne ldionne merged commit 5f00129 into llvm:main Jul 18, 2025
89 of 91 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 18, 2025

LLVM Buildbot has detected a new failure on builder lldb-x86_64-debian running on lldb-x86_64-debian while building libc,libcxx,llvm at step 6 "test".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/162/builds/27131

Here is the relevant piece of the build log for the reference
Step 6 (test) failure: build (failure)
...
UNSUPPORTED: lldb-shell :: Expr/objc-gnustep-print.m (3086 of 3097)
UNSUPPORTED: lldb-shell :: ScriptInterpreter/Python/Crashlog/no_threadState.test (3087 of 3097)
UNSUPPORTED: lldb-shell :: ScriptInterpreter/Python/Crashlog/skipped_status_interactive_crashlog.test (3088 of 3097)
UNSUPPORTED: lldb-shell :: Register/x86-gp-write.test (3089 of 3097)
UNSUPPORTED: lldb-shell :: Process/Windows/exception_access_violation.cpp (3090 of 3097)
UNSUPPORTED: lldb-shell :: Target/dependent-modules-nodupe-windows.test (3091 of 3097)
UNSUPPORTED: lldb-shell :: ScriptInterpreter/Lua/io.test (3092 of 3097)
UNSUPPORTED: lldb-shell :: ScriptInterpreter/Lua/command_script_import.test (3093 of 3097)
PASS: lldb-api :: terminal/TestEditlineCompletions.py (3094 of 3097)
UNRESOLVED: lldb-api :: tools/lldb-dap/launch/TestDAP_launch.py (3095 of 3097)
******************** TEST 'lldb-api :: tools/lldb-dap/launch/TestDAP_launch.py' FAILED ********************
Script:
--
/usr/bin/python3 /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/./lib --env LLVM_INCLUDE_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/include --env LLVM_TOOLS_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/./bin --arch x86_64 --build-dir /home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex --lldb-module-cache-dir /home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/worker/2.0.1/lldb-x86_64-debian/build/./bin/lldb --compiler /home/worker/2.0.1/lldb-x86_64-debian/build/./bin/clang --dsymutil /home/worker/2.0.1/lldb-x86_64-debian/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/worker/2.0.1/lldb-x86_64-debian/build/./bin --lldb-obj-root /home/worker/2.0.1/lldb-x86_64-debian/build/tools/lldb --lldb-libs-dir /home/worker/2.0.1/lldb-x86_64-debian/build/./lib --cmake-build-type Release -t /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/test/API/tools/lldb-dap/launch -p TestDAP_launch.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 22.0.0git (https://github.com/llvm/llvm-project.git revision 5f001294b1d42a0b4146e0b08ccae72667de6a5d)
  clang revision 5f001294b1d42a0b4146e0b08ccae72667de6a5d
  llvm revision 5f001294b1d42a0b4146e0b08ccae72667de6a5d
Skipping the following test categories: ['libc++', 'msvcstl', 'dsym', 'gmodules', 'debugserver', 'objc']

--
Command Output (stderr):
--
Change dir to: /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/test/API/tools/lldb-dap/launch
runCmd: settings clear --all

output: 

runCmd: settings set symbols.enable-external-lookup false

output: 

runCmd: settings set target.inherit-tcc true

output: 

runCmd: settings set target.disable-aslr false

output: 

runCmd: settings set target.detach-on-error false

output: 

runCmd: settings set target.auto-apply-fixits false

@brad0
Copy link
Contributor Author

brad0 commented Jul 19, 2025

@ldionne I didn't remove the bits from the __cxx03 headers. I saw elsewhere that they're frozen and should not be touched. How will they eventually be cleaned up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. libc llvm:binary-utilities
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants