[PATCH v12 02/25] Object Attributes v2: new abstractions for subsections and attributes

Matthieu Longo matthieu.longo@arm.com
Mon Jan 26 11:37:22 GMT 2026


On 23/01/2026 23:41, Alan Modra wrote:
> On Fri, Jan 23, 2026 at 03:17:16PM +0100, Jan Beulich wrote:
>> On 23.01.2026 13:17, Matthieu Longo wrote:
>>> On 23/01/2026 11:24, Maciej W. Rozycki wrote:
>>>>    This patch caused hundreds of regressions for `csky-elf' and `csky-linux'
>>>> making the targets unusable:
>>>>
>>>> .../gas/as-new: BFD (GNU Binutils) 2.45.50.20260123 assertion fail .../bfd/elf-attrs.c:2515
>>>>
>>>> Please have a look into it.
>>>
>>> Here is a first patch to "solve" the issue:
>>>
>>> --- a/gas/config/tc-csky.c
>>> +++ b/gas/config/tc-csky.c
>>> @@ -1712,6 +1712,9 @@ md_begin (void)
>>>          mach_flag |= CSKY_ARCH_610;
>>>        }
>>>
>>> +   elf_obj_attr_version (stdoutput)
>>> +    = get_elf_backend_data (stdoutput)->default_obj_attr_version;
>>> +
>>>      /* Find bfd_mach_flag, it will set to bfd backend data.  */
>>>      for (p_arch = csky_archs; p_arch->arch_flag != 0; p_arch++)
>>>        if ((mach_flag & CSKY_ARCH_MASK) == (p_arch->arch_flag & CSKY_ARCH_MASK))
>>>
>>> However, I am wondering if this is the right place to do such an initialization.
>>
>> Well, you provide too little info. md_begin() runs ahead of ...
>>
>>> The initialization of the default attribute version occurs inside elf_begin() in obj-elf.c
>>
>> ... elf_begin(). Question is whether C-Sky needs what you'd normally do in
>> elf_begin() already earlier for whatever reason. If so, with a respective
>> comment the change above might be appropriate. To decide, the call stack
>> leading to the assertion failure would be of interest. (From that it might
>> then also turn out that the assertion itself is inappropriate to have.)
>>
>> As an aside, it looks as if tc-csky.c means to be prepared for use with
>> non-ELF. You'd want to wrap your addition in #ifdef OBJ_ELF.
> 

Could you please clarify this point ?

In md_begin() in gas/config/tc-csky.c, the code setting up the object attributes seems to be called even if the target is not ELF. However, there is no support of object attributes for non-ELF targets.

You might want to surround the setting of TC_OBJ_ATTR_v1 in gas/config/tc-csky.h with #ifdef OBJ_ELF, and then the code setting the attributes in md_begin() with #ifdef TC_OBJ_ATTR_v1, otherwise the crash will reappear.

> I'll handle this one.  I intend to move the obj_begin call earlier.
> 

For reference, https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=db6768cc8eb7a06f7a00b8db924cf9ddb2d65059

Thanks Alan for your help.

Matthieu


More information about the Binutils mailing list