lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1395949317-8738-5-git-send-email-robherring2@gmail.com>
Date:	Thu, 27 Mar 2014 14:41:57 -0500
From:	Rob Herring <robherring2@...il.com>
To:	Arnd Bergmann <arnd@...db.de>
Cc:	linux-arch@...r.kernel.org, linux-kernel@...r.kernel.org,
	Russell King <linux@....linux.org.uk>,
	Rob Herring <robh@...nel.org>
Subject: [RFC PATCH 4/4] vmlinux.lds: define conditional sections with macros

From: Rob Herring <robh@...nel.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@...nel.org>
Cc: Arnd Bergmann <arnd@...db.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

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