diff --git a/lib/modules/Tools.pmod/Standalone.pmod/precompile.pike b/lib/modules/Tools.pmod/Standalone.pmod/precompile.pike
index c41cdd15e9a97e441a544920fd54bb14897e58ca..61578e3579b0cc0e47c2ce4088e433bd8ba3c0de 100644
--- a/lib/modules/Tools.pmod/Standalone.pmod/precompile.pike
+++ b/lib/modules/Tools.pmod/Standalone.pmod/precompile.pike
@@ -141,6 +141,7 @@ string usage = #"[options] <from> > <to>
 
  Currently, the following attributes are understood:
    efun;          makes this function a global constant (no value)
+   nonstatic;     makes PIKECLASSes and PIKEFUNs that are not static
    flags;         ID_STATIC | ID_NOMASK etc.
    optflags;      OPT_TRY_OPTIMIZE | OPT_SIDE_EFFECT etc.
    optfunc;       Optimization function.
@@ -1307,6 +1308,7 @@ array recursive(mixed func, array data, mixed ... args)
 // where.
 constant valid_attributes = (<
   "efun",
+  "nonstatic",
   "flags",
   "optflags",
   "optfunc",
@@ -1874,8 +1876,9 @@ sprintf("        } else {\n"
 	    string define = make_unique_name("class", base, name, "defined");
 
 	    ret+=DEFINE(define);
-	    ret+=({sprintf("DEFAULT_CMOD_STORAGE struct program *%s=NULL;\n"
+	    ret+=({sprintf("%sstruct program *%s=NULL;\n"
 			   "static int %s_fun_num=-1;\n",
+                           attributes->nonstatic ? "" : "DEFAULT_CMOD_STORAGE ",
 			   program_var, program_var)});
 	    ret+=subclass->declarations;
 	    ret+=subclass->code;
@@ -2304,7 +2307,9 @@ static struct %s *%s_gdb_dummy_ptr;
 	  funcname = "NULL";
 	} else {
 	  ret+=({
-	    sprintf("DEFAULT_CMOD_STORAGE void %s(INT32 args) ",funcname),
+	    sprintf("%svoid %s(INT32 args) ",
+                    attributes->nonstatic ? "" : "DEFAULT_CMOD_STORAGE ",
+                    funcname),
 	    "{","\n",
 	  });
 
@@ -2660,7 +2665,9 @@ static struct %s *%s_gdb_dummy_ptr;
 	    ret+=IFDEF(tmp->define, ({
 	      sprintf("#define %s\n",define),
 	      sprintf("DEFAULT_CMOD_STORAGE ptrdiff_t %s = 0;\n", func_num),
-	      sprintf("DEFAULT_CMOD_STORAGE void %s(INT32 args) ",funcname),
+	      sprintf("%svoid %s(INT32 args) ",
+                      attributes->nonstatic ? "" : "DEFAULT_CMOD_STORAGE ",
+                      funcname),
 	      "{\n",
 	    })+out+({
 	      "}\n",
diff --git a/src/backend.cmod b/src/backend.cmod
index 6753309ca178059de6113ef86f5564090f28b507..b0c1b870ee5d1294664ec166aefa353923411fcb 100644
--- a/src/backend.cmod
+++ b/src/backend.cmod
@@ -177,8 +177,6 @@ struct hash_ent
 
 
 
-#define DEFAULT_CMOD_STORAGE
-
 DECLARATIONS
 
 
@@ -275,6 +273,7 @@ struct Backend_struct *really_get_backend_for_fd(int fd)
  *!   main backend APIs.
  */
 PIKECLASS Backend
+nonstatic;
 {
   /* Provide a unique count to be able to tell backends apart with _sprintf. */
   static int unused_id = 0;
@@ -3188,6 +3187,7 @@ static void sb_copy_selectors(struct sb_active_selectors *to,
  *!   @[Backend]
  */
 PIKECLASS PollDeviceBackend
+nonstatic;
 {
   INHERIT Backend;
 
@@ -4437,6 +4437,7 @@ static void check_set_timer(struct timeval tmp)
  *!   @[Backend]
  */
 PIKECLASS PollBackend
+nonstatic;
 {
   INHERIT Backend;
 
@@ -5040,6 +5041,7 @@ PIKECLASS PollBackend
  *! Backend based on the classic @tt{select(2)@} system call from BSD.
  */
 PIKECLASS SelectBackend
+nonstatic;
 {
   INHERIT Backend;
 
diff --git a/src/iterators.cmod b/src/iterators.cmod
index ef290dcb8f3d22ffecef75a6d43342d3ea77bdbf..9fd65a2cc3dd6c1279d4737a3c920148a0543741 100644
--- a/src/iterators.cmod
+++ b/src/iterators.cmod
@@ -29,8 +29,6 @@
 
 #define sp Pike_sp
 
-#define DEFAULT_CMOD_STORAGE
-
 DECLARATIONS
 
 /*! @class Iterator
@@ -1184,6 +1182,7 @@ PIKECLASS file_line_iterator
  *!   @endcode
  */
 PIKECLASS string_split_iterator
+nonstatic;
 {
   CVAR struct pike_string *buffer;
   CVAR struct pike_string *current;
@@ -1872,6 +1871,7 @@ PIKECLASS string_split_iterator
  */
 PIKEFUN object(Iterator) get_iterator(object|array|mapping|multiset|string data)
   efun;
+  nonstatic;
 {
   switch(TYPEOF(*data))
   {
diff --git a/src/modules/Gmp/mpf.cmod b/src/modules/Gmp/mpf.cmod
index 005e14eeaec235bed0e4b8d1ccef9630f11aca25..cca840992e6c1375da94b36d58fae16eb872c4b8 100644
--- a/src/modules/Gmp/mpf.cmod
+++ b/src/modules/Gmp/mpf.cmod
@@ -43,8 +43,6 @@
 #define sp Pike_sp
 #define fp Pike_fp
 
-#define DEFAULT_CMOD_STORAGE
-
 DECLARATIONS
 
 #define THISMPF (&(THIS->n))
@@ -108,6 +106,7 @@ DECLARATIONS
 
 /*  id PROG_GMP_MPF_ID; */
 PIKECLASS mpf
+nonstatic;
 {
   CVAR MP_FLT n;
 
diff --git a/src/modules/Gmp/mpq.cmod b/src/modules/Gmp/mpq.cmod
index 2bfc14309d4fa14c9befb9299063da7c17bf27b7..c906e8fbbfa251abfc2f07541a32dac2b1b4f058 100644
--- a/src/modules/Gmp/mpq.cmod
+++ b/src/modules/Gmp/mpq.cmod
@@ -44,8 +44,6 @@
 #define sp Pike_sp
 #define fp Pike_fp
 
-#define DEFAULT_CMOD_STORAGE
-
 DECLARATIONS
 
 #define THISMPQ (&(THIS->n))
@@ -62,6 +60,7 @@ DECLARATIONS
 
 /*  id PROG_GMP_MPQ_ID; */
 PIKECLASS mpq
+nonstatic;
 {
   CVAR MP_RAT n;