list_for_each_entry(insn, &file->static_call_list, call_node)
idx++;
- sec = elf_create_section(file->elf, ".static_call_sites", SHF_WRITE,
+ sec = elf_create_section(file->elf, ".static_call_sites",
sizeof(struct static_call_site), idx);
if (!sec)
return -1;
+ /* Allow modules to set the low bits of static_call_site::key */
+ sec->sh.sh_flags |= SHF_WRITE;
+
idx = 0;
list_for_each_entry(insn, &file->static_call_list, call_node) {
if (!idx)
return 0;
- sec = elf_create_section(file->elf, ".retpoline_sites", 0,
+ sec = elf_create_section(file->elf, ".retpoline_sites",
sizeof(int), idx);
if (!sec) {
WARN("elf_create_section: .retpoline_sites");
if (!idx)
return 0;
- sec = elf_create_section(file->elf, ".return_sites", 0,
+ sec = elf_create_section(file->elf, ".return_sites",
sizeof(int), idx);
if (!sec) {
WARN("elf_create_section: .return_sites");
if (!idx)
return 0;
- sec = elf_create_section(file->elf, ".ibt_endbr_seal", 0,
+ sec = elf_create_section(file->elf, ".ibt_endbr_seal",
sizeof(int), idx);
if (!sec) {
WARN("elf_create_section: .ibt_endbr_seal");
idx++;
}
- sec = elf_create_section(file->elf, ".cfi_sites", 0, sizeof(unsigned int), idx);
+ sec = elf_create_section(file->elf, ".cfi_sites", sizeof(unsigned int), idx);
if (!sec)
return -1;
list_for_each_entry(insn, &file->mcount_loc_list, call_node)
idx++;
- sec = elf_create_section(file->elf, "__mcount_loc", 0, addrsize, idx);
+ sec = elf_create_section(file->elf, "__mcount_loc", addrsize, idx);
if (!sec)
return -1;
list_for_each_entry(insn, &file->call_list, call_node)
idx++;
- sec = elf_create_section(file->elf, ".call_sites", 0, sizeof(unsigned int), idx);
+ sec = elf_create_section(file->elf, ".call_sites", sizeof(unsigned int), idx);
if (!sec)
return -1;
}
struct section *elf_create_section(struct elf *elf, const char *name,
- unsigned int sh_flags, size_t entsize, int nr)
+ size_t entsize, int nr)
{
struct section *sec, *shstrtab;
size_t size = entsize * nr;
sec->sh.sh_entsize = entsize;
sec->sh.sh_type = SHT_PROGBITS;
sec->sh.sh_addralign = 1;
- sec->sh.sh_flags = SHF_ALLOC | sh_flags;
+ sec->sh.sh_flags = SHF_ALLOC;
/* Add section name to .shstrtab (or .strtab for Clang) */
shstrtab = find_section_by_name(elf, ".shstrtab");
strcpy(relocname, ".rel");
strcat(relocname, base->name);
- sec = elf_create_section(elf, relocname, 0, sizeof(GElf_Rel), 0);
+ sec = elf_create_section(elf, relocname, sizeof(GElf_Rel), 0);
free(relocname);
if (!sec)
return NULL;
strcat(relocname, base->name);
if (addrsize == sizeof(u32))
- sec = elf_create_section(elf, relocname, 0, sizeof(Elf32_Rela), 0);
+ sec = elf_create_section(elf, relocname, sizeof(Elf32_Rela), 0);
else
- sec = elf_create_section(elf, relocname, 0, sizeof(GElf_Rela), 0);
+ sec = elf_create_section(elf, relocname, sizeof(GElf_Rela), 0);
free(relocname);
if (!sec)
return NULL;
};
struct elf *elf_open_read(const char *name, int flags);
-struct section *elf_create_section(struct elf *elf, const char *name, unsigned int sh_flags, size_t entsize, int nr);
+struct section *elf_create_section(struct elf *elf, const char *name, size_t entsize, int nr);
struct symbol *elf_create_prefix_symbol(struct elf *elf, struct symbol *orig, long size);
WARN("file already has .orc_unwind section, skipping");
return -1;
}
- orc_sec = elf_create_section(file->elf, ".orc_unwind", 0,
+ orc_sec = elf_create_section(file->elf, ".orc_unwind",
sizeof(struct orc_entry), nr);
if (!orc_sec)
return -1;
- sec = elf_create_section(file->elf, ".orc_unwind_ip", 0, sizeof(int), nr);
+ sec = elf_create_section(file->elf, ".orc_unwind_ip", sizeof(int), nr);
if (!sec)
return -1;