From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/9051 Path: news.gmane.org!not-for-mail From: Markus Wichmann Newsgroups: gmane.linux.lib.musl.general Subject: Re: dynamic linker command line invocation Date: Mon, 4 Jan 2016 20:22:06 +0100 Message-ID: <20160104192206.GB2016@debian> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1451935349 6961 80.91.229.3 (4 Jan 2016 19:22:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 4 Jan 2016 19:22:29 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-9064-gllmg-musl=m.gmane.org@lists.openwall.com Mon Jan 04 20:22:24 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1aGAhx-0005zt-Uk for gllmg-musl@m.gmane.org; Mon, 04 Jan 2016 20:22:22 +0100 Original-Received: (qmail 20218 invoked by uid 550); 4 Jan 2016 19:22:19 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 20194 invoked from network); 4 Jan 2016 19:22:18 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Provags-ID: V03:K0:82K3uPbxVO1Egmx202mZqT8g7Zg5ujqTND/bg0ZjPsBzHafl73H QDH+mSy8I0AFRXwNWgGCmb0M7y44ILOqsBovUQZK0TQV5XE0w4Agfx22T0EmsT/2RbiW6V3 NmtcWfuI1yVZBQRpY0+6LllZWIWAsY3vxPMBee9c/Z1J9JP/TKQpSNAA+U/T3TX7EFFs0wt 5oonKy43DUPabQIFkhluQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:H2rGNndq/Js=:ZY1bgEjKENvmJvr9M4l/mY V38/8RQVY3MahocxR2qrS4rI002C59Jhq3oeXUroJ4NyabeXMj4ZFqTI4aqZazIudfbeYvIKa pOKsnugdwTEitrMTVy6pWWd6MGoAYKYAsJco5gq0IX7+Pl8av/8KYT+0vxP3xpk7brg2aOdfD CCv0YKC/e6kSSyZL2cV3q/o1pw8MQvpMbzPZNq5DEtmcW0W54Bnt9wGz4nbqMDxkS0aIPph9b sI2hAZLu1MToBGGbt1Km9v2kehBP7TbNVMue/tL/t92MGscqfQhAYDxxtiJC0CAKZc7JWu6j+ dA7rWyQ1o++wltcW0lmdrJG4TUhcfDXmFZqC5ovtGuCjaQeJsrzmPD2dlw0lclEAgvEj9ZAet hAChQINcOV8gskJMnRrBCBV2VcoekIxoA294J5TMkEr2NuX0KR3+CK82NXPJsqOc9NZgD0+jN fsF91EZSPI8CAxCwXnY8kayvDNWdg5iytckTv27f7kHgJ+87wDUJme3kvpBRf0bI7c49sYuHi J5Hn4ezvKCcdWiDU6Osy7XPIGAzbIHwY8JEzqkXZ1La0yQM9yRU6kt4xjjzfsupyngaIuMKdB 4a/juMQ3cTcz7eXu0skccKK17U52AOG4UmcrGwS80SBNVSFtXLB+pjft7kwrrvNAkTNMCN9nG kPfZMalNa9D63Qo2xjxwcccJLmiUndQ7tSMtUyxxf+hxeZCBk6AEzDAN8Br4w9CeaoGY+3rg7 Q+HuUIGvWv2sKYpJQ2rYdb9Wn9kmhKTbMutH08plCCh2pbFNdFNPoNNDAAsRgS0SdL9omVqH Xref: news.gmane.org gmane.linux.lib.musl.general:9051 Archived-At: 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