linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Elias Athanasopoulos <eathan@otenet.gr>
To: Alina Valea <avalea@home.ro>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: debugging information
Date: Thu, 4 Jul 2002 20:49:04 +0300	[thread overview]
Message-ID: <20020704204904.B17532@neutrino.particles.org> (raw)
In-Reply-To: <20020704151533.27201.qmail@relay1.home.ro>; from avalea@home.ro on Thu, Jul 04, 2002 at 03:15:33PM -0000

On Thu, Jul 04, 2002 at 03:15:33PM -0000, Alina Valea wrote:
> When I objdump the debugging information from an object file
> I see that there is already an address assigned to each line
> of code. I wonder if those are memory addresses, and if so,
> how can they be assigned at compilation time? Aren't the
> memory addresses supposed to be assigned by the kernel at
> runtime?

Yes they are. They are fixed addresses and the kernel (or the dynamic
loader) must map the executable (or the object files) in the correct
address space in order to have a normal execution.

Speaking specifically for the ELF format, what I said is achieved using
relocation techniques, when the executable is not linked statically;
the static case is quite easy, you just map the elf to the right memory
page and then jump to its entry point (e_entry field in the elf struct).

You will probably understand the whole thing better by reading the ELF
specification:

	www.muppetlabs.com/~breadbox/software/ELF.txt

Elias

-- 
http://gnewtellium.sourceforge.net			MP3 is not a crime.	

      parent reply	other threads:[~2002-07-04 17:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-04 15:15 debugging information Alina Valea
2002-07-04 16:37 ` Glynn Clements
2002-07-04 17:49 ` Elias Athanasopoulos [this message]

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=20020704204904.B17532@neutrino.particles.org \
    --to=eathan@otenet.gr \
    --cc=avalea@home.ro \
    --cc=linux-c-programming@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;
as well as URLs for NNTP newsgroup(s).