summaryrefslogtreecommitdiffstats
path: root/rules/pre
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2022-10-01 13:30:07 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2022-10-04 09:35:04 +0200
commitb3da3e8ac706775fe8dbb5846007317f20bf0c46 (patch)
tree2164acb5dc0cc17e0c7d6d532cb56cf492cc86d5 /rules/pre
parent521d3edfe8e6e70d259ec8328e5c81ccff8f0575 (diff)
downloadOSELAS.Toolchain-b3da3e8ac706775fe8dbb5846007317f20bf0c46.tar.gz
OSELAS.Toolchain-b3da3e8ac706775fe8dbb5846007317f20bf0c46.tar.xz
rewrite PTXCONF_TOOLCHAIN_DEBUG and generall debug handling
The regular toolchains are already built with debug symbols, so that part remains the same. PTXCONF_TOOLCHAIN_DEBUG just adds the sources for target libraries to the toolchain. Previously the source directory was changed but that makes the paths longer, which can cause problems. So instead keep the directories and copy the sources instead. Use -ffile-prefix-map= to rewrite the paths in the debug symbols. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'rules/pre')
-rw-r--r--rules/pre/toolchain.make42
1 files changed, 19 insertions, 23 deletions
diff --git a/rules/pre/toolchain.make b/rules/pre/toolchain.make
index 063f5ac..6d50af4 100644
--- a/rules/pre/toolchain.make
+++ b/rules/pre/toolchain.make
@@ -47,16 +47,16 @@ PTX_HOST_CROSS_AUTOCONF := \
#
PTXDIST_HOST_LDFLAGS := -L${PTXDIST_PATH_SYSROOT_HOST_PREFIX}/lib
-ifndef PTXCONF_TOOLCHAIN_DEBUG
-TOOLCHAIN_CROSS_DEBUG_MAP := \
- $(PTXDIST_WORKSPACE)/platform-=$(call remove_quotes,$(PTXCONF_PROJECT))/platform- \
- $(PTXDIST_SYSROOT_CROSS)=
+TOOLCHAIN_WORKSPACE_SYMLINK := $(subst $(PTXDIST_WORKSPACE),,$(call ptx/sh, realpath $(PTXDIST_WORKSPACE)))
-ifneq ($(PTXDIST_SYSROOT_CROSS),$(call ptx/sh, realpath $(PTXDIST_SYSROOT_CROSS)))
-TOOLCHAIN_CROSS_DEBUG_MAP += \
- $(call ptx/sh, realpath $(PTXDIST_WORKSPACE))/platform-=$(call remove_quotes,$(PTXCONF_PROJECT))/platform- \
- $(call ptx/sh, realpath $(PTXDIST_SYSROOT_CROSS))=
-endif
+define ptx/toolchain-map
+$(1)=$(2) $(if $(TOOLCHAIN_WORKSPACE_SYMLINK),$(call ptx/sh, realpath $(1))=$(2))
+endef
+
+TOOLCHAIN_CROSS_DEBUG_MAP := \
+ $(call ptx/toolchain-map,$(BUILDDIR)) \
+ $(call ptx/toolchain-map,$(CROSS_BUILDDIR)) \
+ $(call ptx/toolchain-map,$(PTXDIST_SYSROOT_CROSS))
PTXDIST_HOST_CPPFLAGS := \
$(PTXDIST_HOST_CPPFLAGS) \
@@ -64,9 +64,16 @@ PTXDIST_HOST_CPPFLAGS := \
TOOLCHAIN_CROSS_DEBUG_FLAGS := \
-g3 \
- -gno-record-gcc-switches \
- $(addprefix -ffile-prefix-map=,$(TOOLCHAIN_CROSS_DEBUG_MAP))
-endif
+ -gno-record-gcc-switches
+
+define ptx/toolchain-cross-debug-map
+$(if $(PTXCONF_TOOLCHAIN_DEBUG),$(call ptx/toolchain-map,$($(strip $(1))_DIR),$(PTXCONF_PREFIX_CROSS)/src/$($(strip $(1))))) \
+$(TOOLCHAIN_CROSS_DEBUG_MAP)
+endef
+define ptx/toolchain-cross-debug-flags
+$(TOOLCHAIN_CROSS_DEBUG_FLAGS) \
+$(addprefix -ffile-prefix-map=,$(call ptx/toolchain-cross-debug-map,$(1)))
+endef
#
# gcc-first
@@ -76,17 +83,6 @@ CROSS_PATH := $(PTXDIST_SYSROOT_HOST)/lib/wrapper:$(PTXDIST_SYSROOT_CROSS)$(PTX
HOST_CROSS_PATH := $(CROSS_PATH)
#
-# debuggable gcc/glibc
-#
-ifdef PTXCONF_TOOLCHAIN_DEBUG
-BUILDDIR_DEBUG := $(PTXDIST_SYSROOT_CROSS)$(PTXCONF_PREFIX_CROSS)/src/target
-BUILDDIR_CROSS_DEBUG := $(PTXDIST_SYSROOT_CROSS)$(PTXCONF_PREFIX_CROSS)/src/cross
-else
-BUILDDIR_DEBUG := $(BUILDDIR)
-BUILDDIR_CROSS_DEBUG := $(CROSS_BUILDDIR)
-endif
-
-#
# images
#