[Buildroot] [PATCH 2/2] package/pkg-cargo.mk: generate debug symbols when BR2_ENABLE_DEBUG is set

moritz at h6t.eu moritz at h6t.eu
Wed Oct 19 22:00:19 UTC 2022


From: Moritz Bitsch <moritz at h6t.eu>

Adding -g to RUSTFLAGS enables debug symbol generation in rustc

Signed-off-by: Moritz Bitsch <moritz at h6t.eu>
---
 package/pkg-cargo.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/package/pkg-cargo.mk b/package/pkg-cargo.mk
index e0556252fa..7ce7867f67 100644
--- a/package/pkg-cargo.mk
+++ b/package/pkg-cargo.mk
@@ -51,9 +51,15 @@ PKG_CARGO_ENV = \
 # and should be removed when fixed upstream
 #
 ifeq ($(NORMALIZED_ARCH),arm)
-	PKG_CARGO_ENV += RUSTFLAGS="-Clink-arg=-Wl,--allow-multiple-definition"
+	PKG_CARGO_RUSTFLAGS += -Clink-arg=-Wl,--allow-multiple-definition
 endif
 
+ifeq ($(BR2_ENABLE_DEBUG),y)
+	PKG_CARGO_RUSTFLAGS += -g
+endif
+
+PKG_CARGO_ENV += RUSTFLAGS=$(subst $(space),$(comma),$(strip $(PKG_CARGO_RUSTFLAGS)))
+
 HOST_PKG_CARGO_ENV = \
 	$(PKG_COMMON_CARGO_ENV)
 
-- 
2.37.3




More information about the buildroot mailing list