@@ -249,6 +249,13 @@ int is_text_section(struct section *sec)
(sec->sh.sh_flags & SHF_EXECINSTR));
}
+int is_rodata_section(struct section *sec)
+{
+ return sec->sh.sh_type == SHT_PROGBITS &&
+ !(sec->sh.sh_flags & (SHF_EXECINSTR | SHF_WRITE)) &&
+ !strncmp(sec->name, ".rodata", 7);
+}
+
int is_debug_section(struct section *sec)
{
char *name;
@@ -159,6 +159,7 @@ struct symbol *find_symbol_by_index(struct list_head *list, size_t index);
struct symbol *find_symbol_by_name(struct list_head *list, const char *name);
int is_text_section(struct section *sec);
+int is_rodata_section(struct section *sec);
int is_debug_section(struct section *sec);
int is_rela_section(struct section *sec);
int is_standard_section(struct section *sec);
@@ -1672,13 +1672,12 @@ static void kpatch_verify_patchability(struct kpatch_elf *kelf)
}
if (sec->include) {
- if (!is_standard_section(sec) && !is_rela_section(sec) &&
- !is_debug_section(sec) && !is_special_section(sec)) {
- if (!is_referenced_section(sec, kelf)) {
- log_normal("section %s included, but not referenced\n",
- sec->name);
- errs++;
- }
+ if (is_rodata_section(sec) &&
+ !is_special_section(sec) &&
+ !is_referenced_section(sec, kelf)) {
+ log_normal(".rodata section %s included, but not referenced\n",
+ sec->name);
+ errs++;
}
/* Check if a RELA section does not contain any entries with