On 6/9/25 7:21 PM, Josh Poimboeuf wrote:
> 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.
> 

What about .text.unlikely, .text.hot (not sure if these can come alone
or are only optimization copies) ?

-- 
Joe


Reply via email to