From b2e3e658b344c6bcfb8fb694100ab2f2b5b2edb0 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 13 Feb 2008 15:03:39 -0800 Subject: Linux Kernel Markers: create modpost file This adds some new magic in the MODPOST phase for CONFIG_MARKERS. Analogous to the Module.symvers file, the build will now write a Module.markers file when CONFIG_MARKERS=y is set. This file lists the name, defining module, and format string of each marker, separated by \t characters. This simple text file can be used by offline build procedures for instrumentation code, analogous to how System.map and Module.symvers can be useful to have for kernels other than the one you are running right now. The strings are made easy to extract by having the __trace_mark macro define the name and format together in a single array called __mstrtab_* in the __markers_strings section. This is straightforward and reliable as long as the marker structs are always defined by this macro. It is an unreasonable amount of hairy work to extract the string pointers from the __markers section structs, which entails handling a relocation type for every machine under the sun. Mathieu : - Ran through checkpatch.pl Signed-off-by: Roland McGrath Signed-off-by: Mathieu Desnoyers Cc: David Smith Cc: Sam Ravnborg Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/marker.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'include/linux/marker.h') diff --git a/include/linux/marker.h b/include/linux/marker.h index b5f95637f289..5df879dc3776 100644 --- a/include/linux/marker.h +++ b/include/linux/marker.h @@ -61,15 +61,12 @@ struct marker { */ #define __trace_mark(name, call_private, format, args...) \ do { \ - static const char __mstrtab_name_##name[] \ + static const char __mstrtab_##name[] \ __attribute__((section("__markers_strings"))) \ - = #name; \ - static const char __mstrtab_format_##name[] \ - __attribute__((section("__markers_strings"))) \ - = format; \ + = #name "\0" format; \ static struct marker __mark_##name \ __attribute__((section("__markers"), aligned(8))) = \ - { __mstrtab_name_##name, __mstrtab_format_##name, \ + { __mstrtab_##name, &__mstrtab_##name[sizeof(#name)], \ 0, 0, marker_probe_cb, \ { __mark_empty_function, NULL}, NULL }; \ __mark_check_format(format, ## args); \ -- cgit v1.2.3-59-g8ed1b