Hi Matt,

your approach is flawed in the way that a symbol which is defined *and* used in one shared library is not flagged "UNDEF" in this library, but still be exported from the library if it's possibly used elsewhere. Thus you get a lot of exported symbols without equivalent "UNDEF" for shared library internal stuff.

This is an unfortunate consequence of the C++ standard which has no concept of shared library "internal" classes/methods/functions.

We do something about this: Please look for all the *_DLLPUBLIC and *_DLLPRIVATE macros in our headers. These macros use non standard compiler extensions to mark symbols as "public" or "hidden". "Hidden" symbols will not be exported from a shared library. This has at least three benefits: a better API definition (think of encapsulation), smaller binaries and last not least better startup performance because relocations are cheaper if direct binding can be used.

There is a great paper about the working of shared libraries by Ulrich Drepper: http://people.redhat.com/drepper/dsohowto.pdf

We probably got quite a bit of dead code in OOo but it is not easily found. I think the best approach would be to do some extensive coverage studies, identify possibly dead code, use a cross referencer to find all references whrere a symbol is used and determine if this is also dead code. The call to remove the dead code must then be made by the responsible developer, only he/she can tell if that symbol may not possibly be referenced by some code outside OOo (ie a third party component).

HTH,
  Heiner


Matt Prazak wrote:
--- Laurent David <[EMAIL PROTECTED]> wrote:

Wouldn't it be a problem with virtual methods ?
I had some problem figuring out what was actually executed when using
XML filter: it goes from the swlib to xmloff library (I don't
remember the name of the actual .so, sorry...) back and forth via
some virtual methods, the only way I found to be sure of it on was
to make some trace with a debugger,
because a simple static analysis of the code didn't give me any good
result.
If you have another method, it will be much appreciated because it
was really a painful experience :(
My opinion is that OpenOffice is a very good product but it is still
very "closed" in term of knowledge of its internal : not a lot of
comment in the sources, no available conception document (the information of the SDK can be very helpful but has its limits)...
I know that I am asking a lot but in some ways
it could be good to make an effort in this direction in order to get
more people to be involved in development. Cleaning up the code and
especially removing the dead and/or the duplicate code could be a
great part of solution.
I wish you the best in your search of the "losts symbols" :)


Laurent



Well, I'm still learning about this.  The current method I'm working on
is to use the elfdump utility in Solaris to extract the symbol tables
from all the *.so* and *.bin files in the program/ directory, then
extract the UNDEF and non-UNDEF entries into two text files, grep out
all the symbols I think can be ignored, and generate a list of all the
defined symbols that don't have UNDEF counterparts.  Right now, I have
a shell script that attempts to do this.  Unfortunately, the best I've
done so far indicates about 66,000 unused symbols (an improvement over
75K, though).

I'm not sure if this approach is flawed in some ways, but it seemed
like the most direct approach to the problem.  If anyone knows more
about ELF binaries, a critique of the above approach would be helpful,
especially since my knowledge of C++ is pretty stale.

Matt





__________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--
Jens-Heiner Rechtien
[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to