Subject: Re: linking stripped object files
From: [email-masked] (Chin Chee-Kai)

3 Mar 1997 05:33:03 -0800
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Reply-To: Chin Chee-Kai <[email-masked]>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
X-Authentication-Warning: gatekeeper.gen.co.jp: smap set sender to <[email-masked]> using -f
Original-To: Fergus Henderson <[email-masked]>
Original-Cc: gnu-win32 <[email-masked]>
In-Reply-To: <[email-masked]>
Original-Sender: [email-masked]

Hmm, seems like it's different on different machines (?).

I'm running gcc version 2.7.2 on SGI Indy IRIX 6.2.

Running "strip" alone forbids stripping due to IRIX's "strip"'s
behavior.  It provides a "-f" which I used to strip all ELF and
non-ELF object files.   After which, gcc-ing again still produces
the executable.

I've included a transcript below (filenames, include paths and
library paths are changed and removed, others remain in tact).

--------------------------- BEGIN OF TRANSCRIPT ---------------------------
% make
   gcc -I.   -g -c 1.c
cc1: warning: `-g' not supported by this configuration of GCC
   gcc -I.   -g -c 2.c
cc1: warning: `-g' not supported by this configuration of GCC
   gcc -I.   -g -c 3.c
cc1: warning: `-g' not supported by this configuration of GCC
     gcc -I.   -g -L.  1.o 2.o 3.o -o final
ld: WARNING 84: /usr/local/lib/gcc-lib/mips-sgi-irix5.3/2.7.2/libgcc.a is
not used for resolving any symbol.
ld: WARNING 84: /usr/local/lib/gcc-lib/mips-sgi-irix5.3/2.7.2/libgcc.a is
not used for resolving any symbol.
final: Symflags set but there are none?
% ls -lF final
-rwx------    1 cheekai  users      54344 Mar  3 17:03 final*
% rm final
% ls -lF *.o
-rw-------    1 cheekai  users      39420 Mar  3 17:03 1.o
-rw-------    1 cheekai  users      13956 Mar  3 17:03 2.o
-rw-------    1 cheekai  users      30884 Mar  3 17:03 3.o
% strip *.o
strip: 1.o: Not stripped. Only elf type (e_type) ET_EXEC files are
stripped unless -f is specified. This one is ET_REL
strip: 2.o: Not stripped. Only elf type (e_type) ET_EXEC files are
stripped unless -f is specified. This one is ET_REL
strip: 3.o: Not stripped. Only elf type (e_type) ET_EXEC files are
stripped unless -f is specified. This one is ET_REL
% strip -f *.o
% ls -lF *.o
-rw-------    1 cheekai  users      23480 Mar  3 17:03 1.o
-rw-------    1 cheekai  users       8064 Mar  3 17:03 2.o
-rw-------    1 cheekai  users      15560 Mar  3 17:03 3.o
% make etelnet
 gcc -I.   -g -L.  1.o 2.o 3.o -o final
ld: WARNING 84: /usr/local/lib/gcc-lib/mips-sgi-irix5.3/2.7.2/libgcc.a is
not used for resolving any symbol.
ld: WARNING 84: /usr/local/lib/gcc-lib/mips-sgi-irix5.3/2.7.2/libgcc.a is
not used for resolving any symbol.
final: Symflags set but there are none?
% ls -lF final
-rwx------    1 cheekai  users      39268 Mar  3 17:03 final*
% gcc -v
Reading specs from /usr/local/lib/gcc-lib/mips-sgi-irix5.3/2.7.2/specs
gcc version 2.7.2
%

---------------------------- END OF TRANSCRIPT ----------------------------

Chin Chee-Kai (Last, First) 
Internet Email-ID: [email-masked]

On Mon, 3 Mar 1997, Fergus Henderson wrote:

> > [...my quotation deleted...]
> 
> Which Unix does this work on?
> 
> It doesn't work on Linux or Alpha/OSF.
> 
> On Alpha/OSF, the `strip' command reports the following:
> 	strip: Error: 1.o contains relocation entries-- not stripped
> 
> On Linux, you just get 
> 
> 	undefined symbol `main'
> 
> or something like that.
> 
> > [...my quotation deleted...]
>
> That's because `strip' stripped off all the symbols including the
> `main' symbol in your `.o' file.
> 
> -- 
> Fergus Henderson <[email-masked]>   |  "I have always known that the pursuit
> WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
> PGP: finger [email-masked]         |     -- the last words of T. S. Garp.

-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".