public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] x86: tighten extend-to-32bit-address conditions
@ 2023-05-19  7:19 Jan Beulich
  0 siblings, 0 replies; only message in thread
From: Jan Beulich @ 2023-05-19  7:19 UTC (permalink / raw)
  To: bfd-cvs

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

commit df81d460b2d9ec7327a0c1ab2344d7ec62874ce0
Author: Jan Beulich <jbeulich@suse.com>
Date:   Fri May 19 09:14:40 2023 +0200

    x86: tighten extend-to-32bit-address conditions
    
    In a442cac5084e ("ix86: wrap constants") I made the truncation condition
    too relaxed: Any indication of a mode that's possible with BFD64 only
    should avoid the truncation. Therefore, like in the other two cases of
    calls to extend_to_32bit_address(), also check whether we're generating
    a 64-bit object.

Diff:
---
 gas/config/tc-i386.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index c0bf4fc0c4e..9efb1e58447 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -11684,7 +11684,7 @@ i386_finalize_immediate (segT exp_seg ATTRIBUTE_UNUSED, expressionS *exp,
 
       /* If not 64bit, sign/zero extend val, to account for wraparound
 	 when !BFD64.  */
-      if (flag_code != CODE_64BIT)
+      if (flag_code != CODE_64BIT && !object_64bit)
 	exp->X_add_number = extend_to_32bit_address (exp->X_add_number);
     }
 #if (defined (OBJ_AOUT) || defined (OBJ_MAYBE_AOUT))
@@ -11976,7 +11976,7 @@ i386_finalize_displacement (segT exp_seg ATTRIBUTE_UNUSED, expressionS *exp,
 
 	 If not 64bit, sign/zero extend val, to account for wraparound
 	 when !BFD64.  */
-      if (flag_code != CODE_64BIT)
+      if (flag_code != CODE_64BIT && !object_64bit)
 	exp->X_add_number = extend_to_32bit_address (exp->X_add_number);
     }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-19  7:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-19  7:19 [binutils-gdb] x86: tighten extend-to-32bit-address conditions Jan Beulich

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).