templon@copper.ucs.indiana.edu (jeffrey templon) (04/29/91)
I had posted previously about stripping executables on the Mac, with some confused ramblings about 'astrip' and 'strip'. Turns out that 'strip' is the one I want, 'astrip' is for use with ACK .o files. The problem with 'strip' is in a file a.out.h - there are some #defines which are apparently flipped around from what they ought to be. I have not yet figured out why this matters, as in strip.c they seem to always be used in pairs. But here is the patch, courtesy of Matthias Pfaller. After installing this patch and recompiling, strip works fine. Note my version was compiled with c68, not ACK. Jeff -------------------------------------------------- From: leo@krabat.marco.de (Matthias Pfaller) Status: OR I think your /usr/include/a.out.h is the pc-version. strip compiled on a 68000-system with an pc-a.out.h will behave as you have reported. The following is a diff between the pc-version and the st-version. Hope that helps - Matthias 1a2 > /* This version is intended for the Atari ST */ 7,8d7 < unsigned char a_magic[2]; /* magic number */ < unsigned char a_flags; /* flags, see below */ 10,11c9,10 < unsigned char a_hdrlen; /* length of header */ < unsigned char a_unused; /* reserved for future use */ --- > unsigned char a_flags; /* flags, see below */ > unsigned char a_magic[2]; /* magic number */ 13a13,14 > unsigned char a_unused; /* reserved for future use */ > unsigned char a_hdrlen; /* length of header */ 27,28c28,29 < #define A_MAGIC0 (unsigned char) 0x01 < #define A_MAGIC1 (unsigned char) 0x03 --- > #define A_MAGIC0 (unsigned char) 0x03 > #define A_MAGIC1 (unsigned char) 0x01
evans@syd.dit.CSIRO.AU (Bruce.Evans) (04/30/91)
In article <1991Apr28.172029.5679@bronze.ucs.indiana.edu> templon@copper.ucs.indiana.edu (jeffrey templon) writes: > >The problem with 'strip' is in a file a.out.h - there are some #defines >which are apparently flipped around from what they ought to be. >I have not yet figured out why this matters, as in strip.c they seem >to always be used in pairs. But here is the patch, courtesy of Matthias >Pfaller. After installing this patch and recompiling, strip works fine. The reason this matters is that when the Minix was originally ported to the ST, a.out.h was not available and/or not used and/or not understood. So the first few fields, which are supposed to be chars, are packed into a long and so get swapped because of the different machines. This defeats the point of having a magic number in the first byte or two. The book gives an unfortunate recipe for the header too. "It consists of 8 longs ... alternative 48-byte header is also acceptable". Actually lengths of about 24 to 255 are acceptable to MM, if not to all utilities. There is a byte to give the length. I remember reading something about this too being broken in the Mac version. 0 works for it in MM (it is taken as 32) but not in all utilities. -- Bruce Evans evans@syd.dit.csiro.au