Skip to content

[libc++] Define __libcpp_recursive_mutex_t on MIPS architecture #144272

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

Closed
wants to merge 2 commits into from

Conversation

hpoussin
Copy link
Contributor

MIPS is a 32-bit architecture, so use the same definition as other 32-bit architectures.

MIPS is a 32-bit architecture, so use the same definition as other
32-bit architectures.
@hpoussin hpoussin requested a review from a team as a code owner June 15, 2025 18:49
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Jun 15, 2025
@llvmbot
Copy link
Member

llvmbot commented Jun 15, 2025

@llvm/pr-subscribers-libcxx

Author: Hervé Poussineau (hpoussin)

Changes

MIPS is a 32-bit architecture, so use the same definition as other 32-bit architectures.


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

2 Files Affected:

  • (modified) libcxx/include/__cxx03/__thread/support/windows.h (+2-1)
  • (modified) libcxx/include/__thread/support/windows.h (+2-1)
diff --git a/libcxx/include/__cxx03/__thread/support/windows.h b/libcxx/include/__cxx03/__thread/support/windows.h
index 45252a57efaec..ee4a74dd1267d 100644
--- a/libcxx/include/__cxx03/__thread/support/windows.h
+++ b/libcxx/include/__cxx03/__thread/support/windows.h
@@ -28,7 +28,8 @@ using __libcpp_timespec_t = ::timespec;
 typedef void* __libcpp_mutex_t;
 #define _LIBCPP_MUTEX_INITIALIZER 0
 
-#if defined(_M_IX86) || defined(__i386__) || defined(_M_ARM) || defined(__arm__)
+#if defined(_M_IX86) || defined(__i386__) || defined(_M_ARM) || defined(__arm__) || defined(_M_MRX000) ||              \
+    defined(__mips__)
 typedef void* __libcpp_recursive_mutex_t[6];
 #elif defined(_M_AMD64) || defined(__x86_64__) || defined(_M_ARM64) || defined(__aarch64__)
 typedef void* __libcpp_recursive_mutex_t[5];
diff --git a/libcxx/include/__thread/support/windows.h b/libcxx/include/__thread/support/windows.h
index 5dc4fa14f45b6..bc06082880427 100644
--- a/libcxx/include/__thread/support/windows.h
+++ b/libcxx/include/__thread/support/windows.h
@@ -28,7 +28,8 @@ using __libcpp_timespec_t = ::timespec;
 typedef void* __libcpp_mutex_t;
 #define _LIBCPP_MUTEX_INITIALIZER 0
 
-#if defined(_M_IX86) || defined(__i386__) || defined(_M_ARM) || defined(__arm__)
+#if defined(_M_IX86) || defined(__i386__) || defined(_M_ARM) || defined(__arm__) || defined(_M_MRX000) ||              \
+    defined(__mips__)
 typedef void* __libcpp_recursive_mutex_t[6];
 #elif defined(_M_AMD64) || defined(__x86_64__) || defined(_M_ARM64) || defined(__aarch64__)
 typedef void* __libcpp_recursive_mutex_t[5];

@hpoussin
Copy link
Contributor Author

Ping

@philnik777
Copy link
Contributor

Which windows has support for MIPS?

@hpoussin
Copy link
Contributor Author

Windows supported MIPS architecture up to NT4.
QEMU emulator is able to run it.

@hpoussin
Copy link
Contributor Author

hpoussin commented Jul 7, 2025

Ping. Maybe @mstorsjo ?

@mstorsjo
Copy link
Member

mstorsjo commented Jul 7, 2025

Thanks; this change looks reasonable in itself to me.

While I'm unsure if libcxx is willing to spend much effort on supporting Windows on MIPS (libcxx itself requires Windows 7 or newer overall), this condition looks quite complicated. Couldn't this be changed to simply a check for _WIN64 (or maybe checking __SIZEOF_POINTER__) instead of having to enumerate all architectures specifically? We still have static asserts in libcxx/src/support/win32/thread_win32.cpp anyway that validates that the size was the right in the end.

That way, this change could just be a change that simplifies the current architecture handling, which implicitly does the right thing for fringe Windows architectures.

@hpoussin
Copy link
Contributor Author

hpoussin commented Jul 7, 2025

Superseded by #147385

@hpoussin hpoussin closed this Jul 7, 2025
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants