This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb/binutils-2_28-branch] RISC-V/GAS: Support more relocs against constant addresses


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

commit f4a292321b21ef3af34520edd9714ea5b4d12dd5
Author: Andrew Waterman <andrew@sifive.com>
Date:   Wed Dec 21 18:05:28 2016 -0800

    RISC-V/GAS: Support more relocs against constant addresses
    
    Previously, some pseudoinstructions like "call" only accepted
    symbolic addresses and rejected constant addresses with an
    esoteric internal error.  This patch enables them by deferring
    application of constant relocations to md_apply_fix, rather than
    eagerly applying them during instruction assembly.
    
    gas/ChangeLog
    
    2017-01-09  Andrew Waterman <andrew@sifive.com>
    
    	* config/tc-riscv.c (append_insn): Don't eagerly apply relocations
    	against constants.
    	(md_apply_fix): Mark relocations against constants as "done."

Diff:
---
 gas/ChangeLog         | 6 ++++++
 gas/config/tc-riscv.c | 5 ++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 80857d7..4069f54 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -17,6 +17,12 @@
 	against constants.
 	(md_apply_fix): Mark relocations against constants as "done."
 
+2017-01-09  Andrew Waterman <andrew@sifive.com>
+
+	* config/tc-riscv.c (append_insn): Don't eagerly apply relocations
+	against constants.
+	(md_apply_fix): Mark relocations against constants as "done."
+
 2017-01-09  Palmer Dabbelt <palmer@dabbelt.com>
 	    Kito Cheng <kito.cheng@gmail.com>
 
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index bf870e6..ec5b0bb 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -682,9 +682,6 @@ append_insn (struct riscv_cl_insn *ip, expressionS *address_expr,
 			    address_expr->X_add_number);
 	  return;
 	}
-      else if (address_expr->X_op == O_constant)
-	ip->insn_opcode |= riscv_apply_const_reloc (reloc_type,
-						    address_expr->X_add_number);
       else
 	{
 	  howto = bfd_reloc_type_lookup (stdoutput, reloc_type);
@@ -1851,6 +1848,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
     case BFD_RELOC_RISCV_LO12_S:
       bfd_putl32 (riscv_apply_const_reloc (fixP->fx_r_type, *valP)
 		  | bfd_getl32 (buf), buf);
+      if (fixP->fx_addsy == NULL)
+	fixP->fx_done = TRUE;
       relaxable = TRUE;
       break;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]