Closed
Bug 539188
Opened 16 years ago
Closed 15 years ago
Fix jemalloc linkage for Solaris builds
Categories
(Firefox Build System :: General, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: ginnchen+exoracle, Assigned: ginnchen+exoracle)
References
Details
Attachments
(3 files, 1 obsolete file)
10.70 KB,
patch
|
ted
:
review-
|
Details | Diff | Splinter Review |
8.40 KB,
patch
|
ted
:
review+
|
Details | Diff | Splinter Review |
3.99 KB,
patch
|
Callek
:
review+
|
Details | Diff | Splinter Review |
The problem was introduced since Bug 534848.
Firefox failed to build on Solaris for a certain situation, --enable-jemalloc --disable-libxul
It does't happen for --enable-libxul, which is default, because libxul.so depends on libmozjs.so, libmozjs.so links libjemalloc.a.
Currenly, on Solaris, libjemalloc.a is linked into libmozjs.so and firefox-bin.
I think it is not good.
Actually, libmozjs no longer uses posix_memalign on Solaris now, so it doesn't need to link with jemalloc.
To clean up the mess of jemalloc on Solaris.
I think the best solution is to link libjemalloc.a in libxpcom_core (if --disable-libxul) / libxul (if --enable-libxul) with some special flags.
In Bug 515354 comment #14, Benjamin Smedberg concerns link jemalloc into libxul would totally screw over all the embedders.
That's true if direct binding is used within the shared object.
Linking direct binding within shared object is off by default on Solaris, user may has "-B direct" in his LDFLAGS.
To avoid that from happening, we can use
1) -B nodirect, which would generate an error if "-B direct" is used.
2) use mapfile to disable direct binding for malloc functions.
I'd like take option 2), so that user can still have the benefits of "-B direct" for other functions.
Also we should use "-z interpose" for the shared object that has malloc functions. It can avoid some troubles.
And I just learned with this options we don't need to link libjemalloc into *-bin, we don't need to put libjemalloc ahead of other libraries while linking.
Another benefit of linking libjemalloc to libxpcom_core/libxul not browser-app or xulrunner-stub is we can switch to other memory allocator library by LD_PRELOAD at runtime.
IMO, it is a cleaner solution.
Comment on attachment 421227 [details] [diff] [review]
patch
Missed jemalloc_solaris.map in this patch.
Also I think we'd put jemalloc_solaris.map at $topsrc/config, because in js/src $topsrc/memory/jemalloc doesn't exist.
Attachment #421227 -
Flags: review?(benjamin)
This also works fine with GRE_HOME situation, then malloc in jemalloc wouldn't be used by any library.
Attachment #421227 -
Attachment is obsolete: true
Attachment #423331 -
Flags: review?(benjamin)
Comment 4•16 years ago
|
||
Comment on attachment 423331 [details] [diff] [review]
patch
I really do not think we should support a different mechanism for Solaris than for Linux, but Ted's the owner and would have to bear the maintenance costs.
Attachment #423331 -
Flags: review?(benjamin) → review?(ted.mielczarek)
Either way, this is a bug we need to fix for Solaris. Move forward, or go back to what Linux does.
I would be more than thankful if this patch can be accepted, it would make my life much easier.
Comment 6•16 years ago
|
||
I'm not really comfortable reviewing this, since I don't understand linker mechanics quite that well.
Comment 7•15 years ago
|
||
Comment on attachment 423331 [details] [diff] [review]
patch
Yeah, I don't want this. If you have to, error in --disable-libxul --enable-jemalloc builds, that's fine.
Attachment #423331 -
Flags: review?(ted.mielczarek) → review-
The patch here is not just to fix "--disable-libxul --enable-jemalloc" buids.
The essential of the patch is to link libjemalloc.a into libxul.so/libxpcom_core.so with proper link map and flag.
Currently, libjemalloc.a is linked into both firefox-bin and libmozjs.so, it is very fragile.
Well, if you don't want that, I've no choice but back out all the tricks of jemalloc on Solaris, and disable jemalloc by default on Solaris.
Then there's no different of using jemalloc between Linux and Solaris.
BTW: I think Linux distro doesn't really use jemalloc in their ship of Firefox.
Of course, I have to revert Bug 543848 and cross my fingers waiting Bug 520422 be fixed and the fix is portable to Solaris.
Attachment #431066 -
Flags: review?(ted.mielczarek)
Updated•15 years ago
|
Attachment #431066 -
Flags: review?(ted.mielczarek) → review+
Assignee | ||
Comment 10•15 years ago
|
||
Assignee | ||
Comment 11•15 years ago
|
||
Attachment #443815 -
Flags: review?(bugspam.Callek)
Updated•15 years ago
|
Attachment #443815 -
Flags: review?(bugspam.Callek) → review+
Comment 12•15 years ago
|
||
Comment on attachment 443815 [details] [diff] [review]
for comm-central
r+ by simple compare vs what ted approved for m-c.
Assignee | ||
Comment 13•15 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Updated•7 years ago
|
Product: Core → Firefox Build System
You need to log in
before you can comment on or make changes to this bug.
Description
•