[PATCH 0/2] ftrace/recordmcount: Handle object files without section symbols
From: Naveen N. Rao
Date: Wed Apr 27 2022 - 06:58:37 EST
This solves a build issue on powerpc with binutils v2.36 and newer .
Since commit d1bcae833b32f1 ("ELF: Don't generate unused section
symbols") , binutils started dropping section symbols that it thought
were unused. Due to this, in certain scenarios, recordmcount is unable
to find a non-weak symbol to generate a relocation record against.
Clang integrated assembler is also aggressive in dropping section
In the past, there have been various workarounds to address this. See
commits 55d5b7dd6451b5 ("initramfs: fix clang build failure") and
6e7b64b9dd6d96 ("elfcore: fix building with clang") and a recent patch:
Fix this issue by using the weak symbol in the relocation record. This
can result in duplicate locations in the mcount table if those weak
functions are overridden, so have ftrace skip dupicate entries.
Objtool already follows this approach, so patch 2 updates recordmcount
to do the same. Patch 1 updates ftrace to skip duplicate entries.
Naveen N. Rao (2):
ftrace: Drop duplicate mcount locations
recordmcount: Handle sections with no non-weak symbols
kernel/trace/ftrace.c | 13 ++++++-
scripts/recordmcount.h | 86 +++++++++++++++++++++++++++++++++++-------
2 files changed, 85 insertions(+), 14 deletions(-)