[PATCH] gas: Document @ and % as interchangeable for type argument in .section

Will Hawkins hawkinsw@obs.cr
Sun May 17 11:35:26 GMT 2026


On Sunday, May 17, 2026, Will Hawkins <hawkinsw@obs.cr> wrote:

>
>
> On Sunday, May 17, 2026, Jan Beulich <jbeulich@suse.com> wrote:
>
>> On 16.05.2026 02:38, Will Hawkins wrote:
>> > In the .section Assembler Directive for the ELF format, both the % and
>> > the @ can be used when writing the type argument.
>>
>> That's not exactly true (the two aren't fully interchangeable), and hence
>> ...
>
>
>
> In obj-elf.c, I saw
>
> else if (c == '@' || c == '%')
>
> which I must have misinterpreted?
>


I guess that they are only treated equivalently in code on platforms where
the @ and % do not have implications for the code in earlier processing
before reaching obj_elf_section.

>
>
>
>>
>> > Clarify the documentation.
>> >
>> > Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
>> > ---
>> >  gas/doc/as.texi | 7 +++----
>> >  1 file changed, 3 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/gas/doc/as.texi b/gas/doc/as.texi
>> > index 3e1d2d0e254..201d9c26b7d 100644
>> > --- a/gas/doc/as.texi
>> > +++ b/gas/doc/as.texi
>> > @@ -7118,13 +7118,12 @@ a numeric value to be set as the ELF section
>> header's type field.
>> >  some targets extend this list with their own types
>> >  @end table
>> >
>> > +Note - the @code{%} character may be used instead of the @code{@@}
>> character
>> > +when writing the @var{type} argument constant.
>> > +
>> >  Many targets only support the first three section types.  The type may
>> be
>> >  enclosed in double quotes if necessary.
>> >
>> > -Note on targets where the @code{@@} character is the start of a
>> comment (eg
>> > -ARM) then another character is used instead.  For example the ARM port
>> uses the
>> > -@code{%} character.
>>
>> ... removing this paragraph loses information. I'd suggest adding
>> something like
>> "For example the Arm port uses @code{@@} as comment character." to the
>> new paragraph
>> you add. (MMIX is the other way around, using % as comment char.)
>>
>> Jan
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/binutils/attachments/20260517/e3e078fd/attachment.htm>


More information about the Binutils mailing list