[gnu.utils.bug] bug in strip.c under COFF encapsulation

rms@AI.MIT.EDU (02/12/90)

Return-Path: <eliot@mgm.mit.edu>
Date: Sun, 11 Feb 90 15:38:42 EST
From: eliot@mgm.mit.edu (Eliot Dresselhaus)
To: rms@ai.mit.edu
Subject: bug in strip.c under COFF encapsulation

When strip finally writes out the a.out header under COFF
encapsulation it stomps on the COFF header.  The lseek (input_desc, 0, 0)
below assumes the a.out header starts the file; this is untrue under
COFF encapsulation.  The obvious fix is:

*** strip.c~	Thu Jan 26 13:55:28 1989
--- strip.c	Mon Nov  6 12:27:06 1989
***************
*** 624,629 ****
--- 624,632 ----
    entry->header.a_syms = nsyms * sizeof (struct nlist);
  
    lseek (input_desc, 0, 0);
+ #ifdef COFF_ENCAPSULATE
+   lseek (input_desc, _N_HDROFF (entry->header), 0);
+ #endif
    write (input_desc, &entry->header, sizeof (struct exec));
  
    free (strtab_vector);


---
Eliot
eliot@mgm.mit.edu