Port-macppc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ofwboot.xcf and gcc 4.8 and ppc 601



For ofwboot.xcf, when I rename "main()" to "bmain()" in

   src/sys/arch/macppc/stand/ofwboot/Locore.c
   src/sys/arch/macppc/stand/ofwboot/boot.c
   src/sys/arch/macppc/stand/ofwboot/boot.h

my powermac 7200 will then boot fine with gcc 4.8:

0 > boot enet:,ofwboot.xcf file: 10.0.0.1,ofwboot.xcfloading XCOFF
tsize=E6D0 dsize=258 bsize=2750 entry=E00000
SECTIONS:
.eh_fram 00000074 00000074 000020C8 0000014C
.text    00E00000 00E00000 0000E6D0 00002220
.data    00E0F000 00E0F000 00000258 000108F0
.bss     00E0F258 00E0F258 00002750 00000000
.gnu.att 00000000 00000000 00000010 00010B48
.ident   00000000 00000000 00000076 00010B58
loading .text, done..
loading .data, done..
clearing .bss, done..

>> NetBSD/macppc OpenFirmware Boot, Revision 1.12 (Fri Jan  2 15:12:29 EST 2015)  
file: 10.0.0.1,ofwboot.xcfUsing IP address: 10.0.0.2
root addr=10.0.0.1 path=/export/client/root
3533284+139408 [204624+198370]=0x3e3550
 start=0x100000
mem region 0 start=0 size=10000000
avail region 0 start=0x9000 size=0xdf7000
avail region 1 start=0xe12000 size=0xee000
avail region 2 start=0x1000000 size=0xf000000
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015
    The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.
[...]

The dump of ofwboot.mrg shows that main() comes right after the _rtt
section, which was similar to what gcc 4.5 was doing.  Here is with
bmain and gcc 4.8:

00e00888 <_rtt>:
  e00888:       94 21 ff f0     stwu    r1,-16(r1)
  e0088c:       7c 08 02 a6     mflr    r0
  e00890:       90 01 00 14     stw     r0,20(r1)
  e00894:       4b ff f8 95     bl      e00128 <OF_exit>

00e00898 <bmain>:
  e00898:       94 21 fc 90     stwu    r1,-880(r1)
  e0089c:       7c 08 02 a6     mflr    r0
  e008a0:       3c 60 00 e1     lis     r3,225
  e008a4:       38 63 e0 b5     addi    r3,r3,-8011
  e008a8:       90 01 03 74     stw     r0,884(r1)
  e008ac:       be 81 03 40     stmw    r20,832(r1)
  e008b0:       48 00 87 85     bl      e09034 <printf>
 [...]

With gcc 4.8 and the normal name, it seems like main() is put in a new
and different section (.text.startup instead of .text) at a much later
address.  The ofwboot boot output is slightly different too:

> boot enet:,ofwboot.xcf file: 10.0.0.1,ofwboot.xcfloading XCOFF
tsize=E260 dsize=258 bsize=2750 entry=E00000
SECTIONS:                                   
.eh_fram 00000074 00000074 000020C8 00000174
.text    00E00000 00E00000 0000E260 00002240
.text.st 00E0E254 00E0E254 00000468 000104A0 <-- new section (same address in %SRR0) -->
.data    00E0F000 00E0F000 00000258 00010908
.bss     00E0F258 00E0F258 00002750 00000000
.gnu.att 00000000 00000000 00000010 00010B60
.ident   00000000 00000000 00000076 00010B70
loading .text, done..
loading .data, done..
clearing .bss, done..
DEFAULT CATCH!, code=FFF00700
0 > .registers
Client's Fix Pt Regs:
 00 00E00290 00E112A0 00000000 00000004 00E0D991 00E0F2AC 00000004 DEADBEEF
 08 00E119A8 FF8099B8 DEADBEEF 00E112A0 DEADBEEF DEADBEEF DEADBEEF DEADBEEF
 10 DEADBEEF DEADBEEF DEADBEEF DEADBEEF DEADBEEF DEADBEEF DEADBEEF DEADBEEF
 18 DEADBEEF DEADBEEF DEADBEEF DEADBEEF DEADBEEF DEADBEEF FF829898 00E0F2A4
Special Regs:
    %IV: 00000700   %SRR0: 00E0E254   %SRR1: 00083070     %MQ: 00000060
    %CR: 30000003     %LR: 00E0029C    %CTR: FF8099B8    %XER: C000BE6F
   %DAR: 00001000  %DSISR: 42000000   %SDR1: 00FE0000

Here is a partial dump of the failing version:

Disassembly of section .text.startup:

00e0e254 <main>:
  e0e254:       94 21 fc 90     stwu    r1,-880(r1)
  e0e258:       7c 08 02 a6     mflr    r0
  e0e25c:       3c 60 00 e1     lis     r3,225
  e0e260:       38 63 dc 45     addi    r3,r3,-9147
  e0e264:       90 01 03 74     stw     r0,884(r1)
  e0e268:       be 81 03 40     stmw    r20,832(r1)
  e0e26c:       4b ff a9 61     bl      e08bcc <printf>

Hopefully this info helps, not sure where to go from here...

Thanks



Home | Main Index | Thread Index | Old Index