Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 4 Jan 2016 20:22:06 +0100
From: Markus Wichmann <nullplan@....net>
To: musl@...ts.openwall.com
Subject: Re: dynamic linker command line invocation

On Mon, Jan 04, 2016 at 11:59:16AM -0500, N Jain wrote:
> Hi All,
> 
> I am trying to add ldso functionality in my kernel. I am loading the
> dynamic linker "ld-musl-arm.so.1" into memory and passing the other
> application as command line which requires the dynamic libraries but the
> linker is generating fault during stage 2 "__dls2" at some random location
> 0x464cc57f.
> 

Why don't you just set ld-musl-arm.so.1 as dynamic interpreter and
launch the application through the kernel? (Link with -Wl,-I,/lib/ld...)

> I am fairly new to dynamic linking code and trying to understand _dlstart_c
> code functionality. Can any one explain what are the command line arguments
> dynamic linker expects at this entry point ? I am giving numArgs = 1 and
> argv = app.elf after loading "ld-musl-arm.so.1" into memory ? Is this
> approach correct ? Do I have to also load app.elf into memory or the
> dynamic linker will take care of loading it ?
> 

You say it's crashing stage 2, but only stage 3 handles arguments. In
any case, musl expects the application's ELF image in argv[1]. The rest
of argv is assumed to be the command line of the application. And
argv[0] is ignored, save for a comparison to "ldd" (if argv[0] ends in
"ldd", the dynlinker will just display all the loaded libraries).

> Thanks,
> NJ

Ciao,
Markus

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.