Date: Sat, 1 Sep 2012 19:44:13 -0700 From: asp imho <asp654@gmail.com> To: freebsd-hackers@freebsd.org Subject: start of text section in the ELF executable and in the Virtual Memory Message-ID: <CALGwOvK74qKQBCf4eoMcv%2Bj4obOg0u5X1ML3b88PnLW_NjJ8JQ@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Hi all, I've a generic question about how the program looks before and after it is loaded into the memory. I see that the TEXT_START_ADDR = 0x08048000 (found this in ~src/contrib/binutils/ld/emulparams/elf_i386.sh) when I do a procstat -v <PID>, I see some thing like this PID START END PRT ......... PATH 2126 0x8048000 0x0804a000 r-x ......... /bin/cat I see that the VM address is same as that of the TEXT_START_ADDR. Does this mean that the actual begining of the program statement, `cat` in this case, has a VM address of 0x8048000. Looking at the Permission Flags (PRT = r-x) I assumed this is the text section. But when I do a objdump of /bin/cat (cmd: `objdump -D /bin/cat`), I see that there is a section named `.interp` starting at 0x8048134 and not 0x8048000. And the .text section starts from 0x8048b40 and there is no instruction at address 0x8048000. Can someone please tell me why is this so? and what exactly will be present in the memory from 0x8048000 and 0x8048134. Thanks.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CALGwOvK74qKQBCf4eoMcv%2Bj4obOg0u5X1ML3b88PnLW_NjJ8JQ>