From: "Steven J. Hill" <sjhill@cotw.com>
To: binutils@sources.redhat.com, linux-mips@oss.sgi.com, uclibc@uclibc.org
Subject: Linux/MIPS and ELF dynamic linker/loader questions...
Date: Wed, 27 Mar 2002 15:03:50 -0600 [thread overview]
Message-ID: <3CA233B6.58DB8B08@cotw.com> (raw)
Greetings.
I am working on a MIPS dynamic linker/loader for uClibc and
would appreciate some clarification on the finer points of
ELF and the Linux kernel interface. Forgive the cross post.
The first problem I have discovered is that the value of
argc passed back to the userspace process from the Linux
kernel is always zero. The argv, environment and auxillary
vectors come through just fine. I have to loop through the
stack manually to count the number of argument vectors in
order to get argc:
#if defined(__mips__)
argc = 0;
aux_dat = sp + 1;
while (*aux_dat++)
argc++;
#endif
This code snippet is the first code to execute in the dynamic
linker, so no trashing of argc should have had a chance to
happen. Any insight?
The second question has to do with printing string constants
to stderr like so:
static inline _syscall3(unsigned long, _dl_write, int, fd,
const void *, buf, unsigned long, count);
#define SEND_STDERR(X) _dl_write(2, X, _dl_strlen(X));
SEND_STDERR("ELF header =");
The problem as I understand it is that string constants for
MIPS are accessed using the GOT (since the dynamic linker is
all PIC code). Since I haven't bootstrapped and relocated the
dynamic linker yet, the above SEND_STDERR call causes a SEGFAULT
as the address is invalid. Also, it appears that the constants
are stored in the .rodata section. Is there a quick hack to get
a hold of the string constants? Flames, help, etc. appreciated.
-Steve
--
Steven J. Hill - Embedded SW Engineer
next reply other threads:[~2002-03-27 21:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-27 21:03 Steven J. Hill [this message]
2002-03-27 21:09 ` Linux/MIPS and ELF dynamic linker/loader questions Andreas Jaeger
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=3CA233B6.58DB8B08@cotw.com \
--to=sjhill@cotw.com \
--cc=binutils@sources.redhat.com \
--cc=linux-mips@oss.sgi.com \
--cc=uclibc@uclibc.org \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox