NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: port-sgimips/53519 (aoutboot is broken since old NetBSD release.)
The following reply was made to PR port-sgimips/53519; it has been noted by GNATS.
From: Izumi Tsutsui <tsutsui%ceres.dti.ne.jp@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: nullnilaki%gmail.com@localhost, tsutsui%ceres.dti.ne.jp@localhost
Subject: Re: port-sgimips/53519 (aoutboot is broken since old NetBSD release.)
Date: Sun, 2 Sep 2018 20:22:35 +0900
> Confirmed as objcopy issue. I'll note it later.
The original ip2xboot from NetBSD 8.0 has the following sections:
---
/s/src/obj.sgimips/tooldir.NetBSD-8.0-i386/bin/mipseb--netbsd-size -A ip2xboot.elf
ip2xboot.elf :
section size addr
.text 46240 18446744071696293888
.text.startup 828 18446744071696340128
.rodata 4796 18446744071696340960
.reginfo 24 18446744071696345756
.MIPS.abiflags 24 18446744071696345784
.data 336 18446744071696345808
.sbss 1148 18446744071696346144
.bss 640 18446744071696347296
.pdr 5152 0
.gnu.attributes 16 0
.comment 33 0
.ident 62 0
Total 59299
---
An aoutboot binary (actually ecoff binary) converted by objcopy(1) has
the following sections:
---
% /s/src/obj.sgimips/tooldir.NetBSD-8.0-i386/bin/mipseb--netbsd-size -A aoutboot-objcopy
aoutboot-objcopy :
section size addr
.text 46240 2281709568
.text.st 828 2281755808
.rodata 4800 2281756640
.reginfo 24 2281761436
.MIPS.ab 24 2281761464
.data 336 2281761488
.sbss 1148 2281761824
.bss 640 2281762976
.gnu.att 16 0
Total 54056
---
ARCBIOS loads this binary (and fails) as reported in the PR:
---
>> bootp()aoutboot
Setting $netaddr to 192.168.20.39 (from server mirage)
Obtaining aoutboot from server mirage
47068+5200
Exception: <vector=UTLB Miss>
Status register: 0x30004803<CU1,CU0,IM7,IM4,IPL=???,MODE=KERNEL,EXL,IE>
Cause register: 0x800c<CE=0,IP8,EXC=WMISS>
Exception PC: 0x9fc3ddac, Exception RA: 0x9fc2a528
exception, bad address: 0x0
Local I/O interrupt register 0: 0x8 <ENET>
Local I/O interrupt register 1: 0x80 <VR/GIO2>
Saved user regs in hex (&gpda 0xa8740e48, &_regs 0xa8741048):
arg: a8740000 4e657442 53442f73 ba00
tmp: a8740000 64 a8743ed8 1450 1450 a87487e0 0 887feca0
sve: a8740000 3 400000 8000000 16 3f80 0 c000000
t8 a8740000 t9 0 at 0 v0 0 v1 0 k1 0
gp a8740000 fp 0 sp 0 ra 0
PANIC: Unexpected exception
[Press reset or ENTER to restart.]
---
"47068" seems:
46240 (.text)
+ 828 (.text.startup).
"5200" seems:
4800 (.rodata)
+ 24 (.reginfo)
+ 24 (MIPS.abiflags)
+ 336 (.data)
+ alignment?
There is no info about .bss.
I removed the extra .gnu.attributes section (that has no valid address)
by -R option then it went a bit further, but ARCBIOS still fails
to execute it:
---
aoutboot-objdump-no-gnu.attributes :
section size addr
.text 46240 2281709568
.text.st 828 2281755808
.rodata 4800 2281756640
.reginfo 24 2281761436
.MIPS.ab 24 2281761464
.data 336 2281761488
.sbss 1148 2281761824
.bss 640 2281762976
Total 54040
---
>> bootp()aoutboot
Setting $netaddr to 192.168.20.39 (from server mirage)
Obtaining aoutboot from server mirage
47068+5184+1788 entry: 0x88002000
g...
g...
Exception: <vector=UTLB Miss>
Status register: 0x30004803<CU1,CU0,IM7,IM4,IPL=???,MODE=KERNEL,EXL,IE>
Cause register: 0x8008<CE=0,IP8,EXC=RMISS>
Exception PC: 0x880024b0, Exception RA: 0x8800d544
exception, bad address: 0x0
Local I/O interrupt register 1: 0x80 <VR/GIO2>
Saved user regs in hex (&gpda 0xa8740e48, &_regs 0xa8741048):
arg: a8740000 196 0 1
tmp: a8740000 88010000 887fe894 88010000 7 ffffffff 76 88010000
sve: a8740000 3 400000 8000000 16 3f80 0 c000000
t8 a8740000 t9 0 at 0 v0 0 v1 0 k1 0
gp a8740000 fp 0 sp 0 ra 0
PANIC: Unexpected exception
[Press reset or ENTER to restart.]
---
The failed address 0x880024b0 is in getopt() and the exception is caused
by a NULL pointer dereference, so I guess some data is not loaded correctly.
An aoutboot binaryconverted by elf2ecoff(1) has the following
simple sections:
---
% /s/src/obj.sgimips/tooldir.NetBSD-8.0-i386/bin/mipseb--netbsd-size -A aoutboot-elf2ecoff
aoutboot-elf2ecoff :
section size addr
.text 52256 2281709568
.data 0 2281761824
.bss 1792 2281761824
0 0
0 0
0 0
Total 54048
---
ARCBIOS loads this binary (and executes successfully) as the following:
---
>> bootp()aoutboot
Setting $netaddr to 192.168.20.39 (from server mirage)
Obtaining aoutboot from server mirage
52256+0+1792 entry: 0x88002000
NetBSD/sgimips 8.0 Bootstrap, Revision 1.5 (Sat Sep 1 18:49:55 UTC 2018)
devopen: scsi(0)disk(1)rdisk(0)partition(0) type scsi file /netbsd
4908464+131360 [267552+259212]=0x54f6c4
---
"52256" is .text. It seems merged from all sections except .sbss and .bss
(for simplicity?):
46240 (.text)
+ 828 (.text.startup)
+ 4800 (.rodata)
+ 24 (.reginfo)
+ 24 (MIPS.abiflags)
+ 336 (.data)
+ alignment?
The next "0" means there is no .data section
(because it's merged into .text).
The last "1792" seems .sbss (1148) + .bss (640) + alignemnt.
I wonder if we can deal these annoying sections in ldscript for objcopy,
but I think it's much easier to use our traditional elf2ecoff,
as pmax and luna68k (using elf2aout) etc. do.
A bit off-topic, but probably NetBSD/arc has the same problem.
At least, we have to remove the .gnu.attributes section in
sys/arch/arc/stand/boot/Makefile.
---
Izumi Tsutsui
Home |
Main Index |
Thread Index |
Old Index