diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c
index 1aac3e7548f88e25912b5ee84311908b9d7a91ba..ff95f6eacb810d477428681b420882bc80827b1b 100644
--- a/Cython/Utility/ModuleSetupCode.c
+++ b/Cython/Utility/ModuleSetupCode.c
@@ -665,11 +665,13 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
 
 #endif
 
+#ifndef CYTHON_SMALL_CODE
 #if defined(__GNUC__)
     #define CYTHON_SMALL_CODE __attribute__((optimize("Os")))
 #else
     #define CYTHON_SMALL_CODE
 #endif
+#endif
 
 
 /////////////// FastTypeChecks.proto ///////////////