The psim target does not properly load an executable in the "oea"
environment using the "bug" OS emulation if the load address (LMA)
and the link address (VMA) differ. This is a known bug, as
indicated by the comment in sim/ppc/hw_init.c:
/* DEVICE
load-binary - load binary segments into memory
DESCRIPTION
Each loadable segment of the specified binary is loaded into memory
at its required address. It is assumed that the memory at those
addresses already exists.
This device is normally used to load an executable into memory as
part of real mode simulation.
PROPERTIES
file-name = <string>
Name of the binary to be loaded.
claim = <anything> (optional)
If this property is present, the real memory that is to be used by
the image being loaded will be claimed from the memory node
(specified by the ihandle <</chosen/memory>>).
BUGS
When loading the binary the bfd virtual-address is used. It should
be using the bfd load-address.
*/
The attached patch seems to fix the problem for me.
-------- gdb version (Insight debugger) ------------
GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "--host=i586-pc-linux-gnu
--target=powerpc-eabi".
--- ./sim/ppc/hw_init.c.orig Fri Jun 9 18:50:51 2000
+++ ./sim/ppc/hw_init.c Fri Jun 9 19:29:12 2000
@@ -335,7 +335,11 @@
return;
/* find where it is to go */
- section_vma = bfd_get_section_vma(abfd, the_section);
+ if (strcmp(device_name(me), "load-binary") == 0) {
+ section_vma = bfd_section_lma(abfd, the_section);
+ } else {
+ section_vma = bfd_section_vma(abfd, the_section);
+ }
DTRACE(binary,
("name=%-7s, vma=0x%.8lx, size=%6ld, flags=%3lx(%s%s%s%s%s )\n",