From owner-freebsd-hackers@FreeBSD.ORG Sun Sep 2 02:44:15 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5868B1065676 for ; Sun, 2 Sep 2012 02:44:15 +0000 (UTC) (envelope-from asp654@gmail.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id D10628FC12 for ; Sun, 2 Sep 2012 02:44:14 +0000 (UTC) Received: by lbbgg13 with SMTP id gg13so2334548lbb.13 for ; Sat, 01 Sep 2012 19:44:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=ympajSYfjMS+HexIhae40BY1aMbMEJqJ6+kfRuaIDIU=; b=Ns4FbN0zwArDdYAZdJFRcNS50QcXVxHoVYshK/RHU/JX3KX7UU7nF06CdgZlvDs5RB BwdDtufLmJWaK80HDgwEBKu7e6IEtsDVRTgN4n+xbzXA3GryTX/ANGNWVpBQnZqEnAxU Quy6sDK1rsi7QDxVGSKCsDdkBsFKkh0+S6Ad2fvsaKm9cQwgTGoJ9CEy7hlC4S/ZyOBT K5hmCYS5W89bnmdSbl73sSOJrgxgwb9iuuZ8P2oXECv2LVtDmDkVIhcACvo+X6ul5Gpp XkKWWgxzyHQlD//3g1wGhVBYBbksZqWuEw/27YiZOyWOGku2zgMmj9XsNSdVNIcYGf49 uzOg== MIME-Version: 1.0 Received: by 10.112.31.170 with SMTP id b10mr4018310lbi.67.1346553853531; Sat, 01 Sep 2012 19:44:13 -0700 (PDT) Received: by 10.112.106.73 with HTTP; Sat, 1 Sep 2012 19:44:13 -0700 (PDT) Date: Sat, 1 Sep 2012 19:44:13 -0700 Message-ID: From: asp imho To: freebsd-hackers@freebsd.org X-Mailman-Approved-At: Sun, 02 Sep 2012 02:58:40 +0000 Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: start of text section in the ELF executable and in the Virtual Memory X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Sep 2012 02:44:15 -0000 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 , 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.