From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2466 invoked by alias); 27 Apr 2008 13:56:27 -0000 Received: (qmail 2457 invoked by uid 22791); 27 Apr 2008 13:56:26 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 27 Apr 2008 13:56:03 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id C2FC6983D9; Sun, 27 Apr 2008 13:56:01 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 8F43698371; Sun, 27 Apr 2008 13:56:01 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1Jq7MG-0002WB-N2; Sun, 27 Apr 2008 09:56:00 -0400 Date: Mon, 28 Apr 2008 13:48:00 -0000 From: Daniel Jacobowitz To: Mike Frysinger Cc: gdb@sourceware.org Subject: Re: the "load" command and the .bss section Message-ID: <20080427135600.GA9356@caradoc.them.org> Mail-Followup-To: Mike Frysinger , gdb@sourceware.org References: <200804270509.34308.vapier@gentoo.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200804270509.34308.vapier@gentoo.org> User-Agent: Mutt/1.5.17 (2007-12-11) X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-04/txt/msg00230.txt.bz2 On Sun, Apr 27, 2008 at 05:09:31AM -0400, Mike Frysinger wrote: > i was doing a new board port using jtag and so was leveraging the "load" > command to setup the initial ELF in the relevant memory regions. things kept > crashing on me and then i realized that the loading process wasnt actually > zeroing out the bss. is there a reason for this ? i googled and flipped > through the manual, but the details on what exactly the "load" command is > supposed to do is a bit on sketchy side. from what i can tell from the gdb > source code and the actual output from running the command, it walks the > section headers (rather than the program headers ?) and loads up everything > that is in the file. since the bss section doesnt actually exist in the file > and is only allocated, that is why it gets skipped ? Load puts things at their LMA rather than their VMA. So it assumes that whatever sets up load -> virtual also handles bss; it's more like flash programming than like the Linux kernel's loader. Heck, sometimes it is flash programming... IIRC we have a couple of old requests for a version of load which drops things at their VMA. That one would have to clear the BSS. -- Daniel Jacobowitz CodeSourcery