* debugging information
@ 2002-07-04 15:15 Alina Valea
2002-07-04 16:37 ` Glynn Clements
2002-07-04 17:49 ` Elias Athanasopoulos
0 siblings, 2 replies; 3+ messages in thread
From: Alina Valea @ 2002-07-04 15:15 UTC (permalink / raw)
To: linux-c-programming
Hi everybody,
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?
Thanks, Alina
----
Home, no matter how far...
http://www.home.ro
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: debugging information
2002-07-04 15:15 debugging information Alina Valea
@ 2002-07-04 16:37 ` Glynn Clements
2002-07-04 17:49 ` Elias Athanasopoulos
1 sibling, 0 replies; 3+ messages in thread
From: Glynn Clements @ 2002-07-04 16:37 UTC (permalink / raw)
To: Alina Valea; +Cc: linux-c-programming
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?
The addresses are relative to the beginning of the section. The final
address isn't known until the various files are linked into an
executable.
--
Glynn Clements <glynn.clements@virgin.net>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: debugging information
2002-07-04 15:15 debugging information Alina Valea
2002-07-04 16:37 ` Glynn Clements
@ 2002-07-04 17:49 ` Elias Athanasopoulos
1 sibling, 0 replies; 3+ messages in thread
From: Elias Athanasopoulos @ 2002-07-04 17:49 UTC (permalink / raw)
To: Alina Valea; +Cc: linux-c-programming
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-07-04 17:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-04 15:15 debugging information Alina Valea
2002-07-04 16:37 ` Glynn Clements
2002-07-04 17:49 ` Elias Athanasopoulos
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).