On Tue, Jun 10, 2025 at 08:39:10AM -0400, Joe Lawrence wrote:
> >> 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.
> > 
> 
> What about .text.unlikely, .text.hot (not sure if these can come alone
> or are only optimization copies) ?

Hm, I think .text.unlikely.foo is at least theoretically possible
without .text.foo.  Seems "unlikely" though.

IIRC, .text.hot is used for profile-guided optimization, probably not a
concern here.

There are actually several edge cases that would cause this validation
to fail.  If a module only had init/exit then it wouldn't have any
.text.foo.  Or if it didn't have global data then there'd be no
.[ro]data.foo.

This function could get pretty fiddly, and honestly I'm not sure this
validation buys us much anyway.  I'm thinking about just removing it
altogether...

-- 
Josh

Reply via email to