[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH] build: Introduce DBGFLAGS, DBGFLAGS-y



The original problem is that assembly source files are currently compiled
without debugging information. GCC's `-g[0-3]` flag is not handed over
to the assembler build rules. This causes the debugging information
of the final image to be incomplete.
Unfortunately the debug option flag cannot be simply added to
`ASFLAGS` because the linker script processing rules use
them, too. Those ones use the GCC preprocessor only and the debug
flags causes it to dump the internal preprocessor state into
the generated output text file.
Because all of this, this patch introduces the build system variables
`DBGFLAGS` and `DBGFLAGS-y`. Those ones are intended to carry
debug-related compile flags (like `-g[0-3]`). They are handed over to
only to the AS, C, C++, and GO compile rules.

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 Makefile.uk                  | 16 ++++------------
 support/build/Makefile.rules | 10 +++++-----
 2 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/Makefile.uk b/Makefile.uk
index 26ee0fda..67c372e5 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -50,18 +50,10 @@ GOCFLAGS-$(CONFIG_OPTIMIZE_LTO)           += -flto
 LIBLDFLAGS-$(CONFIG_OPTIMIZE_LTO)         += $(CFLAGS) $(CFLAGS-y)
 LDFLAGS-$(CONFIG_OPTIMIZE_LTO)            += $(CFLAGS) $(CFLAGS-y)
 
-CFLAGS-$(CONFIG_DEBUG_SYMBOLS_LVL0)       += -g0
-CXXFLAGS-$(CONFIG_DEBUG_SYMBOLS_LVL0)     += -g0
-GOCFLAGS-$(CONFIG_DEBUG_SYMBOLS_LVL0)     += -g0
-CFLAGS-$(CONFIG_DEBUG_SYMBOLS_LVL1)       += -g1
-CXXFLAGS-$(CONFIG_DEBUG_SYMBOLS_LVL1)     += -g1
-GOCFLAGS-$(CONFIG_DEBUG_SYMBOLS_LVL0)     += -g1
-CFLAGS-$(CONFIG_DEBUG_SYMBOLS_LVL2)       += -g2
-CXXFLAGS-$(CONFIG_DEBUG_SYMBOLS_LVL2)     += -g2
-GOCFLAGS-$(CONFIG_DEBUG_SYMBOLS_LVL0)     += -g2
-CFLAGS-$(CONFIG_DEBUG_SYMBOLS_LVL3)       += -g3
-CXXFLAGS-$(CONFIG_DEBUG_SYMBOLS_LVL3)     += -g3
-GOCFLAGS-$(CONFIG_DEBUG_SYMBOLS_LVL0)     += -g3
+DBGFLAGS-$(CONFIG_DEBUG_SYMBOLS_LVL0)     += -g0
+DBGFLAGS-$(CONFIG_DEBUG_SYMBOLS_LVL1)     += -g1
+DBGFLAGS-$(CONFIG_DEBUG_SYMBOLS_LVL2)     += -g2
+DBGFLAGS-$(CONFIG_DEBUG_SYMBOLS_LVL3)     += -g3
 
 ASFLAGS  += -D __Unikraft__ -DUK_CODENAME="$(UK_CODENAME)"
 ASFLAGS  += -DUK_VERSION=$(UK_VERSION).$(UK_SUBVERSION)
