x86/static_call: Add inline static call implementation for x86-64
Add the inline static call implementation for x86-64. The generated code is identical to the out-of-line case, except we move the trampoline into it's own section. Objtool uses the trampoline naming convention to detect all the call sites. It then annotates those call sites in the .static_call_sites section. During boot (and module init), the call sites are patched to call directly into the destination function. The temporary trampoline is then no longer used. [peterz: merged trampolines, put trampoline in section] Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: https://lore.kernel.org/r/20200818135804.864271425@infradead.org
This commit is contained in:

committed by
Ingo Molnar

parent
e6d6c071f2
commit
1e7e478838
@@ -652,7 +652,7 @@ err:
|
||||
}
|
||||
|
||||
struct section *elf_create_section(struct elf *elf, const char *name,
|
||||
size_t entsize, int nr)
|
||||
unsigned int sh_flags, size_t entsize, int nr)
|
||||
{
|
||||
struct section *sec, *shstrtab;
|
||||
size_t size = entsize * nr;
|
||||
@@ -712,7 +712,7 @@ struct section *elf_create_section(struct elf *elf, const char *name,
|
||||
sec->sh.sh_entsize = entsize;
|
||||
sec->sh.sh_type = SHT_PROGBITS;
|
||||
sec->sh.sh_addralign = 1;
|
||||
sec->sh.sh_flags = SHF_ALLOC;
|
||||
sec->sh.sh_flags = SHF_ALLOC | sh_flags;
|
||||
|
||||
|
||||
/* Add section name to .shstrtab (or .strtab for Clang) */
|
||||
@@ -767,7 +767,7 @@ static struct section *elf_create_rel_reloc_section(struct elf *elf, struct sect
|
||||
strcpy(relocname, ".rel");
|
||||
strcat(relocname, base->name);
|
||||
|
||||
sec = elf_create_section(elf, relocname, sizeof(GElf_Rel), 0);
|
||||
sec = elf_create_section(elf, relocname, 0, sizeof(GElf_Rel), 0);
|
||||
free(relocname);
|
||||
if (!sec)
|
||||
return NULL;
|
||||
@@ -797,7 +797,7 @@ static struct section *elf_create_rela_reloc_section(struct elf *elf, struct sec
|
||||
strcpy(relocname, ".rela");
|
||||
strcat(relocname, base->name);
|
||||
|
||||
sec = elf_create_section(elf, relocname, sizeof(GElf_Rela), 0);
|
||||
sec = elf_create_section(elf, relocname, 0, sizeof(GElf_Rela), 0);
|
||||
free(relocname);
|
||||
if (!sec)
|
||||
return NULL;
|
||||
|
Reference in New Issue
Block a user