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

Minor BFD SOM fix



strip/objcopy should preserve the version id # from the SOM header
instead of blindly replacing it.

        * som.h (som_exec_data): New field "version_id".
        * som.c (som_object_setup): Record the version_id if it
        exists.
        (som_prep_headers): Do not initialize version_id here.
        (som_finish_writing): Initialize version_id here.


Index: som.c
===================================================================
RCS file: /cvs/src/src/bfd/som.c,v
retrieving revision 1.24
diff -c -3 -p -r1.24 som.c
*** som.c	2001/09/29 06:13:53	1.24
--- som.c	2001/10/05 21:52:08
*************** som_object_setup (abfd, file_hdrp, aux_h
*** 1814,1819 ****
--- 1814,1821 ----
        obj_som_exec_data (abfd)->exec_flags = aux_hdrp->exec_flags;
      }
  
+   obj_som_exec_data (abfd)->version_id = file_hdrp->version_id;
+ 
    bfd_default_set_arch_mach (abfd, bfd_arch_hppa, pa10);
    bfd_get_symcount (abfd) = file_hdrp->symbol_total;
  
*************** som_prep_headers (abfd)
*** 2320,2328 ****
    else
      file_hdr->a_magic = RELOC_MAGIC;
  
-   /* Only new format SOM is supported.  */
-   file_hdr->version_id = NEW_VERSION_ID;
- 
    /* These fields are optional, and embedding timestamps is not always
       a wise thing to do, it makes comparing objects during a multi-stage
       bootstrap difficult.  */
--- 2322,2327 ----
*************** som_finish_writing (abfd)
*** 3687,3692 ****
--- 3686,3699 ----
    unsigned long current_offset;
    unsigned int total_reloc_size;
    bfd_size_type amt;
+ 
+   /* We must set up the version identifier here as objcopy/strip copy
+      private BFD data too late for us to handle this in som_begin_writing.  
*/
+   if (obj_som_exec_data (abfd)
+       && obj_som_exec_data (abfd)->version_id)
+     obj_som_file_hdr (abfd)->version_id = obj_som_exec_data (abfd)->
version_id;
+   else
+     obj_som_file_hdr (abfd)->version_id = NEW_VERSION_ID;
  
    /* Next is the symbol table.  These are fixed length records.
  
Index: som.h
===================================================================
RCS file: /cvs/src/src/bfd/som.h,v
retrieving revision 1.3
diff -c -3 -p -r1.3 som.h
*** som.h	2001/03/08 21:04:02	1.3
--- som.h	2001/10/05 21:53:01
*************** struct som_exec_data
*** 94,99 ****
--- 94,103 ----
         null pointer dereferencing is allowed and the like.  */
      long exec_flags;
  
+     /* We must preserve the version identifier too.  Some versions
+        of the HP linker do not grok NEW_VERSION_ID for reasons unknown.  */
+     unsigned int version_id;
+ 
      /* Add more stuff here as needed.  Good examples of information
         we might want to pass would be presumed_dp, entry_* and maybe
         others from the file header.  */





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