RESOLVED FIXED 30769
[gcc/unix] Export WTF::fastMalloc, WTF::fastFree, WTF::fastCalloc, WTF::fastRealloc
https://bugs.webkit.org/show_bug.cgi?id=30769
Summary [gcc/unix] Export WTF::fastMalloc, WTF::fastFree, WTF::fastCalloc, WTF::fastR...
Holger Freyther
Reported 2009-10-26 04:30:16 PDT
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.
Attachments
First attempt to export these symbols (3.34 KB, patch)
2009-10-26 04:38 PDT, Holger Freyther
no flags
Export the symbols in libwebkit.so as well (1.65 KB, patch)
2009-10-26 07:08 PDT, Holger Freyther
darin: review+
Export fastMalloc, fastFree, fastRealloc, fastCalloc with normal linkage (3.32 KB, patch)
2009-10-27 06:04 PDT, Holger Freyther
darin: review+
Holger Freyther
Comment 1 2009-10-26 04:38:17 PDT
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.
Holger Freyther
Comment 2 2009-10-26 07:08:41 PDT
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.
Darin Adler
Comment 3 2009-10-26 07:49:15 PDT
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?
Darin Adler
Comment 4 2009-10-26 07:50:14 PDT
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?
Holger Freyther
Comment 5 2009-10-26 08:00:31 PDT
(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.
Holger Freyther
Comment 6 2009-10-26 08:01:46 PDT
I'm going to build on Leopard tomorrow and will send an updated patch without the !PLATFORM(DARWIN)
Holger Freyther
Comment 7 2009-10-27 06:04:37 PDT
Created attachment 41945 [details] Export fastMalloc, fastFree, fastRealloc, fastCalloc with normal linkage The leopard build was fine, removing the !PLATFORM(DARWIN).
Darin Adler
Comment 8 2009-10-27 10:12:41 PDT
Comment on attachment 41865 [details] Export the symbols in libwebkit.so as well rs=me
Holger Freyther
Comment 9 2009-10-28 03:35:55 PDT
Landed in r50204 and r50205.
Note You need to log in before you can comment on or make changes to this bug.