Skip to content

Commit 5a45da0

Browse files
committed
ARC: Adjustments for gcc 4.8
* DWARF unwinder related + Force DWARF2 compliant .debug_frame (gcc 4.8 defaults to DWARF4 which kernel unwinder can't grok). + Discard the additional .eh_frame generated + Discard the dwarf4 debug info generated by -gdwarf-2 for normal no debug case * 4.8 already uses arc600 multilibs for -mno-mpy * switch to using uclibc compiler (to get -mmedium-calls and -mno-sdata) and also since buildroot can only use 1 toolchain Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
1 parent 05b016e commit 5a45da0

5 files changed

Lines changed: 35 additions & 19 deletions

File tree

‎arch/arc/Makefile‎

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
UTS_MACHINE := arc
1010

1111
ifeq ($(CROSS_COMPILE),)
12-
CROSS_COMPILE := arc-elf32-
12+
CROSS_COMPILE := arc-linux-uclibc-
1313
endif
1414

1515
KBUILD_DEFCONFIG := fpga_defconfig
@@ -25,14 +25,23 @@ ifdef CONFIG_ARC_CURR_IN_REG
2525
LINUXINCLUDE += -include ${src}/arch/arc/include/asm/current.h
2626
endif
2727

28-
atleast_gcc44 := $(call cc-ifversion, -gt, 0402, y)
28+
upto_gcc42 := $(call cc-ifversion, -le, 0402, y)
29+
upto_gcc44 := $(call cc-ifversion, -le, 0404, y)
30+
atleast_gcc44 := $(call cc-ifversion, -ge, 0404, y)
31+
atleast_gcc48 := $(call cc-ifversion, -ge, 0408, y)
32+
2933
cflags-$(atleast_gcc44) += -fsection-anchors
3034

3135
cflags-$(CONFIG_ARC_HAS_LLSC) += -mlock
3236
cflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape
3337
cflags-$(CONFIG_ARC_HAS_RTSC) += -mrtsc
3438
cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables
3539

40+
# By default gcc 4.8 generates dwarf4 which kernel unwinder can't grok
41+
ifeq ($(atleast_gcc48),y)
42+
cflags-$(CONFIG_ARC_DW2_UNWIND) += -gdwarf-2
43+
endif
44+
3645
ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE
3746
# Generic build system uses -O2, we want -O3
3847
cflags-y += -O3
@@ -46,11 +55,10 @@ cflags-$(disable_small_data) += -mno-sdata -fcall-used-gp
4655
cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mbig-endian
4756
ldflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB
4857

49-
# STAR 9000518362:
58+
# STAR 9000518362: (fixed with binutils shipping with gcc 4.8)
5059
# arc-linux-uclibc-ld (buildroot) or arceb-elf32-ld (EZChip) don't accept
51-
# --build-id w/o "-marclinux".
52-
# Default arc-elf32-ld is OK
53-
ldflags-y += -marclinux
60+
# --build-id w/o "-marclinux". Default arc-elf32-ld is OK
61+
ldflags-$(upto_gcc44) += -marclinux
5462

5563
ARC_LIBGCC := -mA7
5664
cflags-$(CONFIG_ARC_HAS_HW_MPY) += -multcost=16
@@ -64,8 +72,8 @@ ifndef CONFIG_ARC_HAS_HW_MPY
6472
# With gcc 4.4.7, -mno-mpy is enough to make any other related adjustments,
6573
# e.g. increased cost of MPY. With gcc 4.2.1 this had to be explicitly hinted
6674

67-
ARC_LIBGCC := -marc600
68-
ifneq ($(atleast_gcc44),y)
75+
ifeq ($(upto_gcc42),y)
76+
ARC_LIBGCC := -marc600
6977
cflags-y += -multcost=30
7078
endif
7179
endif

‎arch/arc/configs/fpga_defconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CONFIG_CROSS_COMPILE="arc-elf32-"
1+
CONFIG_CROSS_COMPILE="arc-linux-uclibc-"
22
# CONFIG_LOCALVERSION_AUTO is not set
33
CONFIG_DEFAULT_HOSTNAME="ARCLinux"
44
# CONFIG_SWAP is not set

‎arch/arc/configs/nsimosci_defconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CONFIG_CROSS_COMPILE="arc-elf32-"
1+
CONFIG_CROSS_COMPILE="arc-linux-uclibc-"
22
# CONFIG_LOCALVERSION_AUTO is not set
33
CONFIG_DEFAULT_HOSTNAME="ARCLinux"
44
# CONFIG_SWAP is not set

‎arch/arc/configs/tb10x_defconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CONFIG_CROSS_COMPILE="arc-elf32-"
1+
CONFIG_CROSS_COMPILE="arc-linux-uclibc-"
22
# CONFIG_LOCALVERSION_AUTO is not set
33
CONFIG_DEFAULT_HOSTNAME="tb10x"
44
CONFIG_SYSVIPC=y

‎arch/arc/kernel/vmlinux.lds.S‎

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ SECTIONS
125125
*(.debug_frame)
126126
__end_unwind = .;
127127
}
128+
/*
129+
* gcc 4.8 generates this for -fasynchonous-unwind-tables,
130+
* while we still use the .debug_frame based unwinder
131+
*/
132+
/DISCARD/ : { *(.eh_frame) }
128133
#else
129134
/DISCARD/ : { *(.debug_frame) }
130135
#endif
@@ -142,15 +147,18 @@ SECTIONS
142147
*(.arcextmap.*)
143148
}
144149

150+
#ifndef CONFIG_DEBUG_INFO
145151
/* open-coded because we need .debug_frame seperately for unwinding */
146-
.debug_aranges 0 : { *(.debug_aranges) }
147-
.debug_pubnames 0 : { *(.debug_pubnames) }
148-
.debug_info 0 : { *(.debug_info) }
149-
.debug_abbrev 0 : { *(.debug_abbrev) }
150-
.debug_line 0 : { *(.debug_line) }
151-
.debug_str 0 : { *(.debug_str) }
152-
.debug_loc 0 : { *(.debug_loc) }
153-
.debug_macinfo 0 : { *(.debug_macinfo) }
152+
/DISCARD/ : { *(.debug_aranges) }
153+
/DISCARD/ : { *(.debug_pubnames) }
154+
/DISCARD/ : { *(.debug_info) }
155+
/DISCARD/ : { *(.debug_abbrev) }
156+
/DISCARD/ : { *(.debug_line) }
157+
/DISCARD/ : { *(.debug_str) }
158+
/DISCARD/ : { *(.debug_loc) }
159+
/DISCARD/ : { *(.debug_macinfo) }
160+
/DISCARD/ : { *(.debug_ranges) }
161+
#endif
154162

155163
#ifdef CONFIG_ARC_HAS_DCCM
156164
. = CONFIG_ARC_DCCM_BASE;

0 commit comments

Comments
 (0)