|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [livepatch-build-tools part2 3/6] create-diff-object: Add is_special_section() helper function
This function determines, based on the given section name, if the
sections belongs to the special sections category.
It treats a name from the special_sections array as a prefix. Any
sections whose name starts with special section prefix is considered
a special section.
Signed-off-by: Pawel Wieczorkiewicz <wipawel@xxxxxxxxx>
Reviewed-by: Andra-Irina Paraschiv <andraprs@xxxxxxxxxx>
Reviewed-by: Bjoern Doebel <doebel@xxxxxxxxx>
Reviewed-by: Norbert Manthey <nmanthey@xxxxxxxxx>
---
common.c | 23 +++++++++++++++++++++++
common.h | 1 +
2 files changed, 24 insertions(+)
diff --git a/common.c b/common.c
index c968299..a2c860b 100644
--- a/common.c
+++ b/common.c
@@ -290,6 +290,29 @@ int is_referenced_section(const struct section *sec, const
struct kpatch_elf *ke
return false;
}
+int is_special_section(struct section *sec)
+{
+ static struct special_section_names {
+ const char *name;
+ } names[] = {
+ { .name = ".bug_frames" },
+ { .name = ".fixup" },
+ { .name = ".ex_table" },
+ { .name = ".altinstructions" },
+ { .name = ".altinstr_replacement" },
+ { .name = ".livepatch.hooks" },
+ { .name = NULL },
+ };
+ struct special_section_names *special;
+
+ for (special = names; special->name; special++) {
+ if (!strncmp(sec->name, special->name, strlen(special->name)))
+ return true;
+ }
+
+ return false;
+}
+
/* returns the offset of the string in the string table */
int offset_of_string(struct list_head *list, char *name)
{
diff --git a/common.h b/common.h
index affe16b..6d38e88 100644
--- a/common.h
+++ b/common.h
@@ -152,6 +152,7 @@ int is_debug_section(struct section *sec);
int is_rela_section(struct section *sec);
int is_standard_section(struct section *sec);
int is_referenced_section(const struct section *sec, const struct kpatch_elf
*kelf);
+int is_special_section(struct section *sec);
int is_local_sym(struct symbol *sym);
void rela_insn(struct section *sec, struct rela *rela, struct insn *insn);
--
2.16.5
Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrer: Christian Schlaeger, Ralf Herbrich
Ust-ID: DE 289 237 879
Eingetragen am Amtsgericht Charlottenburg HRB 149173 B
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |