In .debug_frame based unwinding regime, we used to force -gdwarf-2 since
kernel unwinder only claimed to handle dwarf 2. This changed since commit
6d0d506012c93d ("ARC: dw2 unwind: Don't bail for CIE.version != 1")
which added some support beyond dwarf 2, atleast to handle CIE != 1
The ill-effect of -gdwarf-2 is that it forces generation of .debug_*
sections, which bloats loadable modules .ko files. For the curious, this
doesn't affect vmlinx binary since linker script discards .debug_* but
same discard is not yet implemented for modules.
So it seems we can drop the -gdwarf-2 toggle, which should not be needed
anyways given that we now use .eh_frame based unwinding.
I've verified using GNU 2016.09-engo10 that the actual unwind info is
not different with or w/o this toggle - but the debug_* sections are
gone for good.
before
-----
arc-linux-readelf -S q_proc.ko-unwinding-1-eh_frame-switch | grep debug
[15] .debug_info PROGBITS
00000000 000300 00d08d 00 0 0 1
[16] .rela.debug_info RELA
00000000 0162a0 008844 0c I 29 15 4
[17] .debug_abbrev PROGBITS
00000000 00d38d 0005f8 00 0 0 1
[18] .debug_loc PROGBITS
00000000 00d985 000070 00 0 0 1
[19] .rela.debug_loc RELA
00000000 01eae4 0000c0 0c I 29 18 4
[20] .debug_aranges PROGBITS
00000000 00d9f5 000040 00 0 0 1
[21] .rela.debug_arang RELA
00000000 01eba4 000030 0c I 29 20 4
[22] .debug_ranges PROGBITS
00000000 00da35 000018 00 0 0 1
[23] .rela.debug_range RELA
00000000 01ebd4 000030 0c I 29 22 4
[24] .debug_line PROGBITS
00000000 00da4d 000b5b 00 0 0 1
[25] .rela.debug_line RELA
00000000 01ec04 0000cc 0c I 29 24 4
[26] .debug_str PROGBITS
00000000 00e5a8 007831 01 MS 0 0 1
after
----
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
upto_gcc44 := $(call cc-ifversion, -le, 0404, y)
atleast_gcc44 := $(call cc-ifversion, -ge, 0404, y)
-atleast_gcc48 := $(call cc-ifversion, -ge, 0408, y)
cflags-$(atleast_gcc44) += -fsection-anchors
cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables
-# By default gcc 4.8 generates dwarf4 which kernel unwinder can't grok
-ifeq ($(atleast_gcc48),y)
-cflags-$(CONFIG_ARC_DW2_UNWIND) += -gdwarf-2
-endif
-
ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE
# Generic build system uses -O2, we want -O3
# Note: No need to add to cflags-y as that happens anyways