list_for_each_entry(sec, &kelf->sections, list) {
/* include these sections even if they haven't changed */
- if (is_standard_section(sec) ||
- should_include_str_section(sec->name)) {
+ if (is_standard_section(sec)) {
sec->include = 1;
if (sec->secsym)
sec->secsym->include = 1;
list_entry(kelf->symbols.next, struct symbol, list)->include = 1;
}
+static void kpatch_include_standard_string_elements(struct kpatch_elf *kelf)
+{
+ struct section *sec;
+
+ list_for_each_entry(sec, &kelf->sections, list) {
+ if (should_include_str_section(sec->name) &&
+ is_referenced_section(sec, kelf)) {
+ sec->include = 1;
+ if (sec->secsym)
+ sec->secsym->include = 1;
+ }
+ }
+}
+
#define inc_printf(fmt, ...) \
log_debug("%*s" fmt, recurselevel, "", ##__VA_ARGS__);
errs++;
}
+ 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++;
+ }
+ }
+ }
+
/*
* ensure we aren't including .data.* or .bss.*
* (.data.unlikely is ok b/c it only has __warned vars)
kpatch_include_debug_sections(kelf_patched);
log_debug("Include hook elements\n");
kpatch_include_hook_elements(kelf_patched);
+ log_debug("Include standard string elements\n");
+ kpatch_include_standard_string_elements(kelf_patched);
log_debug("Include new globals\n");
new_globals_exist = kpatch_include_new_globals(kelf_patched);
log_debug("new_globals_exist = %d\n", new_globals_exist);