[PATCH v5 02/20] gas: move code for object attribute parsing into obj-elf-attr.c
Jan Beulich
jbeulich@suse.com
Thu Jul 10 13:32:36 GMT 2025
On 10.07.2025 15:28, Richard Earnshaw (lists) wrote:
> On 10/07/2025 12:38, Matthieu Longo wrote:
>> On 2025-07-10 10:48, Richard Earnshaw (lists) wrote:
>>> On 09/07/2025 11:12, Jan Beulich wrote:
>>>> On 09.07.2025 12:02, Richard Earnshaw (lists) wrote:
>>>>> On 07/07/2025 17:49, Matthieu Longo wrote:
>>>>>> --- /dev/null
>>>>>> +++ b/gas/config/obj-elf-attr.h
>>>>>> @@ -0,0 +1,52 @@
>>>>>> +/* Object attributes parsing.
>>>>>> + Copyright (C) 2025 Free Software Foundation, Inc.
>>>>>> +
>>>>>> + This file is part of GAS, the GNU Assembler.
>>>>>> +
>>>>>> + GAS is free software; you can redistribute it and/or modify
>>>>>> + it under the terms of the GNU General Public License as published by
>>>>>> + the Free Software Foundation; either version 3, or (at your option)
>>>>>> + any later version.
>>>>>> +
>>>>>> + GAS is distributed in the hope that it will be useful,
>>>>>> + but WITHOUT ANY WARRANTY; without even the implied warranty of
>>>>>> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>>>>>> + GNU General Public License for more details.
>>>>>> +
>>>>>> + You should have received a copy of the GNU General Public License
>>>>>> + along with GAS; see the file COPYING. If not, write to the Free
>>>>>> + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
>>>>>> + 02110-1301, USA. */
>>>>>> +
>>>>>> +#ifndef _OBJ_ELF_ATTR_H
>>>>>> +#define _OBJ_ELF_ATTR_H
>>>>>> +
>>>>>> +#include "as.h"
>>>>>> +#include "bfd/elf-bfd.h"
>>>>>> +
>>>>>> +/* The target supports Object Attributes v1. */
>>>>>> +#if OBJ_ELF \
>>>>>
>>>>> I don't think you need to test OBJ_ELF now, this file is only built when that is true.
>>>>
>>>> This being a header file, don't things depend on where the file is included
>>>> from?
>>>
>>> The issue is moot if the TC_OBJ_ATTR definition is moved to the individual tc-<arch>.h files. At that point you probably do need to test OBJ_ELF again as those headers are definitely used by multiple obj formats.
>>
>> I am a bit confused about what the next step is for me.
>>
>> As Richard stated it, if I move the definitions into tc-<arch>.h, then I won't be able to determine whether the target is ELF or not because OBJ_ELF is defined into obj-elf.h
>>
>> In this case, it looks to me that I will need to use OBJ_MAYBE_ELF instead.
>
> I think only MIPS uses OBJ_MAYBE_ELF since it has to support multiple object flavours in a single gas binary. I'm not aware of any other port that does this.
Right, I removed uses from x86 not that long ago.
Jan
More information about the Binutils
mailing list