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

Jan Beulich jbeulich@suse.com
Mon Jan 26 11:52:19 GMT 2026


On 26.01.2026 12:37, Matthieu Longo wrote:
> 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 ?

Pretty close to the top of the file I see the first

#ifdef OBJ_ELF

and there are several more.

> 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.

True, and I didn't mean to suggest the code is self-consistent in this regard.
New additions, if any, would imo still better follow the good intentions that
were there.

Jan


More information about the Binutils mailing list