delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/13/17:05:28

Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3946A07E.98F13651@phekda.freeserve.co.uk>
Date: Tue, 13 Jun 2000 21:58:38 +0100
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.14 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Using strip --strip-debug on libraries
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1000613131528 DOT 16888J-100000 AT is>
Reply-To: djgpp AT delorie DOT com

Hello.

Eli Zaretskii wrote:
> 
> On Sun, 11 Jun 2000, Richard Dawe wrote:
> 
> > The other day I ran strip with the '--strip-debug' option on a
> > library. The library I ran it had several files named 'init.o' within.
> > I found that after stripping, there was only one file called 'init.o'.
[snip]
> That `strip' rewrites the TOC seems reasonable: it rewrites the entire
> archive, after all.

Sure, it seems reasonable, but it wasn't what I expected it to do.

> What you need to make sure that it leaves the last copy of init.o in the
> archive and removes the rest.

I'm not sure which init.o it left, but there was only one (down from
three, I think).

> A more importtant question is: how did that library wind up with more
> than a single copy of init.o in it?

BTW this is from building gmp - there are subdirectories called mp?, e.g.
mpz, and some of these have a file called init.c, with functions like
(IIRC) __mpz_init(). So, when you build the library, you end up with three
files called init.o (from three directories), since the path information
appears to be discarded. So, when the library is stripped of debug info,
only one init.o survives, leading to unresolved symbols when you link
against it. Solution:

find . -name '*.o' -exec strip --strip-debug '{}' ';'
find . -name '*.o' -exec touch '{}' ';'

then remake library.

Bye,

-- 
Richard Dawe
[ mailto:richdawe AT bigfoot DOT com | http://www.bigfoot.com/~richdawe/ ]

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019