From 23a929aefa07f742477534c8adbbf7147bdebd06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Bia=C5=82ow=C4=85s?= Date: Tue, 29 Aug 2023 15:52:56 +0200 Subject: [PATCH 1/2] makes: add option to install unstripped binaries into rootfs Needed for host-generic-pc to provide meaningful backtraces on sanitizer errors. Fixes: phoenix-rtos/phoenix-rtos-project#797 --- makes/binary.mk | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/makes/binary.mk b/makes/binary.mk index 7310f4c3..5d68f7e0 100644 --- a/makes/binary.mk +++ b/makes/binary.mk @@ -14,6 +14,9 @@ # - LOCAL_LDFLAGS - additional LDFLAGS for current component linking # - LOCAL_INSTALL_PATH - custom rootfs dir for the binary to be installed (if not provided - DEFAULT_INSTALL_PATH) +# Global variables (not reset by this script): +# - ROOTFS_INSTALL_UNSTRIPPED - if non-empty - install binaries into rootfs from PREFIX_PROG (instead of _STRIPPED) + # directory with current Makefile - relative to the repository root # filter-out all Makefiles outside of TOPDIR @@ -89,8 +92,15 @@ $(NAME)-clean: # install into the root filesystem LOCAL_INSTALL_PATH := $(or $(LOCAL_INSTALL_PATH),$(DEFAULT_INSTALL_PATH)) +# add option to install unstripped binaries +ifeq ($(ROOTFS_INSTALL_UNSTRIPPED),) + ROOTFS_BIN_SRC := $(PREFIX_PROG_STRIPPED)$(NAME) +else + ROOTFS_BIN_SRC := $(PREFIX_PROG)$(NAME) +endif + $(NAME)-install: $(NAME) $(PREFIX_ROOTFS)$(LOCAL_INSTALL_PATH)/$(NAME) -$(PREFIX_ROOTFS)$(LOCAL_INSTALL_PATH)/$(NAME): $(PREFIX_PROG_STRIPPED)$(NAME) +$(PREFIX_ROOTFS)$(LOCAL_INSTALL_PATH)/$(NAME): $(ROOTFS_BIN_SRC) $(INSTALL_FS) # necessary for NAME variable to be correctly set in recepies From b64d0b5f98f472fe03062794d566f05984d4e1b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Bia=C5=82ow=C4=85s?= Date: Tue, 29 Aug 2023 15:54:21 +0200 Subject: [PATCH 2/2] host-generic-pc: install unstripped binaries into rootfs by default Needed to provide meaningful backtraces on sanitizer errors. Fixes: phoenix-rtos/phoenix-rtos-project#797 --- Makefile.host | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile.host b/Makefile.host index 90348035..5f3d76a9 100644 --- a/Makefile.host +++ b/Makefile.host @@ -32,4 +32,8 @@ CFLAGS += -fsanitize=address,undefined LDFLAGS += -fsanitize=address,undefined endif +# install unstripped binaries in rootfs +# (cruicial for tests binaries with debug info for meaningful sanitizers info) +ROOTFS_INSTALL_UNSTRIPPED := y + CXXFLAGS += $(filter-out -Wstrict-prototypes, $(CFLAGS))