This is the mail archive of the binutils@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]

Cast shift expression


We are hardly likely to have alignment larger than 2G, but may as well
ensure the shift is using the same type as dataseg.base.

	PR ld/18176
    	* ldlang.c (lang_size_sections): Cast shift expression.

diff --git a/ld/ldlang.c b/ld/ldlang.c
index 13e7b1a..cbd5bc3 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -5424,7 +5424,7 @@ lang_size_sections (bfd_boolean *relax, bfd_boolean check_regions)
 	     between sections won't change.  This is better than
 	     simply subtracting 1 << max_alignment_power which is
 	     what we used to do here.  */
-	  expld.dataseg.base &= ~((1 << max_alignment_power) - 1);
+	  expld.dataseg.base &= ~(((bfd_vma) 1 << max_alignment_power) - 1);
 	  /* It doesn't make much sense to go lower than the initial
 	     base.  That can only increase padding.  */
 	  if (expld.dataseg.base < initial_base)

-- 
Alan Modra
Australia Development Lab, IBM


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