All non darwin gcc targets build JSC with -fvisibility=hidden hiding the FastMalloc functions. For malloc analysis it is handy to be able to preload an instrumented version of the above functions. The proposed change is to use __attribute__((visibility("default"))) on GCC systems.
Created attachment 41859 [details] First attempt to export these symbols Use __attribute__((visibility("default"))) to export the allocation functions again. On Mac these symbols are exported via the .exp file and available to the WebCore/WebKit library.
Created attachment 41865 [details] Export the symbols in libwebkit.so as well Export the FastMalloc functions in the .so file as well. This is the last step to be able to instrument a TCmalloc enabled libwebkit with memprof.
Comment on attachment 41859 [details] First attempt to export these symbols > +#if COMPILER(GCC) && !PLATFORM(DARWIN) > +#define WTF_FAST_MALLOC_EXPORT __attribute__((visibility("default"))) > +#else > +#define WTF_FAST_MALLOC_EXPORT > +#endif Why ~PLATFORM(DARWIN)"? If you are using __attribute__ then you should also use __visibility__. Is it really helpful to do this just for these functions? Doesn't this need to be done consistently across the rest of JavaScriptCore?
Oh, I see now. You're saying this is good "for malloc analysis". Still, why the !PLATFORM(DARWIN) part? Would this change cause a problem on that platform?
(In reply to comment #4) > Oh, I see now. You're saying this is good "for malloc analysis". Ironically I'm working/using a tool that went from Corel -> Eazel -> GNOME into my hands. I'm using LD_PRELOAD to load my version of malloc and this fails with a release build of WebKit. One option would have been to instrument the mmap/sbrk calls but then I just see calls to TCSystem_Alloc. > Still, why the !PLATFORM(DARWIN) part? Would this change cause a problem on > that platform? My assumption is that it is going to work as visibility should be okay with any gcc4.x release. On a mac build these symbols should have "default" visibility and saying they are default should be harmles. I just tried to minimize the risk of breaking a build on a file that is included by almost everything.
I'm going to build on Leopard tomorrow and will send an updated patch without the !PLATFORM(DARWIN)
Created attachment 41945 [details] Export fastMalloc, fastFree, fastRealloc, fastCalloc with normal linkage The leopard build was fine, removing the !PLATFORM(DARWIN).
Comment on attachment 41865 [details] Export the symbols in libwebkit.so as well rs=me
Landed in r50204 and r50205.