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]

[PATCH] minor fixes in alpha-vms, please apply


Hi,

This patch fixes some minor problems in bfd for alpha-vms. Especially they make objdump with -s and -h work for the faked $DST$ PSECT.

Please review and apply.

Hartmut
bfd/
2010-03-10  Hartmut Becker <becker.ismaning@freenet.de>

           * vms-hdr.c (_bfd_vms_write_hdr): for some header records write
	   the non-padded lenght.
	   (vms_slurp_debug): set the dst_section size based on processed
	   TIR records.
	   
	   * vms-misc.c (_bfd_vms_output_flush): renamed to
	   _bfd_vms_output_flush_common with additional flag for writing
	   actual or padded length.
	   (_bfd_vms_output_flush): added, calls _bfd_vms_output_flush_common.
	   (_bfd_vms_output_flush_nopadlen): calls
	   _bfd_vms_output_flush_common. 
	   
	   * vms.h: _bfd_vms_output_flush_nopadlen added.

diff -u -r1.27 vms-hdr.c
--- bfd/vms-hdr.c	27 Jan 2010 16:43:27 -0000	1.27
+++ bfd/vms-hdr.c	10 Mar 2010 22:51:31 -0000
@@ -280,14 +280,13 @@
 
   _bfd_vms_output_counted (abfd, BFD_VERSION_STRING);
   _bfd_vms_output_dump (abfd, get_vms_time_string (), EMH_DATE_LENGTH);
-  _bfd_vms_output_fill (abfd, 0, EMH_DATE_LENGTH);
-  _bfd_vms_output_flush (abfd);
+  _bfd_vms_output_flush_nopadlen (abfd);
 
   /* LMN.  */
   _bfd_vms_output_begin (abfd, EOBJ_S_C_EMH, EMH_S_C_LNM);
   snprintf (version, sizeof (version), "GAS BFD v%s", BFD_VERSION_STRING);
   _bfd_vms_output_dump (abfd, (unsigned char *)version, strlen (version));
-  _bfd_vms_output_flush (abfd);
+  _bfd_vms_output_flush_nopadlen (abfd);
 
   /* SRC.  */
   _bfd_vms_output_begin (abfd, EOBJ_S_C_EMH, EMH_S_C_SRC);
@@ -320,19 +319,19 @@
   if (symnum == abfd->symcount)
     _bfd_vms_output_dump (abfd, (unsigned char *) STRING_COMMA_LEN ("noname"));
 
-  _bfd_vms_output_flush (abfd);
+  _bfd_vms_output_flush_nopadlen (abfd);
 
   /* TTL.  */
   _bfd_vms_output_begin (abfd, EOBJ_S_C_EMH, EMH_S_C_TTL);
   _bfd_vms_output_dump (abfd, (unsigned char *) STRING_COMMA_LEN ("TTL"));
-  _bfd_vms_output_flush (abfd);
+  _bfd_vms_output_flush_nopadlen (abfd);
 
   /* CPR.  */
   _bfd_vms_output_begin (abfd, EOBJ_S_C_EMH, EMH_S_C_CPR);
   _bfd_vms_output_dump (abfd,
 			 (unsigned char *)"GNU BFD ported by Klaus Kämpf 1994-1996",
 			 39);
-  _bfd_vms_output_flush (abfd);
+  _bfd_vms_output_flush_nopadlen (abfd);
 
   return 0;
 }
@@ -1335,6 +1334,7 @@
 static int
 vms_slurp_debug (bfd *abfd)
 {
+  int err;
   if (PRIV (dst_section) == NULL)
     {
       /* We have no way to find out beforehand how much debug info there
@@ -1358,7 +1358,13 @@
   PRIV (image_section) = PRIV (dst_section);
   PRIV (image_ptr) = PRIV (dst_section)->contents;
  
-  return _bfd_vms_slurp_tir (abfd, EOBJ_S_C_ETIR);
+  err = _bfd_vms_slurp_tir (abfd, EOBJ_S_C_ETIR);
+  if (!err)
+    {
+    PRIV (dst_section)->size = PRIV (image_ptr) - PRIV (dst_section)->contents;
+    PRIV (dst_section)->flags |= SEC_IN_MEMORY;
+    }
+  return err;
 }
 
 /* Process DBG/EDBG record.


diff -u -r1.31 vms-misc.c
--- bfd/vms-misc.c	27 Jan 2010 16:43:27 -0000	1.31
+++ bfd/vms-misc.c	10 Mar 2010 22:51:31 -0000
@@ -703,16 +703,15 @@
 }
 
 /* Flush unwritten output, ends current record.  */
-
-void
-_bfd_vms_output_flush (bfd * abfd)
+static void
+_bfd_vms_output_flush_common (bfd * abfd, int padlen)
 {
   int real_size = PRIV (output_size);
   int aligncount;
   int length;
 
 #if VMS_DEBUG
-  vms_debug (6, "_bfd_vms_output_flush (real_size = %d, pushed_size %d at lenpos %d)\n",
+  vms_debug (6, "_bfd_vms_output_flush_common (real_size = %d, pushed_size %d at lenpos %d)\n",
 	      real_size, PRIV (pushed_size), PRIV (length_pos));
 #endif
 
@@ -733,7 +732,8 @@
   while (aligncount-- > 0)
     {
       PRIV (output_buf)[real_size++] = 0;
-      length++;
+      if (padlen)
+	length++;
     }
 
   /* Put length to buffer.  */
@@ -756,6 +756,21 @@
     }
 }
 
+/* Flush unwritten output, the record is padded and the 
+   padded length is stored, ends current record.  */
+void
+_bfd_vms_output_flush (bfd * abfd)
+{
+	_bfd_vms_output_flush_common (abfd, 1);
+}
+
+/* Flush unwritten output, the record is padded but the
+   actual length is stored, ends current record. */
+void
+_bfd_vms_output_flush_nopadlen (bfd * abfd)
+{
+	_bfd_vms_output_flush_common (abfd, 0);
+}
 /* End record output.   */
 
 void


diff -u -r1.17 vms.h
--- bfd/vms.h	27 Jan 2010 16:43:27 -0000	1.17
+++ bfd/vms.h	10 Mar 2010 22:51:31 -0000
@@ -887,6 +887,7 @@
 extern void        _bfd_vms_output_push (bfd *);
 extern void        _bfd_vms_output_pop (bfd *);
 extern void        _bfd_vms_output_flush (bfd *);
+extern void        _bfd_vms_output_flush_nopadlen (bfd *);
 extern void        _bfd_vms_output_end (bfd *);
 extern int         _bfd_vms_output_check (bfd *, int);
 extern void        _bfd_vms_output_byte (bfd *, unsigned);

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