Skip to contentSkip to conversation

Fix debugging info for .S files

PATCH In review Geoff Levand 2 participants 9 messages Dec 11, 2013 – Jan 28, 2014 Kbuild

lore
Share & tools
lore
#0 lore raw

cover Fix debugging info for .S files

Hi Michal,

Here are a few small patches to fixup debug info gereration for .S files. I tested the generated vmlinux with the ARM Fast Model debugger and ARM64 target.

Please apply.

-Geoff

The following changes since commit 374b105797c3d4f29c685f3be535c35f5689b30e:

Linux 3.13-rc3 (2013-12-06 09:34:04 -0800)

are available in the git repository at:

git://git.linaro.org/people/geoff.levand/linux-kexec.git for-kbuild

for you to fetch changes up to e9d530c5b8b1c9a8510d9c8db8663aedc393de8f:

mn10300: Remove redundent debugging info flag (2013-12-11 15:15:00 -0800)

----------------------------------------------------------------
Geoff Levand (3):
kbuild: Fix debugging info generation for .S files
frv: Remove redundent debugging info flag
mn10300: Remove redundent debugging info flag

 Makefile              | 2 +-
 arch/frv/Makefile     | 1 -
 arch/mn10300/Makefile | 1 -
 3 files changed, 1 insertion(+), 3 deletions(-)
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH 1/3 kbuild: Fix debugging info generation for .S files

Change the debuging info generation flag in KBUILD_AFLAGS from '-gdwarf-2' to '-Wa,--gdwarf-2'. This will properly generate the debugging info for .S files when CONFIG_DEBUG_INFO=y.

It seems current gcc does not pass a '--gdwarf-2' option on to the assembler when '-gdwarf-2' is on its command line (note the differece in the gcc and as flags). This change provides the correct assembler flag to gcc, and so does not rely on gcc to emit a flag for the assembler.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 890392f..7308a6f 100644
@@ -619,7 +619,7 @@ endif
 
 ifdef CONFIG_DEBUG_INFO
 KBUILD_CFLAGS	+= -g
-KBUILD_AFLAGS	+= -gdwarf-2
+KBUILD_AFLAGS	+= -Wa,--gdwarf-2
 endif
 
 ifdef CONFIG_DEBUG_INFO_REDUCED
Signature · 1 line
1.8.1.2
#2 lore raw

Re: [PATCH 1/3] kbuild: Fix debugging info generation for .S files

Dne 12.12.2013 00:34, Geoff Levand napsal(a):

Quoted 9 lines

Change the debuging info generation flag in KBUILD_AFLAGS from '-gdwarf-2' to '-Wa,--gdwarf-2'. This will properly generate the debugging info for .S files when CONFIG_DEBUG_INFO=y.

It seems current gcc does not pass a '--gdwarf-2' option on to the assembler when '-gdwarf-2' is on its command line (note the differece in the gcc and as flags). This change provides the correct assembler flag to gcc, and so does not rely on gcc to emit a flag for the assembler.

Quoted 4 lines
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to kbuild.git#kbuild, sorry for the delay.

Michal

#3 lore raw

PATCH 2/3 frv: Remove redundent debugging info flag

In reply to Geoff Levand

The gereric makefile now sets '-Wa,--gdwarf2' in KBUILD_AFLAGS, so this setting is no longer needed in arch makefiles.

---
 arch/frv/Makefile | 1 -
 1 file changed, 1 deletion(-)
arch/frv/Makefile +0 -1
index 4d1b1e9..5b838db 100644
@@ -78,7 +78,6 @@ KBUILD_AFLAGS	+= -mno-fdpic
 # and disable optimisations that are unhelpful whilst debugging
 ifdef CONFIG_DEBUG_INFO
 #KBUILD_CFLAGS	+= -O1
-KBUILD_AFLAGS	+= -Wa,--gdwarf2
 endif
 
 head-y		:= arch/frv/kernel/head.o
Signature · 1 line
1.8.1.2
#4 lore raw

Re: [PATCH V2 2/3] frv: Remove redundant debugging info flag

The generic makefile now sets '-Wa,--gdwarf2' in KBUILD_AFLAGS, so this setting is no longer needed in arch makefiles.

Also remove a commented out addition of a -O1 to KBUILD_CFLAGS, and comment text relating to these removed lines.

---
v2: Removed unused CONFIG_DEBUG_INFO conditional and related text comment.

 arch/frv/Makefile | 7 -------
 1 file changed, 7 deletions(-)
