From: Jiri Olsa <jolsa@redhat.com>
To: acme@redhat.com, a.p.zijlstra@chello.nl, mingo@elte.hu,
paulus@samba.org, cjashfor@linux.vnet.ibm.com,
fweisbec@gmail.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 2/5] unwind, x86: Generate exception frames data for UNWIND_EH_FRAME option
Date: Fri, 10 Feb 2012 12:25:16 +0100 [thread overview]
Message-ID: <1328873119-21553-3-git-send-email-jolsa@redhat.com> (raw)
In-Reply-To: <1328873119-21553-1-git-send-email-jolsa@redhat.com>
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
next prev parent reply other threads:[~2012-02-10 11:25 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-10 11:25 [RFC 0/5] kernel: backtrace unwind support Jiri Olsa
2012-02-10 11:25 ` [PATCH 1/5] unwind, kconfig: Adding UNWIND* options Jiri Olsa
2012-02-10 11:25 ` Jiri Olsa [this message]
2012-02-10 11:25 ` [PATCH 3/5] unwind, dwarf: Add dwarf unwind support Jiri Olsa
2012-02-10 11:25 ` [PATCH 4/5] unwind, api: Add unwind interface and implementation for x86_64 Jiri Olsa
2012-02-10 11:25 ` [PATCH 5/5] unwind, test: Add backtrace unwind test code Jiri Olsa
2012-02-10 17:43 ` [RFC 0/5] kernel: backtrace unwind support Peter Zijlstra
2012-02-10 18:59 ` Linus Torvalds
2012-02-10 19:27 ` Arnaldo Carvalho de Melo
2012-02-10 19:32 ` Linus Torvalds
2012-02-10 19:39 ` Arnaldo Carvalho de Melo
2012-02-10 19:42 ` Arnaldo Carvalho de Melo
2012-02-10 19:44 ` Ingo Molnar
2012-02-10 20:18 ` Jiri Olsa
2012-02-10 20:37 ` Linus Torvalds
2012-02-14 2:22 ` Benjamin Herrenschmidt
2012-02-11 14:38 ` Ingo Molnar
2012-02-11 23:36 ` Jiri Olsa
2012-02-11 3:25 ` Frederic Weisbecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1328873119-21553-3-git-send-email-jolsa@redhat.com \
--to=jolsa@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=cjashfor@linux.vnet.ibm.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®