mailing list of musl libc
 help / color / mirror / code / Atom feed
From: N Jain <jain61@gmail.com>
To: musl@lists.openwall.com, Markus Wichmann <nullplan@gmx.net>
Subject: Re: dynamic linker command line invocation
Date: Mon, 11 Jan 2016 12:03:37 -0500	[thread overview]
Message-ID: <CAOkOUeeB=ABJe0gLUYzDLMjNgC0-Jfek6k05k7BkqKPJ0+9NUg@mail.gmail.com> (raw)
In-Reply-To: <20160108110954.GC2016@debian>

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

Hi Marcus,

Thanks. I am able to get this part working.
I am facing one more issue during dynamic linking and need some help to
understand how to resolve it.

In below code part of __dls3 function I found that TPIDRURO register is
being used to read the threadId.
I would like to understand how kernel should set this value ?

As per my understanding kernel should allocate memory and set this register
for current task.
But when i do this in my kernel the values doesn't match up as MUSL is
using some "builtin_tls" ?

/* Temporarily set the tls size to the full size of
* builtin_tls so that __copy_tls will use the same layout
* as it did for before. Then check, just to be safe. */
libc.tls_size = sizeof builtin_tls;
if (__copy_tls((void*)builtin_tls) != self) a_crash();

Thanks,
NJ


On Fri, Jan 8, 2016 at 6:09 AM, Markus Wichmann <nullplan@gmx.net> wrote:

> On Thu, Jan 07, 2016 at 06:29:48PM -0500, N Jain wrote:
> > Hi Rich,
> >
> > Thanks I am able to get my dynamic linker loaded into memory but facing
> > issue during application load at __dls3 function.
> > I am getting following print from MUSL -
> >
> > "musl libc
> > Version 1.1.10
> > Dynamic Program Loader
> > Usage: hello.elf [options] [--] pathname--2--"
> >
> > Not sure why my application is not getting loaded in below code __dls3
> > function ?
> >
>
> That's what I was trying to tell you in my first answer: You need to set
> argv[0] to something (doesn't matter so long as it's not "ldd"), and
> argv[1] to the program file you want to run. (And argc to 2, obviously).
>
> The only alternative to that is to load the program file in the kernel
> additionally to musl, and then set the following aux vectors:
>
> AT_BASE - base address of dynamic linker
> AT_PHDR - address of main executable's program headers
> AT_PHNUM, AT_PHENT - number and size of main executable's program
> headers, respectively.
> AT_ENTRY - main executable's entry point
>
> Ciao,
> Markus
>

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

  reply	other threads:[~2016-01-11 17:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-04 16:59 N Jain
2016-01-04 19:22 ` Markus Wichmann
2016-01-04 20:52   ` Rich Felker
2016-01-04 20:59 ` Rich Felker
2016-01-05 16:45   ` N Jain
2016-01-05 17:32     ` Rich Felker
2016-01-05 18:00       ` N Jain
2016-01-05 18:23         ` Rich Felker
2016-01-07 23:29           ` N Jain
2016-01-08 11:09             ` Markus Wichmann
2016-01-11 17:03               ` N Jain [this message]
2016-01-12 16:24                 ` Markus Wichmann
2016-01-14 22:30                   ` 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='CAOkOUeeB=ABJe0gLUYzDLMjNgC0-Jfek6k05k7BkqKPJ0+9NUg@mail.gmail.com' \
    --to=jain61@gmail.com \
    --cc=musl@lists.openwall.com \
    --cc=nullplan@gmx.net \
    /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).