Skip to content

[compiler-rt][Mips] Fix stat size check on mips64 musl #143301

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Gelbpunkt
Copy link
Contributor

The sizes of the struct stat on MIPS64 differ in musl vs glibc.

See https://godbolt.org/z/qf9bcq8Y8 for the proof. Prior to this change, compilation for MIPS64 musl would fail.

The sizes of the struct stat on MIPS64 differ in musl vs glibc.

See https://godbolt.org/z/qf9bcq8Y8 for the proof. Prior to this change,
compilation for MIPS64 musl would fail.

Signed-off-by: Jens Reidel <[email protected]>
@llvmbot
Copy link
Member

llvmbot commented Jun 8, 2025

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Jens Reidel (Gelbpunkt)

Changes

The sizes of the struct stat on MIPS64 differ in musl vs glibc.

See https://godbolt.org/z/qf9bcq8Y8 for the proof. Prior to this change, compilation for MIPS64 musl would fail.


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

1 Files Affected:

  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h (+3-1)
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
index fdc52aa56c493..134081ac97931 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -102,8 +102,10 @@ const unsigned struct_kernel_stat_sz = SANITIZER_ANDROID
                                            ? FIRST_32_SECOND_64(104, 128)
 #      if defined(_ABIN32) && _MIPS_SIM == _ABIN32
                                            : FIRST_32_SECOND_64(176, 216);
-#      else
+#      elif !SANITIZER_MUSL
                                            : FIRST_32_SECOND_64(160, 216);
+#      else
+                                           : FIRST_32_SECOND_64(160, 208);
 #      endif
 const unsigned struct_kernel_stat64_sz = 104;
 #elif defined(__s390__) && !defined(__s390x__)

@Gelbpunkt Gelbpunkt force-pushed the struct-stat-size-fix-mips64-musl branch from 9fdb7f6 to 4b9c1d6 Compare June 8, 2025 06:00
@Gelbpunkt Gelbpunkt changed the title compiler-rt: Fix stat size check on mips64 musl [compiler-rt][Mips] Fix stat size check on mips64 musl Jun 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants