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

Nelson Chu nelsonc1225@sourceware.org
Tue Sep 28 11:39:38 GMT 2021


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3a6a0158ee07ba2f960ae4a898897460382dc5ec

commit 3a6a0158ee07ba2f960ae4a898897460382dc5ec
Author: Cooper Qu <cooper.qu@linux.alibaba.com>
Date:   Wed Sep 22 16:14:36 2021 +0800

    RISC-V: Fix wrong version number when arch contains 'p'.
    
    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.
    
    TODO: Remember to add testcase when we have supported standrad p in
    the future.
    
    bfd/
            PR gas/28372
            * elfxx-riscv.c (riscv_parsing_subset_version): Break if p
            represent the 'p' extension.
    
    Change-Id: Ia4e0cf26f3d7d07acaee8cefd86707ecac663a59

Diff:
---
 bfd/elfxx-riscv.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
index c3d019c03a6..044cc63d09e 100644
--- a/bfd/elfxx-riscv.c
+++ b/bfd/elfxx-riscv.c
@@ -1536,13 +1536,9 @@ riscv_parsing_subset_version (const char *p,
 	{
 	  np = *(p + 1);
 
+	  /* Might be beginning of `p` extension.  */
 	  if (!ISDIGIT (np))
-	    {
-	      /* Might be beginning of `p` extension.  */
-	      *major_version = version;
-	      *minor_version = 0;
-	      return p;
-	    }
+	    break;
 
 	  *major_version = version;
 	  major_p = false;


More information about the Binutils-cvs mailing list