question regarding link_elf.c

PL kadupl at wp.pl
Wed Sep 29 08:45:05 UTC 2010


Hi everyone,
I'm not quiet sure if it is proper place to ask the question I have. If 
not, please
direct me to the correct place I should post questions like:

Im working on some modifications around link_elf.c. According to elf(5) 
man pages,
Elf_Shdr structure contains field called 'sh_addr', containing the 
address at
which first byte of a section shall reside in the memory image. I am 
particularily
interested in '.text' and '.data' sections. After link_elf_load_file() 
loads the
file into a memory, we have linker_file structure filled in, including 
'address'
field. Now, assuming 'lf' being linker_file_t, already filled in by the 
loading
routine, 'text_sh' being 'Elf_Shdr' for text section, and 'data_sh' 
being 'Elf_Shdr'
for data section:
- lf->address + text_sh.sh_addr really points to the beginning of a 
'.text' section
  in memory, however..

- lf->address + data_sh.sh_addr does not point to the valid location of 
'.data' section
  in memory.

Sorry if my question is stupid, but im wondering why it is so ? I guess 
it has something
to do with virtual memory mapping (?).

Thanks in advance for your kind help.




More information about the freebsd-hackers mailing list