mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Andrei Pozolotin <andrei.pozolotin@gmail.com>
To: musl@lists.openwall.com
Subject: Re: musl ldd: swt build: Error relocating / symbol not found
Date: Fri, 24 Jun 2016 16:23:55 +0000	[thread overview]
Message-ID: <576D5E9B.4070608@gmail.com> (raw)
In-Reply-To: <20160623231527.GZ22574@port70.net>

[-- Attachment #1: Type: text/plain, Size: 3046 bytes --]

Szabolcs:

On 06/23/2016 11:15 PM, Szabolcs Nagy wrote:
> * Andrei Pozolotin <andrei.pozolotin@gmail.com> [2016-06-23 19:42:44 +0000]:
>> b) while at the same time musl ldd reporting that library dependency
>> tree is resolved with no error:
>>
>> lddtree /usr/lib/libswt-atk-gtk-4530.so
> that's not musl's ldd, but scanelf from pax-utils
thank you for pointing out.
> when debugging such a complicated setup the output
> of tools that may use subtly different library paths
> and symbol resolution logic is not very helpful.
ok, got it.
> ldd /usr/lib/libswt-gtk-4530.so
ldd /usr/lib/libswt-gtk-4530.so
        ldd (0x55e333e6c000)
        libc.musl-x86_64.so.1 => ldd (0x55e333e6c000)
> ldd /usr/lib/libswt-atk-gtk-4530.so
ldd /usr/lib/libswt-atk-gtk-4530.so
        ldd (0x55edc6edc000)
        libatk-1.0.so.0 => /usr/lib/libatk-1.0.so.0 (0x7fc763298000)
        libc.musl-x86_64.so.1 => ldd (0x55edc6edc000)
        libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x7fc763058000)
        libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x7fc762d6d000)
        libintl.so.8 => /usr/lib/libintl.so.8 (0x7fc762b5f000)
        libffi.so.6 => /usr/lib/libffi.so.6 (0x7fc762957000)
        libpcre.so.1 => /usr/lib/libpcre.so.1 (0x7fc7626fe000)
> would be more interesting..
>
> but even then we don't know what's going on
> (if libswt-gtk-4530.so is dlopened with RTLD_LOCAL
> then its libgobject dependency might not be visible
> to libswt-atk-gtk-4530)
OK. here is the story:

* java native interface: NativeLibrary.load()
http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/74e5fc94c77b/src/share/classes/java/lang/ClassLoader.java#l1726

* java JNI implementation:
Java_java_lang_ClassLoader_00024NativeLibrary_load
http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/74e5fc94c77b/src/share/native/java/lang/ClassLoader.c#l369

* libjvm.so entry point: os::dll_load
http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/file/tip/src/share/vm/prims/jvm.cpp#l3959

* libjvm.so linux implementation
http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/file/4529ee76d3f9/src/share/vm/runtime/os.hpp#l564
http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/file/4529ee76d3f9/src/os/linux/vm/os_linux.cpp#l1773
http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/file/4529ee76d3f9/src/os/linux/vm/os_linux.cpp#l1767
http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/file/4529ee76d3f9/src/os/linux/vm/os_linux.cpp#l1997
http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/file/4529ee76d3f9/src/os/linux/vm/os_linux.cpp#l1988

* and finally: it says: dlopen RTLD_LAZY:
http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/file/4529ee76d3f9/src/os/linux/vm/os_linux.cpp#l1988
void * result = ::dlopen(filename, RTLD_LAZY);

http://linux.die.net/man/3/dlopen
RTLD_LAZY: Perform lazy binding. Only resolve symbols as the code that
references them is executed.
If the symbol is never referenced, then it is never resolved.
(Lazy binding is only performed for function references;
references to variables are always immediately bound when the library is
loaded.)

RTLD_LAZY is good, right? :-)


[-- Attachment #2: Type: text/html, Size: 6700 bytes --]

  reply	other threads:[~2016-06-24 16:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-23  3:35 Andrei Pozolotin
2016-06-23  4:24 ` Rich Felker
2016-06-23 15:39   ` Andrei Pozolotin
2016-06-23 17:10     ` Rich Felker
2016-06-23 19:42       ` Andrei Pozolotin
2016-06-23 23:15         ` Szabolcs Nagy
2016-06-24 16:23           ` Andrei Pozolotin [this message]
2016-06-24 17:03             ` Rich Felker
2016-06-24 17:17               ` Alexander Monakov
2016-06-24 17:30                 ` Andrei Pozolotin
2016-06-24 21:41                 ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=576D5E9B.4070608@gmail.com \
    --to=andrei.pozolotin@gmail.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).