mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Richard B. Johnson" <root@chaos.analogic.com>
To: Linux kernel <linux-kernel@vger.kernel.org>
Subject: Shared Library starter, ld.so
Date: Thu, 5 Jun 2003 10:46:18 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.53.0306051045180.6171@chaos> (raw)


I know this is not a Kernel problem but... it is an
embedded system problem using Linux with a very
minimal (homemade) 'C' runtime library.

The dynamic linker, provided with RedHat 9 no longer
compiles with the de facto standard of having register
EDX point to function to be called before exit.

This is (was) the relevent rule:

#
#	This is the entry point, usually the first thing in the text
#	segment. The SVR4/i386 ABI (pages 3-31, 3-32) says that upon
#	entry most registers' values are unspecified, except for:
#
#   %edx	Contains a function pointer to be registered with `atexit'.
#   		This is how the dynamic linker arranges to have DT_FINI
#		functions called for shared libraries that have been loaded
#		before this code runs.
#
#   %esp	The stack contains the arguments and environment:
#   		0(%esp)			argc
#		4(%esp)			argv[0]
#		...
#		(4*argc)(%esp)		NULL
#		(4*(argc+1))(%esp)	envp[0]
#		...
#					NULL

Now the register contains junk, so if it was used as a function-
pointer, the code will seg-fault.

How does code 'know' not to call this function? If this is
no longer used, then EDX must be set to zero to let the start-up
code know not to call it.

I tried to find the source-code for ld.so (ld-linux.so.2) used with
this version and was not able to find it anywhere.


Cheers,
Dick Johnson
Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips).
Why is the government concerned about the lunatic fringe? Think about it.


             reply	other threads:[~2003-06-05 14:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-05 14:46 Richard B. Johnson [this message]
2003-06-06 10:13 ` Richard Henderson
2003-06-06 11:34   ` Richard B. Johnson
2003-06-06 21:10     ` Richard Henderson

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=Pine.LNX.4.53.0306051045180.6171@chaos \
    --to=root@chaos.analogic.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®