diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2010-07-16 10:30:06 -0400 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2010-07-16 11:50:35 -0400 |
commit | 136a08dbe8c28e751b01e932420f715edb229f6b (patch) | |
tree | c988a0025de9455b622aabd0d3cc98596284060a /arch/x86/kernel | |
parent | cbc5d49e4973400737aab50b60dc5d86e71f5420 (diff) |
Bugfix: avoid link error in Feather-Trace on x86
If no events are defined but Feater-Trace support is enabled, then the current
implementation generates a link error because the __event_table sections is
absent.
> arch/x86/built-in.o: In function `ft_disable_all_events':
> (.text+0x242af): undefined reference to `__start___event_table'
As a simple work around, we force zero-element array to always be "allocated"
in the __event_table section. This ensures that we end up with a zero-byte
section if no events are enabled, and does not affect the layout of the section
if events are present.
> bbb@ludwig:~/dev/litmus2010$ nm vmlinux | grep event_table
> ffffffff81950cdc D __event_table_dummy
> ffffffff81950cdc A __start___event_table
> ffffffff81950cdc A __stop___event_table
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r-- | arch/x86/kernel/ft_event.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/x86/kernel/ft_event.c b/arch/x86/kernel/ft_event.c index 6552e2741ecf..37cc33252713 100644 --- a/arch/x86/kernel/ft_event.c +++ b/arch/x86/kernel/ft_event.c | |||
@@ -22,6 +22,13 @@ struct trace_event { | |||
22 | extern struct trace_event __start___event_table[]; | 22 | extern struct trace_event __start___event_table[]; |
23 | extern struct trace_event __stop___event_table[]; | 23 | extern struct trace_event __stop___event_table[]; |
24 | 24 | ||
25 | /* Workaround: if no events are defined, then the event_table section does not | ||
26 | * exist and the above references cause linker errors. This could probably be | ||
27 | * fixed by adjusting the linker script, but it is easier to maintain for us if | ||
28 | * we simply create a dummy symbol in the event table section. | ||
29 | */ | ||
30 | int __event_table_dummy[0] __attribute__ ((section("__event_table"))); | ||
31 | |||
25 | int ft_enable_event(unsigned long id) | 32 | int ft_enable_event(unsigned long id) |
26 | { | 33 | { |
27 | struct trace_event* te = __start___event_table; | 34 | struct trace_event* te = __start___event_table; |