arch/frv/Makefile +0 -7
index 4d1b1e9..2a8fb73 100644
@@ -74,13 +74,6 @@ KBUILD_CFLAGS	+= -mno-fdpic -mgpr-32 -msoft-float -mno-media
 KBUILD_CFLAGS	+= -ffixed-fcc3 -ffixed-cc3 -ffixed-gr15 -ffixed-icc2
 KBUILD_AFLAGS	+= -mno-fdpic
 
-# make sure the .S files get compiled with debug info
-# and disable optimisations that are unhelpful whilst debugging
-ifdef CONFIG_DEBUG_INFO
-#KBUILD_CFLAGS	+= -O1
-KBUILD_AFLAGS	+= -Wa,--gdwarf2
-endif
-
 head-y		:= arch/frv/kernel/head.o
 
 core-y		+= arch/frv/kernel/ arch/frv/mm/
Signature · 1 line
1.8.1.2
#5 lore raw

Re: [PATCH V2 2/3] frv: Remove redundant debugging info flag

Quoted 10 lines · Geoff Levand

The generic makefile now sets '-Wa,--gdwarf2' in KBUILD_AFLAGS, so this setting is no longer needed in arch makefiles.

Also remove a commented out addition of a -O1 to KBUILD_CFLAGS, and comment text relating to these removed lines.

---
v2: Removed unused CONFIG_DEBUG_INFO conditional and related text comment.

Thanks, I added v2 of 2/3 and 3/3 to kbuild.git#kbuild.

Michal

#6 lore raw

PATCH 3/3 mn10300: Remove redundent debugging info flag

In reply to Geoff Levand

The gereric makefile now sets '-Wa,--gdwarf2' in KBUILD_AFLAGS, so this setting is no longer needed in arch makefiles.

---
 arch/mn10300/Makefile | 1 -
 1 file changed, 1 deletion(-)
arch/mn10300/Makefile +0 -1
index a3d0fef..f5a9db9 100644
@@ -97,7 +97,6 @@ endef
 # that are unhelpful whilst debugging.
 ifdef CONFIG_DEBUG_INFO
 #KBUILD_CFLAGS	+= -O1
-KBUILD_AFLAGS	+= -Wa,--gdwarf2
 endif
 
 #
Signature · 1 line
1.8.1.2
#7 lore raw

Re: [PATCH 3/3] mn10300: Remove redundent debugging info flag

Dne 12.12.2013 00:34, Geoff Levand napsal(a):

Quoted 14 lines

The gereric makefile now sets '-Wa,--gdwarf2' in KBUILD_AFLAGS, so this setting is no longer needed in arch makefiles.

---
 arch/mn10300/Makefile | 1 -
 1 file changed, 1 deletion(-)
arch/mn10300/Makefile +0 -0
index a3d0fef..f5a9db9 100644

arch/mn10300/Makefile endef · line 100

Quoted 5 lines
arch/mn10300/Makefile +0 -1
@@ -97,7 +97,6 @@ endef
 # that are unhelpful whilst debugging.
 ifdef CONFIG_DEBUG_INFO
 #KBUILD_CFLAGS	+= -O1
-KBUILD_AFLAGS	+= -Wa,--gdwarf2
 endif

This leaves only a commented-out assignment in the ifdef block. Just remove it completely together with the outdated comment above. Same for the frv Makefile.

Michal

#8 lore raw

PATCH v2 3/3 mn10300: Remove redundant debugging info flag

The generic makefile now sets '-Wa,--gdwarf2' in KBUILD_AFLAGS, so this setting is no longer needed in arch makefiles.

Also remove a commented out addition of a -O1 to KBUILD_CFLAGS, and comment text relating to these removed lines.

---
v2: Removed unused CONFIG_DEBUG_INFO conditional and related text comment.

 arch/mn10300/Makefile | 8 --------
 1 file changed, 8 deletions(-)
arch/mn10300/Makefile +0 -8
index a3d0fef..3f1ea5d 100644
@@ -92,14 +92,6 @@ define archhelp
   echo  '* zImage        - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
 endef
 
-# If you make sure the .S files get compiled with debug info,
-# uncomment the following to disable optimisations
-# that are unhelpful whilst debugging.
-ifdef CONFIG_DEBUG_INFO
-#KBUILD_CFLAGS	+= -O1
-KBUILD_AFLAGS	+= -Wa,--gdwarf2
-endif
-
 #
 # include the appropriate processor- and unit-specific headers
 #
Signature · 1 line
1.8.1.2