create-diff-object: support tracepoints and related sections

Add support for the following special sections:

- __jump_table
- __tracepoints
- __tracepoints_ptrs
- __tracepoints_strings

Fixes #157.
This commit is contained in:
Josh Poimboeuf 2014-05-23 07:43:07 -05:00
parent 698cc1c137
commit 92a4ca2621
2 changed files with 24 additions and 3 deletions

View File

@ -997,6 +997,7 @@ int smp_locks_group_size(struct section *sec, int offset) { return 4; }
int parainstructions_group_size(struct section *sec, int offset) { return 16; }
int ex_table_group_size(struct section *sec, int offset) { return 8; }
int altinstructions_group_size(struct section *sec, int offset) { return 12; }
int jump_table_group_size(struct section *sec, int offset) { return 24; }
int fixup_group_size(struct section *sec, int offset)
{
@ -1035,6 +1036,10 @@ struct special_section special_sections[] = {
.name = "__ex_table",
.group_size = ex_table_group_size,
},
{
.name = "__jump_table",
.group_size = jump_table_group_size,
},
{
.name = ".altinstructions",
.group_size = altinstructions_group_size,
@ -1167,11 +1172,14 @@ void kpatch_process_special_sections(struct kpatch_elf *kelf)
}
/*
* The following special section doesn't have relas which reference
* non-included symbols, so its entire rela section can be included.
* The following special sections don't have relas which reference
* non-included symbols, so their entire rela section can be included.
*/
list_for_each_entry(sec, &kelf->sections, list) {
if (strcmp(sec->name, ".altinstr_replacement"))
if (strcmp(sec->name, ".altinstr_replacement") &&
strcmp(sec->name, "__tracepoints") &&
strcmp(sec->name, "__tracepoints_ptrs") &&
strcmp(sec->name, "__tracepoints_strings"))
continue;
/* include base section */

View File

@ -0,0 +1,13 @@
Index: src/kernel/timer.c
===================================================================
--- src.orig/kernel/timer.c
+++ src/kernel/timer.c
@@ -1370,6 +1370,8 @@ static void run_timer_softirq(struct sof
{
struct tvec_base *base = __this_cpu_read(tvec_bases);
+ printk("kpatch-test: testing __tracepoints section changes\n");
+
hrtimer_run_pending();
if (time_after_eq(jiffies, base->timer_jiffies))