On 4/16/19 1:07 PM, Pawel Wieczorkiewicz wrote:
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 <wipa...@amazon.de>
Reviewed-by: Andra-Irina Paraschiv <andra...@amazon.com>
Reviewed-by: Bjoern Doebel <doe...@amazon.de>
Reviewed-by: Norbert Manthey <nmant...@amazon.de>
---
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)
const for the parameter?
+{
+ 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;
Wouldn't it be better to reuse the existing special_sections array
rather than partially duplicating it here?
+
+ for (special = names; special->name; special++) {
+ if (!strncmp(sec->name, special->name, strlen(special->name)))
+ return true;
This check is not as precise as it could be, since ".altinstructionsfoo"
would be considered special when it actually means nothing to this tool.
--
Ross Lagerwall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel