Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130115184820.GA20323@brightrain.aerifal.cx>
Date: Tue, 15 Jan 2013 13:48:20 -0500
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com, pierre@...entlife.com
Subject: Re: dladdr()

On Tue, Jan 15, 2013 at 03:54:44PM +0100, pierre wrote:
> Latest musl-libc dladdr() fails here:
> 
>    // glibc:
>    // gcc hello.c -o hello -ldl
>    //
>    // ret:1
>    // dli_fname:./hello:0x400000
>    // dli_sname:puts:0x4004c0
> 
>    // musl:
>    // musl-gcc hello.c -o hello
>    //
>    // ret:0
>    // dli_fname:(null):0
>    // dli_sname:(null):0
> 
>    Dl_info dl = {0};
>    int ret = dladdr(puts + 0, &dl);
> 
>    printf("ret:%d\n"
>            "dli_fname:%s:%p\n"
>            "dli_sname:%s:%p\n\n",
>            ret,
>            dl.dli_fname, dl.dli_fbase,
>            dl.dli_sname, dl.dli_saddr);
> 
> What is missing to make this work?

Are you using static or dynamic linking? If static, dladdr is just a
stub that always fails. It could be implemented to work under some
conditions, but it would be highly dependent on what options you
compile the binary with, since by default static binaries do not
contain the bloat that would be needed to perform introspection.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.