Commit 6716dbbd authored by Vineet Gupta's avatar Vineet Gupta

ARC: dw2 unwind: switch to .eh_frame based unwinding

So finally after almost 8 years of dealing with .debug_frame, we are
finally switching to .eh_frame. The reason being stripped kernel
binaries had non-functional unwinder as .debug_frame was gone.
Also, in general .eh_frame seems more common way of doing unwinding.

This also folds a revert of f52e126c ("ARC: unwind: ensure that
.debug_frame is generated (vs. .eh_frame)") to ensure that we start
getting .eh_frame
Reported-by: default avatarDaniel Mentz <danielmentz@google.com>
Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
parent d040876b
...@@ -66,6 +66,8 @@ endif ...@@ -66,6 +66,8 @@ endif
endif endif
cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables
# By default gcc 4.8 generates dwarf4 which kernel unwinder can't grok # By default gcc 4.8 generates dwarf4 which kernel unwinder can't grok
ifeq ($(atleast_gcc48),y) ifeq ($(atleast_gcc48),y)
cflags-$(CONFIG_ARC_DW2_UNWIND) += -gdwarf-2 cflags-$(CONFIG_ARC_DW2_UNWIND) += -gdwarf-2
......
...@@ -61,18 +61,6 @@ ENTRY(ret_from_fork) ...@@ -61,18 +61,6 @@ ENTRY(ret_from_fork)
b ret_from_exception b ret_from_exception
END(ret_from_fork) END(ret_from_fork)
#ifdef CONFIG_ARC_DW2_UNWIND
; Workaround for bug 94179 (STAR ):
; Despite -fasynchronous-unwind-tables, linker is not making dwarf2 unwinder
; section (.debug_frame) as loadable. So we force it here.
; This also fixes STAR 9000487933 where the prev-workaround (objcopy --setflag)
; would not work after a clean build due to kernel build system dependencies.
.section .debug_frame, "wa",@progbits
; Reset to .text as this file is included in entry-<isa>.S
.section .text, "ax",@progbits
#endif
;################### Non TLB Exception Handling ############################# ;################### Non TLB Exception Handling #############################
; --------------------------------------------- ; ---------------------------------------------
......
...@@ -22,13 +22,9 @@ static inline void arc_write_me(unsigned short *addr, unsigned long value) ...@@ -22,13 +22,9 @@ static inline void arc_write_me(unsigned short *addr, unsigned long value)
*(addr + 1) = (value & 0xffff); *(addr + 1) = (value & 0xffff);
} }
/* ARC specific section quirks - before relocation loop in generic loader /*
* * This gets called before relocation loop in generic loader
* For dwarf unwinding out of modules, this needs to * Make a note of the section index of unwinding section
* 1. Ensure the .debug_frame is allocatable (ARC Linker bug: despite
* -fasynchronous-unwind-tables it doesn't).
* 2. Since we are iterating thru sec hdr tbl anyways, make a note of
* the exact section index, for later use.
*/ */
int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
char *secstr, struct module *mod) char *secstr, struct module *mod)
...@@ -40,8 +36,7 @@ int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs, ...@@ -40,8 +36,7 @@ int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
mod->arch.unw_info = NULL; mod->arch.unw_info = NULL;
for (i = 1; i < hdr->e_shnum; i++) { for (i = 1; i < hdr->e_shnum; i++) {
if (strcmp(secstr+sechdrs[i].sh_name, ".debug_frame") == 0) { if (strcmp(secstr+sechdrs[i].sh_name, ".eh_frame") == 0) {
sechdrs[i].sh_flags |= SHF_ALLOC;
mod->arch.unw_sec_idx = i; mod->arch.unw_sec_idx = i;
break; break;
} }
......
...@@ -111,7 +111,7 @@ UNW_REGISTER_INFO}; ...@@ -111,7 +111,7 @@ UNW_REGISTER_INFO};
#define DW_EH_PE_indirect 0x80 #define DW_EH_PE_indirect 0x80
#define DW_EH_PE_omit 0xff #define DW_EH_PE_omit 0xff
#define CIE_ID 0xffffffffUL #define CIE_ID 0
typedef unsigned long uleb128_t; typedef unsigned long uleb128_t;
typedef signed long sleb128_t; typedef signed long sleb128_t;
...@@ -510,8 +510,7 @@ static const u32 *__cie_for_fde(const u32 *fde) ...@@ -510,8 +510,7 @@ static const u32 *__cie_for_fde(const u32 *fde)
{ {
const u32 *cie; const u32 *cie;
/* cie = fde + 1 - fde[1] / sizeof(*fde); */ cie = fde + 1 - fde[1] / sizeof(*fde);
cie = (u32 *) fde[1];
return cie; return cie;
} }
......
...@@ -84,7 +84,7 @@ SECTIONS ...@@ -84,7 +84,7 @@ SECTIONS
/* /*
* .exit.text is discard at runtime, not link time, to deal with * .exit.text is discard at runtime, not link time, to deal with
* references from .debug_frame * references from unwinding sections
* It will be init freed, being inside [__init_start : __init_end] * It will be init freed, being inside [__init_start : __init_end]
*/ */
.exit.text : { EXIT_TEXT } .exit.text : { EXIT_TEXT }
...@@ -120,18 +120,13 @@ SECTIONS ...@@ -120,18 +120,13 @@ SECTIONS
#ifdef CONFIG_ARC_DW2_UNWIND #ifdef CONFIG_ARC_DW2_UNWIND
. = ALIGN(PAGE_SIZE); . = ALIGN(PAGE_SIZE);
.debug_frame : { .eh_frame : {
__start_unwind = .; __start_unwind = .;
*(.debug_frame) *(.eh_frame)
__end_unwind = .; __end_unwind = .;
} }
/*
* gcc 4.8 generates this for -fasynchonous-unwind-tables,
* while we still use the .debug_frame based unwinder
*/
/DISCARD/ : { *(.eh_frame) }
#else #else
/DISCARD/ : { *(.debug_frame) } /DISCARD/ : { *(.eh_frame) }
#endif #endif
NOTES NOTES
...@@ -148,7 +143,7 @@ SECTIONS ...@@ -148,7 +143,7 @@ SECTIONS
} }
#ifndef CONFIG_DEBUG_INFO #ifndef CONFIG_DEBUG_INFO
/* open-coded because we need .debug_frame seperately for unwinding */ /DISCARD/ : { *(.debug_frame) }
/DISCARD/ : { *(.debug_aranges) } /DISCARD/ : { *(.debug_aranges) }
/DISCARD/ : { *(.debug_pubnames) } /DISCARD/ : { *(.debug_pubnames) }
/DISCARD/ : { *(.debug_info) } /DISCARD/ : { *(.debug_info) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment