This is the mail archive of the
mailing list for the GDB project.
Re: the "load" command and the .bss section
- From: Daniel Jacobowitz <drow at false dot org>
- To: Mike Frysinger <vapier at gentoo dot org>
- Cc: gdb at sourceware dot org
- Date: Sun, 27 Apr 2008 09:56:00 -0400
- Subject: Re: the "load" command and the .bss section
- References: <email@example.com>
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.