This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: the "load" command and the .bss section

On Sunday 27 April 2008, Daniel Jacobowitz wrote:
> 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...

ah, now that i know the intentions, may i suggest the following to the 

2008-04-27  Mike Frysinger  <>

	* gdb.texinfo (Commands for Managing Targets): Clarify load command
	wrt load/virtual addresses and handling of allocated sections.

Attachment: signature.asc
Description: This is a digitally signed message part.

Index: gdb.texinfo
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.487
diff -u -p -r1.487 gdb.texinfo
--- gdb.texinfo	24 Apr 2008 12:09:49 -0000	1.487
+++ gdb.texinfo	27 Apr 2008 21:43:57 -0000
@@ -12795,10 +12795,12 @@ If your @value{GDBN} does not have a @co
 execute it gets the error message ``@code{You can't do that when your
 target is @dots{}}''
-The file is loaded at whatever address is specified in the executable.
-For some object file formats, you can specify the load address when you
-link the program; for other formats, like a.out, the object file format
-specifies a fixed address.
+The file is loaded according to the load addresses (rather than virtual) as
+is specified in the executable.  It is expected that the target system will
+do the actual relocation, and in the process, handle such things as setup of
+allocated sections (e.g. the bss).  For some object file formats, you can
+specify the load address when you link the program; for other formats, like
+a.out, the object file format specifies a fixed address.
 @c FIXME! This would be a good place for an xref to the GNU linker doc.
 Depending on the remote side capabilities, @value{GDBN} may be able to

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]