Oops - failed to commit change to verilog.c. Trying again.
authorNick Clifton <nickc@redhat.com>
Wed, 16 Sep 2020 15:19:53 +0000 (16:19 +0100)
committerNick Clifton <nickc@redhat.com>
Wed, 16 Sep 2020 15:19:53 +0000 (16:19 +0100)
* verilog.c (verilog_write_address): Properly handle 64-bit
addresses to avoid truncation of the high part.

bfd/verilog.c

index 9f22bc36bbeb672539e1094c877f7831a6a10489..83d4ccca9e5a10e6a08950c5d0f75f216131a336 100644 (file)
@@ -165,12 +165,25 @@ verilog_set_section_contents (bfd *abfd,
 static bfd_boolean
 verilog_write_address (bfd *abfd, bfd_vma address)
 {
-  char buffer[12];
+  char buffer[20];
   char *dst = buffer;
   bfd_size_type wrlen;
 
   /* Write the address.  */
   *dst++ = '@';
+#ifdef BFD64
+  if (address >= (bfd_vma)1 << 32)
+    {
+      TOHEX (dst, (address >> 56));
+      dst += 2;
+      TOHEX (dst, (address >> 48));
+      dst += 2;
+      TOHEX (dst, (address >> 40));
+      dst += 2;
+      TOHEX (dst, (address >> 32));
+      dst += 2;
+    }
+#endif
   TOHEX (dst, (address >> 24));
   dst += 2;
   TOHEX (dst, (address >> 16));