[PATCH v5 02/20] gas: move code for object attribute parsing into obj-elf-attr.c
Jan Beulich
jbeulich@suse.com
Thu Jul 10 08:07:51 GMT 2025
On 09.07.2025 17:32, Matthieu Longo wrote:
> On 2025-07-09 15:07, Jan Beulich wrote:
>> On 07.07.2025 18: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 \
>>> + && (defined (TC_ARC) \
>>> + || defined (TC_ARM) \
>>> + || defined (TC_CSKY) \
>>> + || defined (TC_M68K) \
>>> + || defined (TC_MIPS) \
>>> + || defined (TC_MSP430) \
>>> + || defined (TC_PPC) \
>>> + || defined (TC_RISCV) \
>>> + || defined (TC_S390) \
>>> + || defined (TC_SPARC) \
>>> + || defined (TC_TIC6X))
>>> +#define TC_OBJ_ATTR 1
>>> +#endif
>>
>> Now things are even less correct, according to my understanding. TC_*
>> should not be defined outside of tc-*.h, except to provide a fallback
>> definition (if / when necessary).
>>
>> (I didn't look at the patch as a whole yet, I just noticed this when
>> reading through Richard's comments.)
>
> I grouped the definition of TC_OBJ_ATTR (and TC_OBJ_ATTR_v1 and
> TC_OBJ_ATTR_v2 in the next patch) here because otherwise it means that I
> need to change the tc-<arch>.h of 11 targets (12 if I add tc-aarch64.h).
>
> Do we want to scatter the definition of the support of OAv1, OAv2 and
> TC_OBJ_ATTR to 12 files ? On one hand, it makes things more difficult to
> understand. On the other hand, I understand the logic of wanting to
> group all the configuration stuffs into one file for a given target.
>
> Please can you confirm if you want me to move the definition to the 11
> tc-<arch>.h files ?
Yes, that is what I had asked for originally. That's how target-specific
tweaking is intended to be done in gas, according to all I know.
Jan
More information about the Binutils
mailing list