Date: prev next · Thread: first prev next last
2010 Archives by date, by thread · List index


On Thu, 2010-12-09 at 23:39 +0100, Julien Nabet wrote:
Hello,

First try to remove call-catcher / bloat removal with 
sc/source/core/tool/chgtrack.cxx and sc/inc/chgtrack.hxx

Looks good to me. Pushed this now. Thanks for this. IMO this is the good
stuff, code that cannot be called under any circumstances but is always
built and included in the binaries :-)

I made a ./g grep AppendContent * on the whole project, i found it only 
on sc module
I made a build and this file compiled ok but i had an error after so...

I assume your error was the one mentioned in the other thread. That
error is unrelated to this. Your change is fine.

I made a ./g grep dlsym * on sc
How to be sure the function isn't called by dlsym ?

In general this is hard, because it could also be called indirectly by
one of the dlsym wrappers, e.g. osl_getFunctionSymbol and friends.

For example, must we check if a dlsym on the function AppendContent of 
the class 

The good news though is that noone, in practice, dlsyms any name mangled
symbols. So you don't need to check for the general case of class
methods or normal C++ functions, *except* for extern "C" methods which
are not name-mangled, which makes them practical to dlsym.

Let me demo this to make it clear.

class ScChangeTrack
{
public:
    void AppendContent();
};

void ScChangeTrack::AppendContent()
{
}

void mangled_impractical_to_dlsym()
{
}

extern "C" void notmangled_practical_to_dlsym()
{
}

gcc -c foo.cxx
nm foo.o

00000005 T _Z29mangled_impractical_to_dlsymv
00000000 T _ZN13ScChangeTrack13AppendContentEv
0000000a T notmangled_practical_to_dlsym

See, the extern "C" function isn't mangled so someone could plausibly
dlsym it. e.g. a common one in LibreOffice which does get dlsymed is
extern "C" component_writeInfo. But everything else gets mangled
according to each compilers different name mangling rules. So noone
dlsyms on those, so you don't have to care about them if they are C++
symbols. 

Obvious rule of thumb then is that if they are members of a class they
won't be dlsymed. If there are normal functions then they definitely
won't be dlsymed unless they are in a .c file or unless they are extern
"C", in which case they might be.

C.


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.