Re: profiling library smaller than non-profiling, while it contains more symbols. Why?

2012-07-13 Thread Wojciech Puchar

-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
#



profile library or -fpic library?
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: profiling library smaller than non-profiling, while it contains more symbols. Why?

2012-07-13 Thread Anton Shterenlikht
On Thu, Jul 12, 2012 at 09:12:32PM -0500, Robert Bonomi wrote:
  From owner-freebsd-questi...@freebsd.org  Thu Jul 12 17:34:12 2012
  Date: Thu, 12 Jul 2012 23:31:31 +0100
  From: Anton Shterenlikht me...@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 aa.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 aa.po -c aa.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 aa.So -c 
aa.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
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: profiling library smaller than non-profiling, while it contains more symbols. Why?

2012-07-13 Thread Anton Shterenlikht
On Fri, Jul 13, 2012 at 11:15:45AM +0200, Wojciech Puchar wrote:
 -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
 #
 
 
 profile library or -fpic library?

I think profile:

===  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 aa.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 aa.po -c aa.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 aa.So -c 
aa.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


-- 
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
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


profiling library smaller than non-profiling, while it contains more symbols. Why?

2012-07-12 Thread Anton Shterenlikht
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
#

while it adds .mcount symbol to each object file:

# nm libslatec.a  nm
# nm libslatec_p.a  nmp
# wc nm nmp
   16436   36675  373033 nm
   17885   39573  413605 nmp
   34321   76248  786638 total
# grep -c mcount nmp
1449
# expr 16436 + 1449
17885
#

Using diff I can confirm that the only difference
between the 2 libs is the .mcount symbol for
each object file in the profiling library.

So how can the profiling library be smaller?

-- 
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
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: profiling library smaller than non-profiling, while it contains more symbols. Why?

2012-07-12 Thread Anton Shterenlikht
On Thu, Jul 12, 2012 at 11:31:31PM +0100, Anton Shterenlikht wrote:
 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
 #
 
 while it adds .mcount symbol to each object file:
 
 # nm libslatec.a  nm
 # nm libslatec_p.a  nmp
 # wc nm nmp
16436   36675  373033 nm
17885   39573  413605 nmp
34321   76248  786638 total
 # grep -c mcount nmp
 1449
 # expr 16436 + 1449
 17885
 #
 
 Using diff I can confirm that the only difference
 between the 2 libs is the .mcount symbol for
 each object file in the profiling library.
 
 So how can the profiling library be smaller?
 

Also, the library compiled on amd64 has lots more
symbols than if compiled on ia64. For example:

amd64:

zbesy.o:
 r .LC0
0008 r .LC1
0010 r .LC11
0020 r .LC12
0028 r .LC13
0030 r .LC14
0010 r .LC2
0018 r .LC5
 r .LC6
 U cos
 U d1mach_
 U exp
 U i1mach_
 U sin
 U zbesh_
 T zbesy_

and ia64:

zbesy.o:
 U cos
 U d1mach_
 U exp
 U i1mach_
 U sin
 U zbesh_
 T zbesy_

Why the difference?

-- 
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
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: profiling library smaller than non-profiling, while it contains more symbols. Why?

2012-07-12 Thread Robert Bonomi
 From owner-freebsd-questi...@freebsd.org  Thu Jul 12 17:34:12 2012
 Date: Thu, 12 Jul 2012 23:31:31 +0100
 From: Anton Shterenlikht me...@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?



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: profiling library smaller than non-profiling, while it contains more symbols. Why?

2012-07-12 Thread Robert Bonomi

 Date: Thu, 12 Jul 2012 23:52:18 +0100
 From: Anton Shterenlikht me...@bristol.ac.uk
 Subject: Re: profiling library smaller than non-profiling,
   while it contains more symbols. Why?

 Also, the library compiled on amd64 has lots more
 symbols than if compiled on ia64.

This is _not_ unexpected with different processor architectures, and thus
different instruction sets.

Speculation: the values lfor the .LC* variables look like bit-masks -- it 
may be that ia64 has opcodes that allow immediate operannds, obviating
the need for a 'data' consntat in memory.

Something in the source causes different processor-specific code to be
generated -- one processor uses 'data' constants, the other doesn't.


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org