pw_system: Include pw_malloc for non-host builds

Change-Id: Ib6ab368a0c2b1a814c1d11b22a1ecc54b7e3bda4
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/78400
Reviewed-by: Armando Montanez <amontanez@google.com>
Commit-Queue: Carlos Chinchilla <cachinchilla@google.com>
Pigweed-Auto-Submit: Carlos Chinchilla <cachinchilla@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
diff --git a/pw_system/system_target.gni b/pw_system/system_target.gni
index fdd6a51..55e7a3b 100644
--- a/pw_system/system_target.gni
+++ b/pw_system/system_target.gni
@@ -178,19 +178,19 @@
          "Unknown scheduler choice for $target_name: `${invoker.scheduler}`")
 
   # Configure malloc defaults.
-  _use_malloc = true
+  _use_pw_malloc = false
   if (defined(invoker.use_pw_malloc)) {
-    _use_malloc = invoker.use_pw_malloc
-  } else if (_current_os == "mac" || _current_os == "win") {
-    _use_malloc = false
+    _use_pw_malloc = invoker.use_pw_malloc
+  } else if (invoker.cpu != PW_SYSTEM_CPU.NATIVE) {
+    _use_pw_malloc = true
   }
 
-  if (_use_malloc) {
+  if (_use_pw_malloc) {
     _default_configs += [ "$dir_pw_malloc:pw_malloc_wrapper_config" ]
+    _link_deps += [ dir_pw_malloc ]
     _malloc_build_args = {
       pw_malloc_BACKEND = dir_pw_malloc_freelist
     }
-    _link_deps += [ dir_pw_malloc ]
   } else {
     _malloc_build_args = {
     }