lkml.org 
[lkml]   [2012]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/5] unwind, x86: Generate exception frames data for UNWIND_EH_FRAME option
Date
Adding support to compile in eh_frame_hdr/eh_frame unwind
data. Plus several symbols to properly access this data.

__eh_frame_hdr_start
__eh_frame_hdr_end
__eh_frame_start
__eh_frame_end

Adding this for x86 arch, tested for x86_64 only.
---
arch/x86/Makefile | 8 +++++++-
arch/x86/kernel/vmlinux.lds.S | 5 +++++
include/asm-generic/vmlinux.lds.h | 12 ++++++++++++
3 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 209ba12..6d728fa 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -109,8 +109,14 @@ LDFLAGS := -m elf_$(UTS_MACHINE)
KBUILD_CFLAGS += -pipe
# Workaround for a gcc prelease that unfortunately was shipped in a suse release
KBUILD_CFLAGS += -Wno-sign-compare
-#
+
+ifdef CONFIG_UNWIND_EH_FRAME
+LDFLAGS_vmlinux += --eh-frame-hdr
+else
+# do not generate ef_frame section by default
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
+endif
+
# prevent gcc from generating any FP code by mistake
KBUILD_CFLAGS += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,)

diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 0f703f1..9cc7df0 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -114,6 +114,9 @@ SECTIONS

NOTES :text :note

+ /* Exception (header) frames */
+ EH_FRAME
+
EXCEPTION_TABLE(16) :text = 0x9090

#if defined(CONFIG_DEBUG_RODATA)
@@ -335,7 +338,9 @@ SECTIONS

/* Sections to be discarded */
DISCARDS
+#ifndef CONFIG_UNWIND_EH_FRAME
/DISCARD/ : { *(.eh_frame) }
+#endif
}


diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index b5e2e4c..94dc228 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -602,6 +602,18 @@
#define TRACEDATA
#endif

+#ifdef CONFIG_UNWIND_EH_FRAME
+#define EH_FRAME \
+ VMLINUX_SYMBOL(__eh_frame_hdr_start) = .; \
+ .eh_frame_hdr : { *(.eh_frame_hdr) } \
+ VMLINUX_SYMBOL(__eh_frame_hdr_end) = .; \
+ VMLINUX_SYMBOL(__eh_frame_start) = .; \
+ .eh_frame : { *(.eh_frame) } \
+ VMLINUX_SYMBOL(__eh_frame_end) = .;
+#else
+#define EH_FRAME
+#endif
+
#define NOTES \
.notes : AT(ADDR(.notes) - LOAD_OFFSET) { \
VMLINUX_SYMBOL(__start_notes) = .; \
--
1.7.1


\
 
 \ /
  Last update: 2012-02-10 12:29    [W:0.147 / U:3.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site