list_for_each_entry(insn, &file->retpoline_call_list, call_node) {
struct symbol *sym = insn->sym;
- if (sym && (sym->type == STT_NOTYPE ||
- sym->type == STT_FUNC) && !sym->nocfi) {
+ if (sym && (is_notype_sym(sym) ||
+ is_func_sym(sym)) && !sym->nocfi) {
struct instruction *prev =
prev_insn_same_sym(file, insn);
* If the relocation symbol is a section name (for example ".bss")
* then we try to further resolve the name.
*/
- if (reloc->sym->type == STT_SECTION) {
+ if (is_sec_sym(reloc->sym)) {
str = offstr(reloc->sym->sec, reloc->sym->offset + offset);
DINFO_FPRINTF(dinfo, bfd_vma_fmt, addr, str);
free(str);
*/
dinfo->buffer = insn->sec->data->d_buf;
dinfo->buffer_vma = 0;
- dinfo->buffer_length = insn->sec->sh.sh_size;
+ dinfo->buffer_length = sec_size(insn->sec);
return disasm(insn->offset, &dctx->info);
}
for_each_sec(dctx->file->elf, sec) {
- if (!(sec->sh.sh_flags & SHF_EXECINSTR))
+ if (!is_text_sec(sec))
continue;
sec_for_each_sym(sec, sym) {
if (elf_add_symbol(elf, sym))
return -1;
- if (sym->type == STT_FILE)
+ if (is_file_sym(sym))
file = sym;
else if (sym->bind == STB_LOCAL)
sym->file = file;
return -1;
}
- offset = ALIGN(strtab->sh.sh_size, strtab->sh.sh_addralign);
+ offset = ALIGN(sec_size(strtab), strtab->sh.sh_addralign);
if (!elf_add_data(elf, strtab, str, strlen(str) + 1))
return -1;
sec->data->d_size = size;
sec->data->d_align = 1;
- offset = ALIGN(sec->sh.sh_size, sec->sh.sh_addralign);
+ offset = ALIGN(sec_size(sec), sec->sh.sh_addralign);
sec->sh.sh_size = offset + size;
mark_sec_changed(elf, sec, true);
*/
static bool is_clang_tmp_label(struct symbol *sym)
{
- return sym->type == STT_NOTYPE &&
+ return is_notype_sym(sym) &&
is_text_sec(sym->sec) &&
strstarts(sym->name, ".Ltmp") &&
isdigit(sym->name[5]);
if (sym->bind != STB_LOCAL)
return 0;
- if (vmlinux && sym->type == STT_FUNC) {
+ if (vmlinux && is_func_sym(sym)) {
/*
* HACK: Unfortunately, symbol ordering can differ between
* vmlinux.o and vmlinux due to the linker script emitting
sec->name, offset, patched_sym->name, \
addend >= 0 ? "+" : "-", labs(addend), \
sym_type(patched_sym), \
- patched_sym->type == STT_SECTION ? "" : " ", \
- patched_sym->type == STT_SECTION ? "" : sym_bind(patched_sym), \
+ is_sec_sym(patched_sym) ? "" : " ", \
+ is_sec_sym(patched_sym) ? "" : sym_bind(patched_sym), \
is_undef_sym(patched_sym) ? " UNDEF" : "", \
export ? " EXPORTED" : "", \
klp ? " KLP" : "")