On Mon, Jun 09, 2025 at 02:32:19PM -0400, Joe Lawrence wrote:
> On Fri, May 09, 2025 at 01:17:16PM -0700, Josh Poimboeuf wrote:
> > +static int validate_ffunction_fdata_sections(struct elf *elf)
> > +{
> > + struct symbol *sym;
> > + bool found_text = false, found_data = false;
> > +
> > + for_each_sym(elf, sym) {
> > + char sec_name[SEC_NAME_LEN];
> > +
> > + if (!found_text && is_func_sym(sym)) {
> > + snprintf(sec_name, SEC_NAME_LEN, ".text.%s", sym->name);
> > + if (!strcmp(sym->sec->name, sec_name))
> > + found_text = true;
> > + }
> > +
> > + if (!found_data && is_object_sym(sym)) {
> > + snprintf(sec_name, SEC_NAME_LEN, ".data.%s", sym->name);
> > + if (!strcmp(sym->sec->name, sec_name))
> > + found_data = true;
>
> Hi Josh,
>
> Should we check for other data section prefixes here, like:
>
> else {
> snprintf(sec_name, SEC_NAME_LEN, ".rodata.%s",
> sym->name);
> if (!strcmp(sym->sec->name, sec_name))
> found_data = true;
> }
Indeed. And also .bss.*.
> At the same time, while we're here, what about other .text.* section
> prefixes?
AFAIK, .text.* is the only one.
--
Josh