This is a test patch that defaults the compile flags to optimize for size

The build types:
Release - set to Os
Debug   - untouched (-g -O0)

To apply this patch
$ cd node-src
$ patch -Np1 < this.patch

Change-log:
2022-02-08 (polikuo) first version
2023-08-23 (polikuo) review toolchain.gypi; discard modification to several non-linux sections (msvs_settings, xcode_settings)

diff -ruN node-18.17.1/common.gypi node-patched/common.gypi
--- node-18.17.1/common.gypi	2023-08-09 06:24:08.000000000 +0800
+++ node-patched/common.gypi	2023-08-26 01:58:41.651344705 +0800
@@ -180,7 +180,7 @@
             }],
           ],
         },
-        'cflags': [ '-O3' ],
+        'cflags': [ '-Os' ], # Release section, optimize for size (Tiny Core)
         'conditions': [
           ['enable_lto=="true"', {
             'cflags': ['<(lto)'],
diff -ruN node-18.17.1/deps/llhttp/common.gypi node-patched/deps/llhttp/common.gypi
--- node-18.17.1/deps/llhttp/common.gypi	2023-08-26 01:57:11.791344740 +0800
+++ node-patched/deps/llhttp/common.gypi	2023-08-26 01:58:41.651344705 +0800
@@ -1,6 +1,6 @@
 {
   'target_defaults': {
-    'default_configuration': 'Debug',
+    'default_configuration': 'Release', # use Release, (Tiny Core)
     'configurations': {
       # TODO: hoist these out and put them somewhere common, because
       #       RuntimeLibrary MUST MATCH across the entire project
@@ -15,7 +15,7 @@
       },
       'Release': {
         'defines': [ 'NDEBUG' ],
-        'cflags': [ '-Wall', '-Wextra', '-O3' ],
+        'cflags': [ '-Wall', '-Wextra', '-Os' ], # Release section, optimize for size (Tiny Core)
         'msvs_settings': {
           'VCCLCompilerTool': {
             'RuntimeLibrary': 0, # static release
diff -ruN node-18.17.1/deps/uv/common.gypi node-patched/deps/uv/common.gypi
--- node-18.17.1/deps/uv/common.gypi	2023-08-26 01:57:32.811344732 +0800
+++ node-patched/deps/uv/common.gypi	2023-08-26 01:58:41.651344705 +0800
@@ -7,7 +7,7 @@
   },
 
   'target_defaults': {
-    'default_configuration': 'Debug',
+    'default_configuration': 'Release', # use Release, (Tiny Core)
     'configurations': {
       'Debug': {
         'defines': [ 'DEBUG', '_DEBUG' ],
@@ -46,7 +46,7 @@
       'Release': {
         'defines': [ 'NDEBUG' ],
         'cflags': [
-          '-O3',
+          '-Os', # Release section, optimize for size (Tiny Core)
         ],
         'msvs_settings': {
           'VCCLCompilerTool': {
diff -ruN node-18.17.1/tools/v8_gypfiles/toolchain.gypi node-patched/tools/v8_gypfiles/toolchain.gypi
--- node-18.17.1/tools/v8_gypfiles/toolchain.gypi	2023-08-26 01:57:51.291344724 +0800
+++ node-patched/tools/v8_gypfiles/toolchain.gypi	2023-08-26 01:58:41.651344705 +0800
@@ -1294,21 +1294,21 @@
           ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" \
             or OS=="aix" or OS=="os400"', {
             'cflags!': [
-              '-Os',
+              '-O3', # Don't use -O3 (Tiny Core)
             ],
             'cflags': [
               '-fdata-sections',
               '-ffunction-sections',
             ],
             'conditions': [
-              # Don't use -O3 with sanitizers.
+              # -Os might cause error with sanitizers, sanitizers disabled by default.
               ['asan==0 and msan==0 and lsan==0 \
                 and tsan==0 and ubsan==0 and ubsan_vptr==0', {
-                'cflags': ['-O3'],
+                'cflags': ['-Os'],
                 'cflags!': ['-O2'],
               }, {
                 'cflags': ['-O2'],
-                'cflags!': ['-O3'],
+                'cflags!': ['-Os'],
               }],
             ],
           }],
