From 5a2995f831fcf4bcbffe992f1701678a808ec24f Mon Sep 17 00:00:00 2001
From: Andrei Litvin <andy314@gmail.com>
Date: Fri, 21 Jul 2023 12:06:43 -0400
Subject: [PATCH] Update pigweed, make android not use mapfiles (#28161)

* Disable mapfile creation for android toolchains (too large and slow, not used)

* Bump pigweed up to support the new flag

* Make tracing compile

---------

Co-authored-by: Andrei Litvin <andreilitvin@google.com>
---
 build/toolchain/android/android_toolchain.gni    | 2 +-
 build/toolchain/gcc_toolchain.gni                | 4 ++++
 examples/platform/bouffalolab/common/rpc/Rpc.cpp | 2 +-
 examples/platform/esp32/Rpc.cpp                  | 2 +-
 examples/platform/linux/Rpc.cpp                  | 2 +-
 examples/platform/nrfconnect/Rpc.cpp             | 2 +-
 examples/platform/silabs/Rpc.cpp                 | 2 +-
 examples/platform/telink/Rpc.cpp                 | 2 +-
 third_party/pigweed/repo                         | 2 +-
 9 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/build/toolchain/android/android_toolchain.gni b/build/toolchain/android/android_toolchain.gni
index b2c3290a39a50b..e4eed1b30b577e 100644
--- a/build/toolchain/android/android_toolchain.gni
+++ b/build/toolchain/android/android_toolchain.gni
@@ -37,7 +37,6 @@ template("android_clang_toolchain") {
   _android_toolchain_args = {
     current_os = "android"
     is_clang = true
-
     forward_variables_from(_invoker_toolchain_args, "*")
   }
 
@@ -70,5 +69,6 @@ template("android_clang_toolchain") {
     ar = _ndk_prefix + "llvm-ar"
     cc = _ndk_prefix + _tool_name_root + "clang"
     cxx = _ndk_prefix + _tool_name_root + "clang++"
+    link_generate_map_file = false
   }
 }
diff --git a/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni
index 98a10d1dd03903..fba42eb8349f1f 100644
--- a/build/toolchain/gcc_toolchain.gni
+++ b/build/toolchain/gcc_toolchain.gni
@@ -40,6 +40,10 @@ template("gcc_toolchain") {
       cxx = invoker.cxx
     }
 
+    if (defined(invoker.link_generate_map_file)) {
+      link_generate_map_file = invoker.link_generate_map_file
+    }
+
     is_host_toolchain = invoker_toolchain_args.current_os == host_os
     link_group = invoker_toolchain_args.current_os != "mac" &&
                  invoker_toolchain_args.current_os != "ios"
diff --git a/examples/platform/bouffalolab/common/rpc/Rpc.cpp b/examples/platform/bouffalolab/common/rpc/Rpc.cpp
index 763767ce6ef7d2..cead7e2e72913e 100644
--- a/examples/platform/bouffalolab/common/rpc/Rpc.cpp
+++ b/examples/platform/bouffalolab/common/rpc/Rpc.cpp
@@ -168,7 +168,7 @@ Thread thread;
 #endif // defined(PW_RPC_THREAD_SERVICE) && PW_RPC_THREAD_SERVICE
 
 #if defined(PW_RPC_TRACING_SERVICE) && PW_RPC_TRACING_SERVICE
-pw::trace::TraceService trace_service;
+pw::trace::TraceService trace_service(pw::trace::GetTokenizedTracer());
 #endif // defined(PW_RPC_TRACING_SERVICE) && PW_RPC_TRACING_SERVICE
 
 void RegisterServices(pw::rpc::Server & server)
diff --git a/examples/platform/esp32/Rpc.cpp b/examples/platform/esp32/Rpc.cpp
index 1ad91dddef4253..f34172a05e0a98 100644
--- a/examples/platform/esp32/Rpc.cpp
+++ b/examples/platform/esp32/Rpc.cpp
@@ -285,7 +285,7 @@ Locking locking;
 #endif // defined(PW_RPC_LOCKING_SERVICE) && PW_RPC_LOCKING_SERVICE
 
 #if defined(PW_RPC_TRACING_SERVICE) && PW_RPC_TRACING_SERVICE
-pw::trace::TraceService trace_service;
+pw::trace::TraceService trace_service(pw::trace::GetTokenizedTracer());
 #endif // defined(PW_RPC_TRACING_SERVICE) && PW_RPC_TRACING_SERVICE
 
 #if defined(PW_RPC_WIFI_SERVICE) && PW_RPC_WIFI_SERVICE
diff --git a/examples/platform/linux/Rpc.cpp b/examples/platform/linux/Rpc.cpp
index 5a731fbc1e511a..3f81f0514fc17f 100644
--- a/examples/platform/linux/Rpc.cpp
+++ b/examples/platform/linux/Rpc.cpp
@@ -80,7 +80,7 @@ Lighting lighting_service;
 #endif // defined(PW_RPC_LIGHTING_SERVICE) && PW_RPC_LIGHTING_SERVICE
 
 #if defined(PW_RPC_TRACING_SERVICE) && PW_RPC_TRACING_SERVICE
-pw::trace::TraceService trace_service;
+pw::trace::TraceService trace_service(pw::trace::GetTokenizedTracer());
 #endif // defined(PW_RPC_TRACING_SERVICE) && PW_RPC_TRACING_SERVICE
 
 void RegisterServices(pw::rpc::Server & server)
diff --git a/examples/platform/nrfconnect/Rpc.cpp b/examples/platform/nrfconnect/Rpc.cpp
index 5b76dc3f7e7d76..c89dd6c7e25de2 100644
--- a/examples/platform/nrfconnect/Rpc.cpp
+++ b/examples/platform/nrfconnect/Rpc.cpp
@@ -157,7 +157,7 @@ Thread thread;
 #endif // defined(PW_RPC_THREAD_SERVICE) && PW_RPC_THREAD_SERVICE
 
 #if defined(PW_RPC_TRACING_SERVICE) && PW_RPC_TRACING_SERVICE
-pw::trace::TraceService trace_service;
+pw::trace::TraceService trace_service(pw::trace::GetTokenizedTracer());
 #endif // defined(PW_RPC_TRACING_SERVICE) && PW_RPC_TRACING_SERVICE
 
 void RegisterServices(pw::rpc::Server & server)
diff --git a/examples/platform/silabs/Rpc.cpp b/examples/platform/silabs/Rpc.cpp
index 5c3462bece6f0e..55cc232c382617 100644
--- a/examples/platform/silabs/Rpc.cpp
+++ b/examples/platform/silabs/Rpc.cpp
@@ -149,7 +149,7 @@ Thread thread;
 #endif // defined(PW_RPC_THREAD_SERVICE) && PW_RPC_THREAD_SERVICE
 
 #if defined(PW_RPC_TRACING_SERVICE) && PW_RPC_TRACING_SERVICE
-pw::trace::TraceService trace_service;
+pw::trace::TraceService trace_service(pw::trace::GetTokenizedTracer());
 #endif // defined(PW_RPC_TRACING_SERVICE) && PW_RPC_TRACING_SERVICE
 
 void RegisterServices(pw::rpc::Server & server)
diff --git a/examples/platform/telink/Rpc.cpp b/examples/platform/telink/Rpc.cpp
index 93348fc5dbcbcb..e8c9500ab68291 100644
--- a/examples/platform/telink/Rpc.cpp
+++ b/examples/platform/telink/Rpc.cpp
@@ -157,7 +157,7 @@ Thread thread;
 #endif // defined(PW_RPC_THREAD_SERVICE) && PW_RPC_THREAD_SERVICE
 
 #if defined(PW_RPC_TRACING_SERVICE) && PW_RPC_TRACING_SERVICE
-pw::trace::TraceService trace_service;
+pw::trace::TraceService trace_service(pw::trace::GetTokenizedTracer());
 #endif // defined(PW_RPC_TRACING_SERVICE) && PW_RPC_TRACING_SERVICE
 
 void RegisterServices(pw::rpc::Server & server)
diff --git a/third_party/pigweed/repo b/third_party/pigweed/repo
index b5cec17a34cb41..2157b49553b7aa 160000
--- a/third_party/pigweed/repo
+++ b/third_party/pigweed/repo
@@ -1 +1 @@
-Subproject commit b5cec17a34cb4115537141d06c7726392857f678
+Subproject commit 2157b49553b7aac671b352b8972df44b511364af