Skip to content

Commit e4799a8

Browse files
authored
Merge pull request dynup#1456 from liu-song-6/log_error
CDO: Introduce log_error()
2 parents e156795 + b35c04f commit e4799a8

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

kpatch-build/create-diff-object.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,8 +1700,8 @@ static void kpatch_check_func_profiling_calls(struct kpatch_elf *kelf)
17001700
(sym->parent && sym->parent->status == CHANGED))
17011701
continue;
17021702
if (!sym->twin->has_func_profiling) {
1703-
log_normal("function %s has no fentry/mcount call, unable to patch\n",
1704-
sym->name);
1703+
log_error("function %s has no fentry/mcount call, unable to patch\n",
1704+
sym->name);
17051705
errs++;
17061706
}
17071707
}
@@ -1717,19 +1717,19 @@ static void kpatch_verify_patchability(struct kpatch_elf *kelf)
17171717

17181718
list_for_each_entry(sec, &kelf->sections, list) {
17191719
if (sec->status == CHANGED && !sec->include) {
1720-
log_normal("changed section %s not selected for inclusion\n",
1721-
sec->name);
1720+
log_error("changed section %s not selected for inclusion\n",
1721+
sec->name);
17221722
errs++;
17231723
}
17241724

17251725
if (sec->status != SAME && sec->grouped) {
1726-
log_normal("changed section %s is part of a section group\n",
1727-
sec->name);
1726+
log_error("changed section %s is part of a section group\n",
1727+
sec->name);
17281728
errs++;
17291729
}
17301730

17311731
if (sec->sh.sh_type == SHT_GROUP && sec->status == NEW) {
1732-
log_normal("new/changed group sections are not supported\n");
1732+
log_error("new/changed group sections are not supported\n");
17331733
errs++;
17341734
}
17351735

@@ -1742,7 +1742,7 @@ static void kpatch_verify_patchability(struct kpatch_elf *kelf)
17421742
(!strncmp(sec->name, ".data", 5) || !strncmp(sec->name, ".bss", 4)) &&
17431743
(strcmp(sec->name, ".data.unlikely") && strcmp(sec->name, ".data..unlikely") &&
17441744
strcmp(sec->name, ".data.once") && strcmp(sec->name, ".data..once"))) {
1745-
log_normal("data section %s selected for inclusion\n",
1745+
log_error("data section %s selected for inclusion\n",
17461746
sec->name);
17471747
errs++;
17481748
}
@@ -2310,8 +2310,8 @@ static bool jump_table_group_filter(struct lookup_table *lookup,
23102310
* This will be upgraded to an error after all jump labels have
23112311
* been reported.
23122312
*/
2313-
log_normal("Found a jump label at %s()+0x%lx, using key %s. Jump labels aren't supported with this kernel. Use static_key_enabled() instead.\n",
2314-
code->sym->name, code->addend, key->sym->name);
2313+
log_error("Found a jump label at %s()+0x%lx, using key %s. Jump labels aren't supported with this kernel. Use static_key_enabled() instead.\n",
2314+
code->sym->name, code->addend, key->sym->name);
23152315
jump_label_errors++;
23162316
return false;
23172317
}
@@ -2340,8 +2340,8 @@ static bool jump_table_group_filter(struct lookup_table *lookup,
23402340
* This will be upgraded to an error after all jump label
23412341
* errors have been reported.
23422342
*/
2343-
log_normal("Found a jump label at %s()+0x%lx, using key %s, which is defined in a module. Use static_key_enabled() instead.\n",
2344-
code->sym->name, code->addend, key->sym->name);
2343+
log_error("Found a jump label at %s()+0x%lx, using key %s, which is defined in a module. Use static_key_enabled() instead.\n",
2344+
code->sym->name, code->addend, key->sym->name);
23452345
jump_label_errors++;
23462346
return false;
23472347
}
@@ -2411,7 +2411,7 @@ static bool static_call_sites_group_filter(struct lookup_table *lookup,
24112411
* This will be upgraded to an error after all static call
24122412
* errors have been reported.
24132413
*/
2414-
log_normal("Found a static call at %s()+0x%lx, using key %s, which is defined in a module. Use KPATCH_STATIC_CALL() instead.\n",
2414+
log_error("Found a static call at %s()+0x%lx, using key %s, which is defined in a module. Use KPATCH_STATIC_CALL() instead.\n",
24152415
code->sym->name, code->addend, key->sym->name);
24162416
static_call_errors++;
24172417
return false;
@@ -4023,8 +4023,8 @@ static void kpatch_no_sibling_calls_ppc64le(struct kpatch_elf *kelf)
40234023
if (!find_rela_by_offset(sym->sec->rela, offset))
40244024
continue;
40254025

4026-
log_normal("Found an unsupported sibling call at %s()+0x%lx. Add __attribute__((optimize(\"-fno-optimize-sibling-calls\"))) to %s() definition.\n",
4027-
sym->name, sym->sym.st_value + offset, sym->name);
4026+
log_error("Found an unsupported sibling call at %s()+0x%lx. Add __attribute__((optimize(\"-fno-optimize-sibling-calls\"))) to %s() definition.\n",
4027+
sym->name, sym->sym.st_value + offset, sym->name);
40284028
sibling_call_errors++;
40294029
}
40304030
}

kpatch-build/log.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ extern char *childobj;
2020
printf(format, ##__VA_ARGS__); \
2121
})
2222

23+
#define log_error(format, ...) \
24+
({ \
25+
fprintf(stderr, "ERROR: " format, ##__VA_ARGS__); \
26+
})
27+
2328
enum loglevel {
2429
DEBUG,
2530
NORMAL

0 commit comments

Comments
 (0)