public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nelson Chu <nelson@rivosinc.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Binutils <binutils@sourceware.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	 Andrew Waterman <andrew@sifive.com>,
	Jim Wilson <jim.wilson.gcc@gmail.com>
Subject: Re: [PATCH 3/3] RISC-V: odd data padding vs mapping symbols
Date: Tue, 20 Aug 2024 13:19:03 +0800	[thread overview]
Message-ID: <CAPpQWtAY7r7BpF7iaWUQa7eUjWWkq66UJOWfhsBbsyG9KR4sYg@mail.gmail.com> (raw)
In-Reply-To: <ab513a84-e043-4a6b-a8ee-6219fc8822b8@suse.com>

[-- Attachment #1: Type: text/plain, Size: 2078 bytes --]

Looks good, thanks.

Nelson

On Mon, Aug 12, 2024 at 11:08 PM Jan Beulich <jbeulich@suse.com> wrote:

> Odd data padding has a $d label inserted at its beginning. When a $x...
> label is removed instead, a replacement is inserted after the padding.
> The same, however, needs to also happen when there's no $x to replace.
>
> --- a/gas/config/tc-riscv.c
> +++ b/gas/config/tc-riscv.c
> @@ -574,19 +574,19 @@ make_mapping_symbol (enum riscv_seg_msta
>      }
>    frag->tc_frag_data.last_map_symbol = symbol;
>
> -  if (removed == NULL)
> -    return;
> -
>    if (odd_data_padding)
>      {
>        /* If the removed mapping symbol is $x+arch, then add it back to
>          the next $x.  */
> -      const char *str = strncmp (S_GET_NAME (removed), "$xrv", 4) == 0
> +      const char *str = removed != NULL
> +                       && strncmp (S_GET_NAME (removed), "$xrv", 4) == 0
>                         ? S_GET_NAME (removed) + 2 : NULL;
>        make_mapping_symbol (MAP_INSN, frag->fr_fix + 1, frag, str,
>                            false/* odd_data_padding */);
>      }
> -  symbol_remove (removed, &symbol_rootP, &symbol_lastP);
> +
> +  if (removed != NULL)
> +    symbol_remove (removed, &symbol_rootP, &symbol_lastP);
>  }
>
>  /* Set the mapping state for frag_now.  */
> --- /dev/null
> +++ b/gas/testsuite/gas/riscv/odd-padding.d
> @@ -0,0 +1,17 @@
> +#as: -mrelax
> +#as: -mno-relax
> +#objdump: -d
> +
> +.*:[   ]+file format .*
> +
> +
> +Disassembly of section \.text:
> +
> +0+000 <byte>:
> +[      ]+0:[   ]+00000013[     ]+nop
> +[      ]+4:[   ]+00[   ]+\.byte[       ]+0x00
> +#...
> +[      ]+9:[   ]+00[   ]+\.byte[       ]+0x00
> +[      ]+a:[   ]+0001[         ]+\.insn[       ]+2, 0x0*1
> +[      ]+c:[   ]+00000013[     ]+nop
> +[      ]+10:[  ]+00008067[     ]+ret
> --- /dev/null
> +++ b/gas/testsuite/gas/riscv/odd-padding.s
> @@ -0,0 +1,8 @@
> +       .text
> +byte:
> +       nop
> +       .byte 0
> +       nop
> +       .p2align 2
> +       nop
> +       ret
>
>

      reply	other threads:[~2024-08-20  5:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-12 15:06 [PATCH 0/3] RISC-V: alignment in text sections Jan Beulich
2024-08-12 15:07 ` [PATCH 1/3] RISC-V: process rs_align_code also when relaxing Jan Beulich
2024-08-20  2:44   ` Nelson Chu
2024-08-20  7:34     ` Jan Beulich
2024-08-12 15:08 ` [PATCH 2/3] RISC-V: correct alignment directive handling for text sections Jan Beulich
2024-09-03 23:02   ` Palmer Dabbelt
2024-09-03 23:25     ` Nelson Chu
2024-09-24  8:31     ` Jan Beulich
2024-09-26  5:44       ` Nelson Chu
2024-09-26  6:44         ` Fangrui Song
2024-08-12 15:08 ` [PATCH 3/3] RISC-V: odd data padding vs mapping symbols Jan Beulich
2024-08-20  5:19   ` Nelson Chu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPpQWtAY7r7BpF7iaWUQa7eUjWWkq66UJOWfhsBbsyG9KR4sYg@mail.gmail.com \
    --to=nelson@rivosinc.com \
    --cc=andrew@sifive.com \
    --cc=binutils@sourceware.org \
    --cc=jbeulich@suse.com \
    --cc=jim.wilson.gcc@gmail.com \
    --cc=palmer@dabbelt.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).