From: Rob Herring <robherring2@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org,
Russell King <linux@arm.linux.org.uk>,
Rob Herring <robh@kernel.org>
Subject: [RFC PATCH 4/4] vmlinux.lds: define conditional sections with macros
Date: Thu, 27 Mar 2014 14:41:57 -0500 [thread overview]
Message-ID: <1395949317-8738-5-git-send-email-robherring2@gmail.com> (raw)
In-Reply-To: <1395949317-8738-1-git-send-email-robherring2@gmail.com>
From: Rob Herring <robh@kernel.org>
Various section definitions all use the same pattern. Create a common
macro to define these.
There are a few other instances with a different symbol naming convention
which could also be converted over to use this.
Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
---
include/asm-generic/vmlinux.lds.h | 82 +++++++++++++--------------------------
1 file changed, 27 insertions(+), 55 deletions(-)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 000a0f30..9a08039 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -84,61 +84,33 @@
#define MEM_DISCARD(sec) *(.mem##sec)
#endif
-#ifdef CONFIG_FTRACE_MCOUNT_RECORD
-#define MCOUNT_REC() . = ALIGN(8); \
- VMLINUX_SYMBOL(__start_mcount_loc) = .; \
- *(__mcount_loc) \
- VMLINUX_SYMBOL(__stop_mcount_loc) = .;
-#else
-#define MCOUNT_REC()
-#endif
-
-#ifdef CONFIG_TRACE_BRANCH_PROFILING
-#define LIKELY_PROFILE() VMLINUX_SYMBOL(__start_annotated_branch_profile) = .; \
- *(_ftrace_annotated_branch) \
- VMLINUX_SYMBOL(__stop_annotated_branch_profile) = .;
-#else
-#define LIKELY_PROFILE()
-#endif
-
-#ifdef CONFIG_PROFILE_ALL_BRANCHES
-#define BRANCH_PROFILE() VMLINUX_SYMBOL(__start_branch_profile) = .; \
- *(_ftrace_branch) \
- VMLINUX_SYMBOL(__stop_branch_profile) = .;
-#else
-#define BRANCH_PROFILE()
-#endif
-
-#ifdef CONFIG_EVENT_TRACING
-#define FTRACE_EVENTS() . = ALIGN(8); \
- VMLINUX_SYMBOL(__start_ftrace_events) = .; \
- *(_ftrace_events) \
- VMLINUX_SYMBOL(__stop_ftrace_events) = .;
-#else
-#define FTRACE_EVENTS()
-#endif
-
-#ifdef CONFIG_TRACING
-#define TRACE_PRINTKS() VMLINUX_SYMBOL(__start___trace_bprintk_fmt) = .; \
- *(__trace_printk_fmt) /* Trace_printk fmt' pointer */ \
- VMLINUX_SYMBOL(__stop___trace_bprintk_fmt) = .;
-#define TRACEPOINT_STR() VMLINUX_SYMBOL(__start___tracepoint_str) = .; \
- *(__tracepoint_str) /* Trace_printk fmt' pointer */ \
- VMLINUX_SYMBOL(__stop___tracepoint_str) = .;
-#else
-#define TRACE_PRINTKS()
-#define TRACEPOINT_STR()
-#endif
-
-#ifdef CONFIG_FTRACE_SYSCALLS
-#define TRACE_SYSCALLS() . = ALIGN(8); \
- VMLINUX_SYMBOL(__start_syscalls_metadata) = .; \
- *(__syscalls_metadata) \
- VMLINUX_SYMBOL(__stop_syscalls_metadata) = .;
-#else
-#define TRACE_SYSCALLS()
-#endif
-
+#define __DEF_SECT(cfg, align, sec, sym) _DEF_SECT_##cfg(align, sec, sym)
+#define _DEF_SECT(cfg, align, sec, sym) __DEF_SECT(cfg, align, sec, sym)
+#define DEF_SECTION_SYM(cfg, align, sec, sym) \
+ _DEF_SECT(config_enabled(cfg), align, sec, sym)
+#define DEF_SECTION(cfg, align, sec) \
+ _DEF_SECT(config_enabled(cfg), align, sec, sec)
+#define _DEF_SECT_0(align, sec, sym)
+#define _DEF_SECT_1(align, sec, sym) \
+ . = ALIGN(align); \
+ VMLINUX_SYMBOL(__start_##sym) = .; \
+ *(##sec) \
+ VMLINUX_SYMBOL(__stop_##sym) = .;
+
+#define MCOUNT_REC() \
+ DEF_SECTION(CONFIG_FTRACE_MCOUNT_RECORD, 8, mcount_loc)
+#define LIKELY_PROFILE() \
+ DEF_SECTION_SYM(CONFIG_TRACE_BRANCH_PROFILING, 1, _ftrace_annotated_branch, annotated_branch_profile)
+#define FTRACE_EVENTS() \
+ DEF_SECTION(CONFIG_EVENT_TRACING, 8, ftrace_events)
+#define BRANCH_PROFILE() \
+ DEF_SECTION_SYM(CONFIG_PROFILE_ALL_BRANCHES, 1, _ftrace_branch, branch_profile)
+#define TRACE_PRINTKS() \
+ DEF_SECTION_SYM(CONFIG_TRACING, 1, __trace_printk_fmt, __trace_bprintk_fmt)
+#define TRACEPOINT_STR() \
+ DEF_SECTION(CONFIG_TRACING, 1, __tracepoint_str)
+#define TRACE_SYSCALLS() \
+ DEF_SECTION_SYM(CONFIG_FTRACE_SYSCALLS, 8, __syscalls_metadata, syscalls_metadata)
#define ___OF_TABLE(cfg, name) _OF_TABLE_##cfg(name)
#define __OF_TABLE(cfg, name) ___OF_TABLE(cfg, name)
--
1.8.3.2
next prev parent reply other threads:[~2014-03-27 19:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-27 19:41 [RFC PATCH 0/4] vmlinux.lds.h clean-ups Rob Herring
2014-03-27 19:41 ` [RFC PATCH 1/4] irqchip: align irqchip OF match table section naming Rob Herring
2014-03-27 19:41 ` Rob Herring
2014-03-27 19:41 ` [RFC PATCH 2/4] ARM: align cpu_method_of_table naming Rob Herring
2014-03-27 19:41 ` [RFC PATCH 3/4] vmlinuz.lds: define OF table sections with macros Rob Herring
2014-03-27 19:41 ` Rob Herring
2014-03-27 19:41 ` Rob Herring [this message]
2014-04-15 20:34 ` [RFC PATCH 0/4] vmlinux.lds.h clean-ups Rob Herring
2014-04-24 13:23 ` Arnd Bergmann
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=1395949317-8738-5-git-send-email-robherring2@gmail.com \
--to=robherring2@gmail.com \
--cc=arnd@arndb.de \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=robh@kernel.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;
as well as URLs for NNTP newsgroup(s).