[PATCH] D58184: [scudo][standalone] Introduce platform specific code & mutexes

Roland McGrath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 16 01:17:00 PST 2019

mcgrathr added inline comments.

Comment at: lib/scudo/standalone/common.h:122
+    return PageSizeCached;
+  return getPageSizeSlow();
cryptoad wrote:
> morehouse wrote:
> > If we will always get the page size through this function call (and not the global variable), this could be simplified to:
> > 
> > ```
> > static PageSizeCached = getPageSizeSlow();
> > return PageSizeCached;
> > ```
> AFAIR those constructs end up in an initialization function being created and run with the global ctors which I am generally trying to avoid.
> I will give it a try.
A static local ctor is different from a global ctor (and harder to notice from examining the object files).
Each is problematic in its own different way.
I think both should be completely ruled out for the scudo internals.
That's a hard requirement for Fuchsia anyway, and it seems like a good thing to do universally.
Of course any kind of constexpr initialization (i.e. "linker-initialized") is OK.

  rCRT Compiler Runtime



More information about the llvm-commits mailing list