diff --git a/support/build/Makefile.rules b/support/build/Makefile.rules
index 906a0a6e..d60c6d92 100644
--- a/support/build/Makefile.rules
+++ b/support/build/Makefile.rules
@@ -355,7 +355,7 @@ $(3): $(2) | prepare
        $(call build_cmd_fixdep,AS,$(1),$(3),\
                $(AS)  $(ASINCLUDES) $(ASINCLUDES-y) \
                       $($(call vprefix_lib,$(1),ASINCLUDES)) $($(call 
vprefix_lib,$(1),ASINCLUDES-y)) \
-                      $(ASFLAGS) $(ASFLAGS-y) \
+                      $(ASFLAGS) $(ASFLAGS-y) $(DBGFLAGS) $(DBGFLAGS-y) \
                       $($(call vprefix_lib,$(1),ASFLAGS)) $($(call 
vprefix_lib,$(1),ASFLAGS-y)) \
                       $(4) -D__LIBNAME__=$(1) -D__BASENAME__=$(notdir $(2)) \
                       -c $(2) -o $(3) $(depflags)
@@ -373,7 +373,7 @@ $(3): $(2) | prepare
        $(call build_cmd,AS,$(1),$(3),\
                $(AS)  $(ASINCLUDES) $(ASINCLUDES-y) \
                       $($(call vprefix_lib,$(1),ASINCLUDES)) $($(call 
vprefix_lib,$(1),ASINCLUDES-y)) \
-                      $(ASFLAGS) $(ASFLAGS-y) \
+                      $(ASFLAGS) $(ASFLAGS-y) $(DBGFLAGS) $(DBGFLAGS-y) \
                       $($(call vprefix_lib,$(1),ASFLAGS)) $($(call 
vprefix_lib,$(1),ASFLAGS-y)) \
                       $(4) -D__LIBNAME__=$(1) -D__BASENAME__=$(notdir $(2)) \
                       -c $(2) -o $(3)
@@ -391,7 +391,7 @@ $(3): $(2) | prepare
        $(call build_cmd_fixdep,CC,$(1),$(3),\
                $(CC)  $(CINCLUDES) $(CINCLUDES-y) \
                       $($(call vprefix_lib,$(1),CINCLUDES)) $($(call 
vprefix_lib,$(1),CINCLUDES-y)) \
-                      $(CFLAGS) $(CFLAGS-y) \
+                      $(CFLAGS) $(CFLAGS-y) $(DBGFLAGS) $(DBGFLAGS-y) \
                       $($(call vprefix_lib,$(1),CFLAGS)) $($(call 
vprefix_lib,$(1),CFLAGS-y)) \
                       $(4) -D__LIBNAME__=$(1) -D__BASENAME__=$(notdir $(2)) \
                       -c $(2) -o $(3) $(depflags)
@@ -409,7 +409,7 @@ $(3): $(2) | prepare
        $(call build_cmd_fixdep,CXX,$(1),$(3),\
                $(CXX) $(CXXINCLUDES) $(CXXINCLUDES-y) \
                       $($(call vprefix_lib,$(1),CXXINCLUDES)) $($(call 
vprefix_lib,$(1),CXXINCLUDES-y)) \
-                      $(CXXFLAGS) $(CXXFLAGS-y) \
+                      $(CXXFLAGS) $(CXXFLAGS-y) $(DBGFLAGS) $(DBGFLAGS-y) \
                       $($(call vprefix_lib,$(1),CXXFLAGS)) $($(call 
vprefix_lib,$(1),CXXFLAGS-y)) \
                       $(4) -D__LIBNAME__=$(1) -D__BASENAME__=$(notdir $(2)) \
                       -c $(2) -o $(3) $(depflags)
@@ -427,7 +427,7 @@ $(3): $(2) | prepare
        $(call build_cmd,GOC,$(1),$(3),\
                $(GOC) $(GOCINCLUDES) $(GOCINCLUDES-y) \
                        $($(call vprefix_lib,$(1),GOCINCLUDES)) $($(call 
vprefix_lib,$(1),GOCINCLUDES-y)) \
-                       $(GOCFLAGS) $(GOCFLAGS-y) \
+                       $(GOCFLAGS) $(GOCFLAGS-y) $(DBGFLAGS) $(DBGFLAGS-y) \
                        $($(call vprefix_lib,$(1),GOCFLAGS)) $($(call 
vprefix_lib,$(1),GOCFLAGS-y)) \
                        $(4) -D__LIBNAME__=$(1) -D__BASENAME__=$(notdir $(2)) \
                        -c $(2) -o $(3) $(depflags)
-- 
2.20.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.