[v2,10/14] x86: allow for multiple immediates in output_disp()

Message ID 68848170-59cb-6546-6e7f-527f65a8c1fe@suse.com
State Accepted
Headers
Series x86: new .insn directive |

Checks

Context Check Description
snail/binutils-gdb-check success Github commit url

Commit Message

Jan Beulich March 10, 2023, 10:24 a.m. UTC
  .insn isn't going to have a constraint of only a single immediate when,
in particular, RIP-relative addressing is used.
---
Of course this could be folded into the relevant subsequent patch, but
I'm wondering in particular whether limiting the new behavior to .insn
is actually necessary (if not, this wouldn't be a good fit to merge into
that later patch).
  

Patch

--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -10065,13 +10065,13 @@  output_disp (fragS *insn_start_frag, off
 		    if (operand_type_check (i.types[n1], imm))
 		      {
 			/* Only one immediate is allowed for PC
-			   relative address.  */
-			gas_assert (sz == 0);
-			sz = imm_size (n1);
-			i.op[n].disps->X_add_number -= sz;
+			   relative address, except with .insn.  */
+			gas_assert (sz == 0 || dot_insn ());
+			sz += imm_size (n1);
 		      }
-		  /* We should find the immediate.  */
+		  /* We should find at least one immediate.  */
 		  gas_assert (sz != 0);
+		  i.op[n].disps->X_add_number -= sz;
 		}
 
 	      p = frag_more (size);