Last Comment Bug 658251 - Wrong DT_NEEDED entries in libxul.so and libxpcom.so on Android fennec builds
: Wrong DT_NEEDED entries in libxul.so and libxpcom.so on Android fennec builds
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Build Config (show other bugs)
: Trunk
: ARM Android
: -- normal (vote)
: mozilla7
Assigned To: Mike Hommey [:glandium]
:
:
Mentors:
Depends on:
Blocks: 584474
  Show dependency treegraph
 
Reported: 2011-05-19 06:37 PDT by Mike Hommey [:glandium]
Modified: 2011-06-02 16:55 PDT (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Fix MK{,C}SHLIB when using wrap-malloc (2.88 KB, patch)
2011-05-24 06:46 PDT, Mike Hommey [:glandium]
ted: review+
Details | Diff | Splinter Review

Description Mike Hommey [:glandium] 2011-05-19 06:37:23 PDT
Taken from a nightly:

For libxpcom.so:
 0x00000001 (NEEDED)                     Shared library: [liblog.so]
 0x00000001 (NEEDED)                     Shared library: [libmozalloc.so]
 0x00000001 (NEEDED)                     Shared library: [libmozutils.so]
 0x00000001 (NEEDED)                     Shared library: [../../dist/lib/libxul.so]
 0x00000001 (NEEDED)                     Shared library: [libplds4.so]
 0x00000001 (NEEDED)                     Shared library: [libplc4.so]
 0x00000001 (NEEDED)                     Shared library: [libnspr4.so]
 0x00000001 (NEEDED)                     Shared library: [libdl.so]
 0x00000001 (NEEDED)                     Shared library: [../../dist/lib/libmozalloc.so]
 0x00000001 (NEEDED)                     Shared library: [libm.so]
 0x00000001 (NEEDED)                     Shared library: [libc.so]

For libxul.so:
 0x00000001 (NEEDED)                     Shared library: [liblog.so]
 0x00000001 (NEEDED)                     Shared library: [libmozalloc.so]
 0x00000001 (NEEDED)                     Shared library: [libmozutils.so]
 0x00000001 (NEEDED)                     Shared library: [../../dist/lib/libmozsqlite3.so]
 0x00000001 (NEEDED)                     Shared library: [libsmime3.so]
 0x00000001 (NEEDED)                     Shared library: [libssl3.so]
 0x00000001 (NEEDED)                     Shared library: [libnss3.so]
 0x00000001 (NEEDED)                     Shared library: [libnssutil3.so]
 0x00000001 (NEEDED)                     Shared library: [libz.so]
 0x00000001 (NEEDED)                     Shared library: [libplds4.so]
 0x00000001 (NEEDED)                     Shared library: [libplc4.so]
 0x00000001 (NEEDED)                     Shared library: [libnspr4.so]
 0x00000001 (NEEDED)                     Shared library: [libdl.so]
 0x00000001 (NEEDED)                     Shared library: [../../dist/lib/libmozalloc.so]
 0x00000001 (NEEDED)                     Shared library: [libGLESv2.so]
 0x00000001 (NEEDED)                     Shared library: [libm.so]
 0x00000001 (NEEDED)                     Shared library: [libc.so]

Our dynamic linker might be permissive, but this is still wrong (the ../../dist/lib paths)
Comment 1 Mike Hommey [:glandium] 2011-05-24 02:56:59 PDT
It turns out the problem is that libxul.so, libmozalloc.so and libmozsqlite3.so don't have an soname.
Comment 2 Mike Hommey [:glandium] 2011-05-24 03:02:07 PDT
And this is due to --enable-wrap-malloc.
Comment 3 Mike Hommey [:glandium] 2011-05-24 06:46:56 PDT
Created attachment 534751 [details] [diff] [review]
Fix MK{,C}SHLIB when using wrap-malloc
Comment 4 Mike Hommey [:glandium] 2011-05-24 06:49:55 PDT
Corresponding try build:
http://tbpl.mozilla.org/?tree=Try&rev=660a27381d2c
Comment 5 Ted Mielczarek [:ted.mielczarek] 2011-05-26 06:49:38 PDT
I don't really understand what's broken here. Can you expound?
Comment 6 Mike Hommey [:glandium] 2011-05-26 07:20:02 PDT
(In reply to comment #5)
> I don't really understand what's broken here. Can you expound?

The DT_NEEDED entries in libxul.so and libxpcom.so contain paths (to the dist directory) instead of sonames for libxul.so, libmozsqlite3 and libmozalloc.so. DT_NEEDED is what the dynamic linker uses to know what libraries to load. It searches the DT_NEEDED values in the ld.so.config paths and LD_LIBRARY_PATH. I haven't looked why exactly it doesn't care about the fact that some values contain a path already. I'd actually expect something similar to fail on a desktop environment.

This happens because these libraries are linked without the necessary -Wl,-h,$SONAME option passed to the linker, and this in turn happens because --enable-wrap-malloc resets the MKSHLIB value instead of adding what it wants to it.
Comment 7 Ted Mielczarek [:ted.mielczarek] 2011-06-02 10:59:44 PDT
Comment on attachment 534751 [details] [diff] [review]
Fix MK{,C}SHLIB when using wrap-malloc

Review of attachment 534751 [details] [diff] [review]:
-----------------------------------------------------------------

Okay, thanks. I apparently failed to parse your changes the first time.
Comment 8 Mike Hommey [:glandium] 2011-06-02 16:55:21 PDT
http://hg.mozilla.org/mozilla-central/rev/58b25606c605

Note You need to log in before you can comment on or make changes to this bug.