Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Jul 2012 12:08:32 +0100
From:      Anton Shterenlikht <mexas@bristol.ac.uk>
To:        Robert Bonomi <bonomi@mail.r-bonomi.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: profiling library smaller than non-profiling, while it contains more symbols. Why?
Message-ID:  <20120713110832.GA84618@mech-cluster241.men.bris.ac.uk>
In-Reply-To: <201207130212.q6D2CWAU046010@mail.r-bonomi.com>
References:  <20120712223130.GA58047@mech-cluster241.men.bris.ac.uk> <201207130212.q6D2CWAU046010@mail.r-bonomi.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jul 12, 2012 at 09:12:32PM -0500, Robert Bonomi wrote:
> > From owner-freebsd-questions@freebsd.org  Thu Jul 12 17:34:12 2012
> > Date: Thu, 12 Jul 2012 23:31:31 +0100
> > From: Anton Shterenlikht <mexas@bristol.ac.uk>
> > To: freebsd-questions@freebsd.org
> > Subject: profiling library smaller than non-profiling,
> > 	while it contains more symbols. Why?
> >
> > While updating my port (math/slatec) to use
> > the new OPTIONS framework, I did some
> > experiments with the profiling library.
> >
> > I don't know much about this, so what surprised me
> > is that the profiling library is smaller:
> >
> > # ls -al lib*a
> > -rw-r--r--  1 root  wheel  6582354 Jul 12 22:56 libslatec.a
> > -rw-r--r--  1 root  wheel  6555122 Jul 12 23:02 libslatec_p.a
> > #
> 
> It it possible that libslatac.a has debggingn symbols, and the profiling
> library does not?
> 
> Or that the profiling library was compiled with a lower degree of
> optimization ?  (many of the 'higher'-level optimizations cause
> _larger_, albeit faster, code to be generated)
> 
> Any other differences in compilation flags?

No, the compilation is very straightforward for this library:

===>  Building for slatec-4.1
Warning: Object directory not changed from original /usr/ports/math/slatec/work/src
gfortran46   -O -Wl,-rpath=/usr/local/lib/gcc46 -c aaaaaa.f
 *skip ~1400 other files*
gfortran46   -O -Wl,-rpath=/usr/local/lib/gcc46 -c zwrsk.f
building static slatec library
/usr/local/bin/ranlib libslatec.a

gfortran46 -pg -O -Wl,-rpath=/usr/local/lib/gcc46 -o aaaaaa.po -c aaaaaa.f
 *skip ~1400 other files*
gfortran46 -pg -O -Wl,-rpath=/usr/local/lib/gcc46 -o zwrsk.po -c zwrsk.f
building profiled slatec library
/usr/local/bin/ranlib libslatec_p.a

gfortran46 -fpic -DPIC -O -Wl,-rpath=/usr/local/lib/gcc46 -o aaaaaa.So -c aaaaaa.f
 *skip ~1400 other files*
gfortran46 -fpic -DPIC -O -Wl,-rpath=/usr/local/lib/gcc46 -o zwrsk.So -c zwrsk.f
building shared library libslatec.so.1
# 

That's all there is.

As I mentioned in the original email,
the only difference, according to nm(1),
between the non-profiling and the profiling
library, is that the profiling library contains
symbol .mcount (or _mcount, depending on the arch)
for each object file. All other symbols are identical.

-- 
Anton Shterenlikht
Room 2.6, Queen's Building
Mech Eng Dept
Bristol University
University Walk, Bristol BS8 1TR, UK
Tel: +44 (0)117 331 5944
Fax: +44 (0)117 929 4423



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120713110832.GA84618>