[1/1] RISC-V: Fix wrong version number when arch contains 'p'.

Message ID 20210922081436.28497-1-cooper.qu@linux.alibaba.com
State New
Headers show
Series
  • [1/1] RISC-V: Fix wrong version number when arch contains 'p'.
Related show

Commit Message

Alan Modra via Binutils Sept. 22, 2021, 8:14 a.m.
When specify a default version for p extension in
riscv_supported_std_ext[](elfxx-riscv.c) and assembling with
-march=rv32imacp, the c extension's version in attribute will become
0p0, the expectation is 2p0.

bfd/
	PR gas/28372
	* elfxx-riscv.c (riscv_parsing_subset_version): Break if p
	represent the 'p' extension.

Change-Id: Ia4e0cf26f3d7d07acaee8cefd86707ecac663a59
---
 bfd/elfxx-riscv.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

-- 
2.7.4

Comments

Nelson Chu Sept. 28, 2021, 11:42 a.m. | #1
LGTM, committed.  Thanks.

Nelson

On Wed, Sep 22, 2021 at 4:14 PM Cooper Qu <cooper.qu@linux.alibaba.com> wrote:
>

> When specify a default version for p extension in

> riscv_supported_std_ext[](elfxx-riscv.c) and assembling with

> -march=rv32imacp, the c extension's version in attribute will become

> 0p0, the expectation is 2p0.

>

> bfd/

>         PR gas/28372

>         * elfxx-riscv.c (riscv_parsing_subset_version): Break if p

>         represent the 'p' extension.

>

> Change-Id: Ia4e0cf26f3d7d07acaee8cefd86707ecac663a59

> ---

>  bfd/elfxx-riscv.c | 6 +-----

>  1 file changed, 1 insertion(+), 5 deletions(-)

>

> diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c

> index b467bce..8b3fa4f 100644

> --- a/bfd/elfxx-riscv.c

> +++ b/bfd/elfxx-riscv.c

> @@ -1546,11 +1546,7 @@ riscv_parsing_subset_version (riscv_parse_subset_t *rps,

>             {

>               /* Might be beginning of `p` extension.  */

>               if (std_ext_p)

> -               {

> -                 *major_version = version;

> -                 *minor_version = 0;

> -                 return p;

> -               }

> +               break;

>               else

>                 {

>                   rps->error_handler

> --

> 2.7.4

>

Patch

diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
index b467bce..8b3fa4f 100644
--- a/bfd/elfxx-riscv.c
+++ b/bfd/elfxx-riscv.c
@@ -1546,11 +1546,7 @@  riscv_parsing_subset_version (riscv_parse_subset_t *rps,
 	    {
 	      /* Might be beginning of `p` extension.  */
 	      if (std_ext_p)
-		{
-		  *major_version = version;
-		  *minor_version = 0;
-		  return p;
-		}
+		break;
 	      else
 		{
 		  rps->error_handler