[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1328873119-21553-3-git-send-email-jolsa@redhat.com>
Date: Fri, 10 Feb 2012 12:25:16 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: acme@...hat.com, a.p.zijlstra@...llo.nl, mingo@...e.hu,
paulus@...ba.org, cjashfor@...ux.vnet.ibm.com, fweisbec@...il.com
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH 2/5] unwind, x86: Generate exception frames data for UNWIND_EH_FRAME option
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists