mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-18 03:06:43 +00:00
objtool: Fix __mcount_loc generation with Clang's assembler
When objtool generates relocations for the __mcount_loc section, it tries to reference __fentry__ calls by their section symbol offset. However, this fails with Clang's integrated assembler as it may not generate section symbols for every section. This patch looks up a function symbol instead if the section symbol is missing, similarly to commit e81e07244325 ("objtool: Support Clang non-section symbols in ORC generation"). Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
This commit is contained in:
parent
99d0021569
commit
18a14575ae
@ -573,8 +573,21 @@ static int create_mcount_loc_sections(struct objtool_file *file)
|
|||||||
}
|
}
|
||||||
memset(reloc, 0, sizeof(*reloc));
|
memset(reloc, 0, sizeof(*reloc));
|
||||||
|
|
||||||
|
if (insn->sec->sym) {
|
||||||
reloc->sym = insn->sec->sym;
|
reloc->sym = insn->sec->sym;
|
||||||
reloc->addend = insn->offset;
|
reloc->addend = insn->offset;
|
||||||
|
} else {
|
||||||
|
reloc->sym = find_symbol_containing(insn->sec, insn->offset);
|
||||||
|
|
||||||
|
if (!reloc->sym) {
|
||||||
|
WARN("missing symbol for insn at offset 0x%lx\n",
|
||||||
|
insn->offset);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
reloc->addend = insn->offset - reloc->sym->offset;
|
||||||
|
}
|
||||||
|
|
||||||
reloc->type = R_X86_64_64;
|
reloc->type = R_X86_64_64;
|
||||||
reloc->offset = idx * sizeof(unsigned long);
|
reloc->offset = idx * sizeof(unsigned long);
|
||||||
reloc->sec = reloc_sec;
|
reloc->sec = reloc_sec;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user