Skip to content

Conversation

frobtech
Copy link
Contributor

@frobtech frobtech commented Sep 5, 2025

The getPageSize() function is defined in the platform-specific
source files but used in common.cpp. Every function used across
files should be declared in a header so the same declaration is
in scope for the callers and the definition.

The getPageSize() function is defined in the platform-specific
source files but used in common.cpp.  Every function used across
files should be declared in a header so the same declaration is
in scope for the callers and the definition.
@frobtech frobtech marked this pull request as ready for review September 5, 2025 17:26
@llvmbot
Copy link
Member

llvmbot commented Sep 5, 2025

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

Author: Roland McGrath (frobtech)

Changes

The getPageSize() function is defined in the platform-specific
source files but used in common.cpp. Every function used across
files should be declared in a header so the same declaration is
in scope for the callers and the definition.


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

2 Files Affected:

  • (modified) compiler-rt/lib/scudo/standalone/common.cpp (-3)
  • (modified) compiler-rt/lib/scudo/standalone/common.h (+4)
diff --git a/compiler-rt/lib/scudo/standalone/common.cpp b/compiler-rt/lib/scudo/standalone/common.cpp
index 80134c39e757d..f7c1b420f4c77 100644
--- a/compiler-rt/lib/scudo/standalone/common.cpp
+++ b/compiler-rt/lib/scudo/standalone/common.cpp
@@ -16,9 +16,6 @@ namespace scudo {
 uptr PageSizeCached = 0;
 uptr PageSizeLogCached = 0;
 
-// Must be defined in platform specific code.
-uptr getPageSize();
-
 // This must be called in the init path or there could be a race if multiple
 // threads try to set the cached values.
 uptr getPageSizeSlow() {
diff --git a/compiler-rt/lib/scudo/standalone/common.h b/compiler-rt/lib/scudo/standalone/common.h
index e5dfda2e9072a..8adcebd55698d 100644
--- a/compiler-rt/lib/scudo/standalone/common.h
+++ b/compiler-rt/lib/scudo/standalone/common.h
@@ -148,6 +148,10 @@ inline constexpr uptr getPageSizeLogCached() {
 extern uptr PageSizeCached;
 extern uptr PageSizeLogCached;
 
+// Must be defined in platform specific code.
+uptr getPageSize();
+
+// Always calls getPageSize(), but caches the results for get*Cached(), below.
 uptr getPageSizeSlow();
 
 inline uptr getPageSizeCached() {

@frobtech frobtech merged commit 5cf4959 into llvm:main Sep 5, 2025
15 checks passed
@frobtech frobtech deleted the p/scudo-decl branch September 5, 2025 18:48
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.

4 participants