public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] powerpc/ppc4xx: add ENTRY() to linker script
@ 2011-03-24 21:39 jozsef imrek
  2011-03-24 23:03 ` Wolfgang Denk
  0 siblings, 1 reply; 4+ messages in thread
From: jozsef imrek @ 2011-03-24 21:39 UTC (permalink / raw)
  To: u-boot

Add ENTRY() command to the linker script so that entry point is
correctly marked in the final ELF file.

Signed-off-by: jozsef imrek <mazsi@imrek.org>
---
 arch/powerpc/cpu/ppc4xx/u-boot.lds |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/cpu/ppc4xx/u-boot.lds b/arch/powerpc/cpu/ppc4xx/u-boot.lds
index 656f59a..b82e1e8 100644
--- a/arch/powerpc/cpu/ppc4xx/u-boot.lds
+++ b/arch/powerpc/cpu/ppc4xx/u-boot.lds
@@ -38,6 +38,8 @@ PHDRS
   bss PT_LOAD;
 }
 
+ENTRY(_start)
+
 SECTIONS
 {
   /* Read-only sections, merged into text segment: */
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] powerpc/ppc4xx: add ENTRY() to linker script
  2011-03-24 21:39 [U-Boot] [PATCH] powerpc/ppc4xx: add ENTRY() to linker script jozsef imrek
@ 2011-03-24 23:03 ` Wolfgang Denk
  2011-03-24 23:54   ` jozsef imrek
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Denk @ 2011-03-24 23:03 UTC (permalink / raw)
  To: u-boot

Dear jozsef imrek,

In message <1301002747-8943-1-git-send-email-mazsi@imrek.org> you wrote:
> Add ENTRY() command to the linker script so that entry point is
> correctly marked in the final ELF file.

Which exact problem are you trying to fix?


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Honest error is to be pitied, not ridiculed.
                                       -- Philip Earl of Chesterfield

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] powerpc/ppc4xx: add ENTRY() to linker script
  2011-03-24 23:03 ` Wolfgang Denk
@ 2011-03-24 23:54   ` jozsef imrek
  2011-04-04 11:19     ` Stefan Roese
  0 siblings, 1 reply; 4+ messages in thread
From: jozsef imrek @ 2011-03-24 23:54 UTC (permalink / raw)
  To: u-boot


dear wolfgang,


On Fri, 25 Mar 2011, Wolfgang Denk wrote:

> > Add ENTRY() command to the linker script so that entry point is
> > correctly marked in the final ELF file.
> 
> Which exact problem are you trying to fix?

i'm sorry, i probably should have been more verbose in the
changelog.
     

when cross-compiling u-boot for the avnet virtex-4 minimodule 
(make fx12mm_config; make, with SYS_TEXT_BASE=0x02000000) i end
up with a u-boot.lds linker script that has no ENTRY() command.

this will result in an incorrect ELF file: the entry point in 
the ELF header points to the first byte of the first loadable 
segment (which is ~the version string at 0x02000004: "U-Boot 
2011..") instead of the first instruction to be executed at 
_start (at 0x02002100 in this case).


powerpc-405-linux-gnu-readelf -e u-boot:

ELF Header:
  Magic:   7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF32
  Data:                              2's complement, big endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           PowerPC
  Version:                           0x1
  Entry point address:               0x2000000
  ..
     

powerpc-405-linux-gnu-objdump -d u-boot:

Disassembly of section .text:

02000000 <version_string-0x4>:
 2000000:       27 05 19 56     dozi    r24,r5,6486

02000004 <version_string>:
 2000004:       55 2d 42 6f     rlwinm. r13,r9,8,9,23
 2000008:       6f 74 20 32     xoris   r20,r27,8242
 200000c:       30 31 31 2e     addic   r1,r17,12590
 2000010:       30 33 2d 72     addic   r1,r19,11634
        ...

02002100 <_start>:
 2002100:       38 80 00 00     li      r4,0
 2002104:       7c 99 eb a6     mtpmc1  r4
 2002108:       7c 9a eb a6     mtdcwr  r4
 200210c:       7c 94 f3 a6     mtesr   r4
 2002110:       7c 9a f3 a6     mttcr   r4
        ...

     
anything trying to load and run this ELF file (eg xilinx's XMD 
debugger, or a bootloader stored in the FPGA fabric) will fail 
to do so because the processor will jump to 0x02000000 and try 
to execute the version string.



best regards,

-- 
mazsi

----------------------------------------------------------------
strawberry fields forever!                       mazsi at imrek.org
----------------------------------------------------------------

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] powerpc/ppc4xx: add ENTRY() to linker script
  2011-03-24 23:54   ` jozsef imrek
@ 2011-04-04 11:19     ` Stefan Roese
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Roese @ 2011-04-04 11:19 UTC (permalink / raw)
  To: u-boot

Hi Jozsef,

On Friday 25 March 2011 00:54:18 jozsef imrek wrote:
> > > Add ENTRY() command to the linker script so that entry point is
> > > correctly marked in the final ELF file.
> > 
> > Which exact problem are you trying to fix?
> 
> i'm sorry, i probably should have been more verbose in the
> changelog.

Yes. Please resend this patch as v2, with the extended commit text so that I 
may apply it in this merge window.

Thanks.
 
Cheers,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-04-04 11:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-24 21:39 [U-Boot] [PATCH] powerpc/ppc4xx: add ENTRY() to linker script jozsef imrek
2011-03-24 23:03 ` Wolfgang Denk
2011-03-24 23:54   ` jozsef imrek
2011-04-04 11:19     ` Stefan Roese

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox