"offset", "%#"PRIx64, NULL, NULL},
[sec_rela] = {".rela", "relocation", "%"PRId64,
"offset", "%#"PRIx64, NULL, NULL},
-
- [sec_text] = {"(exec data)", NULL, NULL, NULL, NULL, NULL, NULL},
};
static struct section_info special_formats[] =
else
wr_error (NULL, "Multiple occurrences of section %s.\n", scnname);
}
- else if ((shdr->sh_flags & SHF_ALLOC) && (shdr->sh_flags & SHF_EXECINSTR))
- cursec->id = sec_text;
else if (shdr->sh_type == SHT_RELA || shdr->sh_type == SHT_REL)
{
/* Get data of section that this REL(A) section relocates. */
/* It's target value, not section offset. */
if (offset_into == rel_value
- || offset_into == rel_address)
+ || offset_into == rel_address
+ || offset_into == rel_exec)
{
/* If a target value is what's expected, then complain if
it's not either SHN_ABS, an SHF_ALLOC section, or
wr_error (&reloc_where,
": couldn't obtain header of associated section #%" PRId64 ".\n",
section_index);
- else if ((shdr->sh_flags & SHF_ALLOC) != SHF_ALLOC)
- wr_message (mc_reloc | mc_impact_3, &reloc_where,
- ": associated section #%" PRId64 " isn't SHF_ALLOC.\n",
- section_index);
+ else
+ {
+ if ((shdr->sh_flags & SHF_ALLOC) != SHF_ALLOC)
+ wr_message (mc_reloc | mc_impact_3, &reloc_where,
+ ": associated section %s isn't SHF_ALLOC.\n",
+ reloc->file->sec[section_index].name);
+ if (offset_into == rel_exec
+ && (shdr->sh_flags & SHF_EXECINSTR) != SHF_EXECINSTR)
+ /* This may still be kosher, but it's suspicious. */
+ wr_message (mc_reloc | mc_impact_2, &reloc_where,
+ ": relocation against %s is suspicious, expected executable section.\n",
+ reloc->file->sec[section_index].name);
+ }
}
}
else
case DW_AT_low_pc:
case DW_AT_high_pc:
case DW_AT_entry_pc:
- return sec_text;
+ return rel_exec;
case DW_AT_const_value:
/* Appears in some kernel modules. It's not allowed by the
{
address_relocated = true;
relocate_one (&data->rel, rel, address_size,
- &address, &where, sec_text, NULL);
+ &address, &where, rel_address, NULL);
}
else if (data->file->ehdr.e_type == ET_REL
&& address != 0)