NetBSD Problem Report #52564
From www@NetBSD.org Wed Sep 20 17:25:57 2017
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 582DD7A17C
for <gnats-bugs@gnats.NetBSD.org>; Wed, 20 Sep 2017 17:25:57 +0000 (UTC)
Message-Id: <20170920172556.59CEB7A287@mollari.NetBSD.org>
Date: Wed, 20 Sep 2017 17:25:56 +0000 (UTC)
From: scole_mail@gmx.com
Reply-To: scole_mail@gmx.com
To: gnats-bugs@NetBSD.org
Subject: current ofwboot.xcf crashes because of .eh_frame* in .text
X-Send-Pr-Version: www-1.0
>Number: 52564
>Notify-List: uwe@netbsd.org
>Category: port-macppc
>Synopsis: current ofwboot.xcf crashes because of .eh_frame* in .text
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: port-macppc-maintainer
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Sep 20 17:30:00 +0000 2017
>Closed-Date: Sat Jun 09 21:34:26 +0000 2018
>Last-Modified: Sat Jun 09 21:34:26 +0000 2018
>Originator: scole_mail
>Release: current
>Organization:
none
>Environment:
NetBSD pm7500 8.99.2 NetBSD 8.99.2 (GENERIC-$Revision: 1.15 $) #0: Wed Sep 20 09:57:58 PDT 2017 scole@dstar:/home/scole/nbsd/cvs/src/sys/arch/macppc/compile/obj/GENERIC_601 macppc
>Description:
current ofwboot.xcf is crashing on my powermac 7500:
0 > boot file: 10.0.0.1,ofwboot.xcfloading XCOFF
tsize=10000 dsize=258 bsize=2750 entry=E00000
SECTIONS:
.text 00E00000 00E00000 00010000 00001000
.data 00E10000 00E10000 00000258 00011000
.bss 00E10258 00E10258 00002750 00000000
.gnu.att 00000000 00000000 00000010 00011258
.ident 00000000 00000000 00000076 00011268
loading .textDEFAULT CATCH!, code=FFF00300
ok
7.1 worked fine for me though:
0 > boot file: 10.0.0.1,ofwboot.xcfloading XCOFF
tsize=EF00 dsize=250 bsize=2750 entry=E00000
SECTIONS:
.eh_fram 00000074 00000074 00002218 0000014C
.text 00E00000 00E00000 0000EF00 00002370
.data 00E0F000 00E0F000 00000250 00011270
.bss 00E0F250 00E0F250 00002750 00000000
.gnu.att 00000000 00000000 00000010 000114C0
.ident 00000000 00000000 00000076 000114D0
loading .text, done..
loading .data, done..
clearing .bss, done..
It seems the issue is caused by rev 1.4 in elf32_powerpc_merge.x
https://nxr.netbsd.org/history/src/sys/arch/macppc/stand/fixcoff/elf32_powerpc_merge.x
which put
*(.eh_frame_hdr)
*(.eh_frame)
in the .text section.
I'm not exactly sure why 7.1 worked and .eh_frame is at 0x74, that seems unnatural, maybe some ld or fixcoff issue. But with the patch below, my machine booted fine and sections appear in a reasonable order:
0 > boot file: 10.0.0.1,ofwboot.xcfloading XCOFF
tsize=F6C0 dsize=260 bsize=2750 entry=E00000
SECTIONS:
.text 00E00000 00E00000 0000F6C0 00001000
.eh_fram 00E0F6BC 00E0F6BC 00002940 000106C0
.data 00E12000 00E12000 00000260 00013000
.bss 00E12260 00E12260 00002750 00000000
.gnu.att 00000000 00000000 00000010 00013260
.ident 00000000 00000000 00000076 00013270
loading .text, done..
loading .data, done..
clearing .bss, done..
If this change seems safe and won't break other machines, let me know and I'll commit it myself.
Thanks
>How-To-Repeat:
boot with ofwboot.xcf from current.
my machine is openfirmware 1.0.5, maybe more recent versions don't have the same problem.
>Fix:
Summary of changes: (A/? = New, R/D = Removed, M = Modified)
=============================================================
M elf32_powerpc_merge.x
Apply patch with "cd .../src/sys/arch/macppc/stand/fixcoff ; patch -s -p0 < .../patchfile"
Index: elf32_powerpc_merge.x
===================================================================
RCS file: /cvsroot/src/sys/arch/macppc/stand/fixcoff/elf32_powerpc_merge.x,v
retrieving revision 1.4
diff -b -u -r1.4 elf32_powerpc_merge.x
--- elf32_powerpc_merge.x 20 Apr 2017 18:53:12 -0000 1.4
+++ elf32_powerpc_merge.x 20 Sep 2017 17:14:43 -0000
@@ -32,9 +32,14 @@
*(.rodata.*)
*(.rodata1)
*(.got1)
+ }
+
+ .eh_frame :
+ {
*(.eh_frame_hdr)
*(.eh_frame)
}
+
.fini : { *(.fini) } =0
.ctors : { *(.ctors) }
.dtors : { *(.dtors) }
>Release-Note:
>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/52564 CVS commit: src/sys/arch/macppc/stand/fixcoff
Date: Wed, 20 Sep 2017 14:44:22 -0400
Module Name: src
Committed By: christos
Date: Wed Sep 20 18:44:22 UTC 2017
Modified Files:
src/sys/arch/macppc/stand/fixcoff: elf32_powerpc_merge.x
Log Message:
PR/52564: Scole Mail: current ofwboot.xcf crashes because of .eh_frame* in .text
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/sys/arch/macppc/stand/fixcoff/elf32_powerpc_merge.x
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: port-macppc/52564: current ofwboot.xcf crashes because of
.eh_frame* in .text
Date: Thu, 21 Sep 2017 00:17:47 +0300
On Wed, Sep 20, 2017 at 17:30:01 +0000, scole_mail@gmx.com wrote:
> It seems the issue is caused by rev 1.4 in elf32_powerpc_merge.x
> https://nxr.netbsd.org/history/src/sys/arch/macppc/stand/fixcoff/elf32_powerpc_merge.x
> which put
> *(.eh_frame_hdr)
> *(.eh_frame)
> in the .text section.
I swear there was a reason why I did that but I can't remember. I
*think* that before I made that change ofwboot suddenly exploded in
size when gcc started generating .eh_frame.
What is the size of ofwboot.xcf before and after?
-uwe
From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: port-macppc/52564: current ofwboot.xcf crashes because of
.eh_frame* in .text
Date: Thu, 21 Sep 2017 02:34:50 +0300
Actually, why doesn't this seem to work:
http://mail-index.netbsd.org/source-changes/2017/04/20/msg083819.html
Module Name: src
Committed By: uwe
Date: Thu Apr 20 19:09:29 UTC 2017
Modified Files:
src/sys/arch/macppc/stand: Makefile.inc
src/sys/arch/macppc/stand/bootxx: Makefile
src/sys/arch/macppc/stand/ofwboot: Makefile
Log Message:
Quash .eh_frame unwind tables in boot code.
I.e. where does .eh_frame come from?
-uwe
From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@NetBSD.org
Cc: port-macppc-maintainer@netbsd.org, gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org, scole_mail@gmx.com, uwe@netbsd.org
Subject: re: port-macppc/52564: current ofwboot.xcf crashes because of .eh_frame* in .text
Date: Thu, 21 Sep 2017 09:53:14 +1000
> Actually, why doesn't this seem to work:
>
> http://mail-index.netbsd.org/source-changes/2017/04/20/msg083819.html
>
> Module Name: src
> Committed By: uwe
> Date: Thu Apr 20 19:09:29 UTC 2017
>
> Modified Files:
> src/sys/arch/macppc/stand: Makefile.inc
> src/sys/arch/macppc/stand/bootxx: Makefile
> src/sys/arch/macppc/stand/ofwboot: Makefile
>
> Log Message:
> Quash .eh_frame unwind tables in boot code.
>
> I.e. where does .eh_frame come from?
libkern/libz/etc? i see nothing that prevents them from
generating eh_frame.
.mrg.
From: scole_mail <scole_mail@gmx.com>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: port-macppc/52564: current ofwboot.xcf crashes because of .eh_frame* in .text
Date: Wed, 20 Sep 2017 19:08:59 -0700
>>
>> I.e. where does .eh_frame come from?
>>
I guess there is still some compile dependency or something I'm not
understanding.
I re-made a clean everything with elf32_powerpc_merge.x updated, and I
couldn't boot anymore. It looks like the flags in
src/sys/arch/macppc/stand/Makefile.inc
CFLAGS_UNWIND.gcc= -fno-unwind-tables -fno-asynchronous-unwind-tables
CFLAGS_UNWIND.clang= -fno-unwind-tables
LINKFLAGS_UNWIND= --no-ld-generated-unwind-info
were being honored and not putting .eh_frame* into ofwboot.elf/.xcf,
which is different than I had tested earlier:
> powerpc--netbsd-readelf -S ofwboot.elf
There are 12 section headers, starting at offset 0xfaf4:
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .text PROGBITS 00e00000 000060 00dfb4 00 WAX 0 0 16
[ 2] .rodata PROGBITS 00e0dfb4 00e014 001718 00 A 0 0 4
[ 3] .data PROGBITS 00e0f6d0 00f730 000235 00 WA 0 0 8
[ 4] .sdata PROGBITS 00e0f908 00f968 00001e 00 WA 0 0 4
[ 5] .sbss NOBITS 00e0f928 00f986 000049 00 WA 0 0 4
[ 6] .bss NOBITS 00e0f978 00f986 002700 00 WA 0 0 8
[ 7] .comment PROGBITS 00000000 00f986 000021 01 MS 0 0 1
[ 8] .note NOTE 00000000 00f9a8 00006c 00 0 0 4
[ 9] .ident PROGBITS 00000000 00fa14 000076 00 0 0 1
[10] .gnu.attributes LOOS+0xffffff5 00000000 00fa8a 000010 00 0 0 1
[11] .shstrtab STRTAB 00000000 00fa9a 000057 00 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
L (link order), O (extra OS processing required), G (group), T (TLS),
C (compressed), x (unknown), o (OS specific), E (exclude),
p (processor specific)
but, no .eh_frame* seems to have prevented me from booting. Why does
tsize=10000 ?
0 > boot file: 10.0.0.1,ofwboot.xcfloading XCOFF
tsize=10000 dsize=258 bsize=2750 entry=E00000
SECTIONS:
.text 00E00000 00E00000 00010000 00001000
.data 00E10000 00E10000 00000258 00011000
.bss 00E10258 00E10258 00002750 00000000
.gnu.att 00000000 00000000 00000010 00011258
.ident 00000000 00000000 00000076 00011268
loading .textDEFAULT CATCH!, code=FFF00300
ok
So I commented out the flags above, recompiled, and got the .en_frame*
stuff back:
> powerpc--netbsd-readelf -S ofwboot.elf
There are 13 section headers, starting at offset 0x102ac:
Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .text PROGBITS 00e00000 000060 00dfb4 00 WAX 0 0 16
[ 2] .rodata PROGBITS 00e0dfb4 00e014 001718 00 A 0 0 4
[ 3] .eh_frame PROGBITS 00e0f6cc 00f72c 0007b4 00 A 0 0 4
[ 4] .data PROGBITS 00e0fe80 00fee0 000235 00 WA 0 0 8
[ 5] .sdata PROGBITS 00e100b8 010118 00001e 00 WA 0 0 4
[ 6] .sbss NOBITS 00e100d8 010136 000049 00 WA 0 0 4
[ 7] .bss NOBITS 00e10128 010136 002700 00 WA 0 0 8
[ 8] .comment PROGBITS 00000000 010136 000021 01 MS 0 0 1
[ 9] .note NOTE 00000000 010158 00006c 00 0 0 4
[10] .ident PROGBITS 00000000 0101c4 000076 00 0 0 1
[11] .gnu.attributes LOOS+0xffffff5 00000000 01023a 000010 00 0 0 1
[12] .shstrtab STRTAB 00000000 01024a 000061 00 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
L (link order), O (extra OS processing required), G (group), T (TLS),
C (compressed), x (unknown), o (OS specific), E (exclude),
p (processor specific)
which allowed booting, tsize=F6E0, more reasonable...
0 > boot file: 10.0.0.1,ofwboot.xcfloading XCOFF
tsize=F6E0 dsize=258 bsize=2750 entry=E00000
SECTIONS:
.text 00E00000 00E00000 0000F6E0 00001000
.eh_fram 00E0F6DC 00E0F6DC 00000920 000106E0
.data 00E10000 00E10000 00000258 00011000
.bss 00E10258 00E10258 00002750 00000000
.gnu.att 00000000 00000000 00000010 00011258
.ident 00000000 00000000 00000076 00011268
loading .text, done..
loading .data, done..
clearing .bss, done..
Here are the file sizes, .xcf sizes aren't different?
with .en_frame:
> ls -l ofwboot.xcf ofwboot.elf
-rwxr-xr-x 1 scole users 66740 Sep 20 18:40 ofwboot.elf
-rwxr-xr-x 1 scole users 81486 Sep 20 18:40 ofwboot.xcf
without .en_frame:
> ls -l ofwboot.xcf ofwboot.elf
-rwxr-xr-x 1 scole users 64724 Sep 20 18:46 ofwboot.elf
-rwxr-xr-x 1 scole users 81486 Sep 20 18:46 ofwboot.xcf
I guess I'm not sure what the proper fix is now, perhaps one of changing
flags Makefile.inc, changing elf32_powerpc_merge.x, or something wrong
with fixcoff?
Thanks
From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: port-macppc/52564: current ofwboot.xcf crashes because of
.eh_frame* in .text
Date: Thu, 21 Sep 2017 13:44:03 +0300
On Thu, Sep 21, 2017 at 09:53:14 +1000, matthew green wrote:
> > Actually, why doesn't this seem to work:
> >
> > http://mail-index.netbsd.org/source-changes/2017/04/20/msg083819.html
> >
> > Module Name: src
> > Committed By: uwe
> > Date: Thu Apr 20 19:09:29 UTC 2017
> >
> > Modified Files:
> > src/sys/arch/macppc/stand: Makefile.inc
> > src/sys/arch/macppc/stand/bootxx: Makefile
> > src/sys/arch/macppc/stand/ofwboot: Makefile
> >
> > Log Message:
> > Quash .eh_frame unwind tables in boot code.
> >
> > I.e. where does .eh_frame come from?
>
> libkern/libz/etc? i see nothing that prevents them from
> generating eh_frame.
But they are not built separately, so the same flags apply to them as
well in this case. From the log:
powerpc--netbsd-gcc ... -fno-unwind-tables -fno-asynchronous-unwind-tables \
... $SRC/sys/arch/macppc/stand/ofwboot/../../../../lib/libsa/alloc.c \
-o alloc.o
-uwe
From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: port-macppc/52564: current ofwboot.xcf crashes because of
.eh_frame* in .text
Date: Sun, 24 Sep 2017 03:24:57 +0300
Ok, just to be clear, the timeline here seems to be:
1) my commit to elf32_powerpc_merge.x to merge .eh_frame* to .text
2) my commit to ../Makefile.inc to disable .eh_frame generation
3) christos@ commit to keep .eh_frame section
4) commenting out unwind-related flags in ../Makefile.inc
On Thu, Sep 21, 2017 at 02:10:01 +0000, scole_mail wrote:
> It looks like the flags in
> src/sys/arch/macppc/stand/Makefile.inc
>
> CFLAGS_UNWIND.gcc= -fno-unwind-tables -fno-asynchronous-unwind-tables
> CFLAGS_UNWIND.clang= -fno-unwind-tables
> LINKFLAGS_UNWIND= --no-ld-generated-unwind-info
>
> were being honored and not putting .eh_frame* into ofwboot.elf/.xcf,
> which is different than I had tested earlier:
>
> > powerpc--netbsd-readelf -S ofwboot.elf
Nit pick: the .xcf file is made from .mrg, not .elf. They are
trivially different, but different.
> 0 > boot file: 10.0.0.1,ofwboot.xcfloading XCOFF
> tsize=10000 dsize=258 bsize=2750 entry=E00000
> SECTIONS:
> .text 00E00000 00E00000 00010000 00001000
> .data 00E10000 00E10000 00000258 00011000
> .bss 00E10258 00E10258 00002750 00000000
> .gnu.att 00000000 00000000 00000010 00011258
> .ident 00000000 00000000 00000076 00011268
> loading .textDEFAULT CATCH!, code=FFF00300
> ok
This is after 3), right?
> So I commented out the flags above, recompiled, and got the
> .eh_frame* stuff back:
[...]
> which allowed booting, tsize=F6E0, more reasonable...
>
> 0 > boot file: 10.0.0.1,ofwboot.xcfloading XCOFF
> tsize=F6E0 dsize=258 bsize=2750 entry=E00000
> SECTIONS:
> .text 00E00000 00E00000 0000F6E0 00001000
> .eh_fram 00E0F6DC 00E0F6DC 00000920 000106E0
> .data 00E10000 00E10000 00000258 00011000
> .bss 00E10258 00E10258 00002750 00000000
> .gnu.att 00000000 00000000 00000010 00011258
> .ident 00000000 00000000 00000076 00011268
> loading .text, done..
> loading .data, done..
> clearing .bss, done..
And that would be 4).
BTW, you asked about the previous one (after 3):
> Why does tsize=10000 ?
Note, that .text 0xf6e0 + .eh_frame 0x920 = 0x10000 I'm not inferring
anything, just pointing this out (note also that that previous one
doesn't have .eh_frame :).
> Here are the file sizes, .xcf sizes aren't different?
>
> with .en_frame:
> > ls -l ofwboot.xcf ofwboot.elf
> -rwxr-xr-x 1 scole users 66740 Sep 20 18:40 ofwboot.elf
> -rwxr-xr-x 1 scole users 81486 Sep 20 18:40 ofwboot.xcf
>
> without .en_frame:
> > ls -l ofwboot.xcf ofwboot.elf
> -rwxr-xr-x 1 scole users 64724 Sep 20 18:46 ofwboot.elf
> -rwxr-xr-x 1 scole users 81486 Sep 20 18:46 ofwboot.xcf
When I did 1), it was prompted by (relatively) huge ofwboot.xcf files.
I accidentally still have one around and its size is 353486, which
matches what I remember. This is what I had in mind when asking about
sizes. I think sevan@ pointed that out to me, which prompted me to
look at this in the first place.
Hmm, I can't seem to reproduce this huge owfboot.xcf files anymore
even undoing all the 1)-3) above...
> I guess I'm not sure what the proper fix is now, perhaps one of
> changing flags Makefile.inc, changing elf32_powerpc_merge.x, or
> something wrong with fixcoff?
Yeah, confusing. Would it be much trouble for you to try reverting to
before 1) and trying that and then 1) to 4), doing cleandir before
each iteration. Maybe copying ofwboot objdir aside after each step
for possible later forensics.
TIA
-uwe
From: scole_mail <scole_mail@gmx.com>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: port-macppc/52564: current ofwboot.xcf crashes because of .eh_frame* in .text
Date: Mon, 25 Sep 2017 11:35:53 -0700
Valery Ushakov <uwe@stderr.spb.ru> writes:
> Ok, just to be clear, the timeline here seems to be:
>
> 1) my commit to elf32_powerpc_merge.x to merge .eh_frame* to .text
> 2) my commit to ../Makefile.inc to disable .eh_frame generation
> 3) christos@ commit to keep .eh_frame section
> 4) commenting out unwind-related flags in ../Makefile.inc
>
I think that is correct. Just for testing, I added these cases
0) before any of 1-4 changes
5) what's in current as of today
>
> Yeah, confusing. Would it be much trouble for you to try reverting to
> before 1) and trying that and then 1) to 4), doing cleandir before
> each iteration. Maybe copying ofwboot objdir aside after each step
> for possible later forensics.
>
So I went through and built all the cases and saved of the obj/ dirs.
If you want to look at them, let me know and I'll upload them somewhere.
None of the cases boot now except for 4)
Here are the sizes, none were exceptionally huge,
> ll */*/ofwboot.xcf
-rwxr-xr-x 1 scole users 89678 Sep 25 10:10 0/obj/ofwboot.xcf
-rwxr-xr-x 1 scole users 89678 Sep 25 10:12 1/obj/ofwboot.xcf
-rwxr-xr-x 1 scole users 81486 Sep 25 10:13 2/obj/ofwboot.xcf
-rwxr-xr-x 1 scole users 81486 Sep 25 10:15 3/obj/ofwboot.xcf
-rwxr-xr-x 1 scole users 89678 Sep 25 10:17 4/obj/ofwboot.xcf
-rwxr-xr-x 1 scole users 81486 Sep 25 10:46 5/obj/ofwboot.xcf
Here are the headers from the .xcf files:
> powerpc--netbsd-objdump -h */*/*.xcf
0/obj/ofwboot.xcf: file format aixcoff-rs6000
Sections:
Idx Name Size VMA LMA File off Algn
0 .eh_fram 00002eb4 00000074 00000074 0000014c 2**3
CONTENTS, ALLOC, LOAD, DATA
1 .text 00010000 00e00000 00e00000 00003000 2**3
CONTENTS, ALLOC, LOAD, CODE
2 .data 00000258 00e10000 00e10000 00013000 2**3
CONTENTS, ALLOC, LOAD, DATA
3 .bss 00002750 00e10258 00e10258 00000000 2**3
ALLOC
1/obj/ofwboot.xcf: file format aixcoff-rs6000
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00012000 00e00000 00e00000 00001000 2**3
CONTENTS, ALLOC, LOAD, CODE
1 .data 00000258 00e12000 00e12000 00013000 2**3
CONTENTS, ALLOC, LOAD, DATA
2 .bss 00002750 00e12258 00e12258 00000000 2**3
ALLOC
2/obj/ofwboot.xcf: file format aixcoff-rs6000
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00010000 00e00000 00e00000 00001000 2**3
CONTENTS, ALLOC, LOAD, CODE
1 .data 00000258 00e10000 00e10000 00011000 2**3
CONTENTS, ALLOC, LOAD, DATA
2 .bss 00002750 00e10258 00e10258 00000000 2**3
ALLOC
3/obj/ofwboot.xcf: file format aixcoff-rs6000
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00010000 00e00000 00e00000 00001000 2**3
CONTENTS, ALLOC, LOAD, CODE
1 .data 00000258 00e10000 00e10000 00011000 2**3
CONTENTS, ALLOC, LOAD, DATA
2 .bss 00002750 00e10258 00e10258 00000000 2**3
ALLOC
4/obj/ofwboot.xcf: file format aixcoff-rs6000
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 0000f6e0 00e00000 00e00000 00001000 2**3
CONTENTS, ALLOC, LOAD, CODE
1 .eh_fram 00002920 00e0f6dc 00e0f6dc 000106e0 2**3
CONTENTS, ALLOC, LOAD, DATA
2 .data 00000258 00e12000 00e12000 00013000 2**3
CONTENTS, ALLOC, LOAD, DATA
3 .bss 00002750 00e12258 00e12258 00000000 2**3
ALLOC
5/obj/ofwboot.xcf: file format aixcoff-rs6000
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00010000 00e00000 00e00000 00001000 2**3
CONTENTS, ALLOC, LOAD, CODE
1 .data 00000258 00e10000 00e10000 00011000 2**3
CONTENTS, ALLOC, LOAD, DATA
2 .bss 00002750 00e10258 00e10258 00000000 2**3
ALLOC
Maybe someone understands openfirmware or these sections better. Is it
a problem to leave the .eh_fram stuff in? Is there some restriction with
.xcoff or openfirmware having a .text section greater than 16 bits?
Let me know if I can provide any other info that might be useful.
Thanks
From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: port-macppc/52564: current ofwboot.xcf crashes because of
.eh_frame* in .text
Date: Sun, 1 Oct 2017 02:36:59 +0300
On Mon, Sep 25, 2017 at 18:40:01 +0000, scole_mail wrote:
> Valery Ushakov <uwe@stderr.spb.ru> writes:
>
> > Ok, just to be clear, the timeline here seems to be:
> >
> > 1) my commit to elf32_powerpc_merge.x to merge .eh_frame* to .text
> > 2) my commit to ../Makefile.inc to disable .eh_frame generation
> > 3) christos@ commit to keep .eh_frame section
> > 4) commenting out unwind-related flags in ../Makefile.inc
> >
>
> I think that is correct. Just for testing, I added these cases
>
> 0) before any of 1-4 changes
> 5) what's in current as of today
[...]
> So I went through and built all the cases and saved of the obj/ dirs.
> If you want to look at them, let me know and I'll upload them somewhere.
>
> None of the cases boot now except for 4)
[...]
> 4/obj/ofwboot.xcf: file format aixcoff-rs6000
>
> Sections:
> Idx Name Size VMA LMA File off Algn
> 0 .text 0000f6e0 00e00000 00e00000 00001000 2**3
> CONTENTS, ALLOC, LOAD, CODE
> 1 .eh_fram 00002920 00e0f6dc 00e0f6dc 000106e0 2**3
> CONTENTS, ALLOC, LOAD, DATA
> 2 .data 00000258 00e12000 00e12000 00013000 2**3
> CONTENTS, ALLOC, LOAD, DATA
> 3 .bss 00002750 00e12258 00e12258 00000000 2**3
> ALLOC
My uneducated guess is that this has nothing to do with .eh_frame
The .eh_frame just makes .text section not padded up artificially and
absorbs that padding instead.
Please, can you try this patch? Compile tested only and more of a
shot in the dark.
Index: elf32_powerpc_merge.x
===================================================================
RCS file: /cvsroot/src/sys/arch/macppc/stand/fixcoff/elf32_powerpc_merge.x,v
retrieving revision 1.5
diff -u -p -u -r1.5 elf32_powerpc_merge.x
--- elf32_powerpc_merge.x 20 Sep 2017 18:44:22 -0000 1.5
+++ elf32_powerpc_merge.x 30 Sep 2017 23:29:32 -0000
@@ -32,9 +32,6 @@ SECTIONS
*(.rodata.*)
*(.rodata1)
*(.got1)
- }
- .eh_frame :
- {
*(.eh_frame_hdr)
*(.eh_frame)
}
@@ -43,6 +40,7 @@ SECTIONS
.dtors : { *(.dtors) }
_etext = .;
PROVIDE (etext = .);
+ .pad : { LONG(0) }
/* Read-write section, merged into data segment: */
. = (. + 0x0FFF) & 0xFFFFF000;
.data :
With it I get:
Idx Name Size VMA LMA File off Algn
0 .text 0000f6e0 00e00000 00e00000 00001000 2**3
CONTENTS, ALLOC, LOAD, CODE
1 .pad 00000920 00e0f6dc 00e0f6dc 000106e0 2**3
CONTENTS
2 .data 00000258 00e10000 00e10000 00011000 2**3
CONTENTS, ALLOC, LOAD, DATA
3 .bss 00002750 00e10258 00e10258 00000000 2**3
ALLOC
so this should be equivalent to the 4) above.
-uwe
From: scole_mail <scole_mail@gmx.com>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: port-macppc/52564: current ofwboot.xcf crashes because of .eh_frame* in .text
Date: Sun, 01 Oct 2017 09:27:51 -0700
Valery Ushakov <uwe@stderr.spb.ru> writes:
>
> My uneducated guess is that this has nothing to do with .eh_frame
>
> The .eh_frame just makes .text section not padded up artificially and
> absorbs that padding instead.
>
> Please, can you try this patch? Compile tested only and more of a
> shot in the dark.
>
That patch worked fine for me, had the same size .xcf as 4), and had
these sections:
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 0000f7b0 00e00000 00e00000 00001000 2**3
CONTENTS, ALLOC, LOAD, CODE
1 .pad 00000850 00e0f7b0 00e0f7b0 000107b0 2**3
CONTENTS
2 .data 00000258 00e10000 00e10000 00011000 2**3
CONTENTS, ALLOC, LOAD, DATA
3 .bss 00002750 00e10258 00e10258 00000000 2**3
ALLOC
I'm not understanding how the padding works, but if you want the fixed
checked in and PR closed I'm fine with it.
Thanks
From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: port-macppc/52564: current ofwboot.xcf crashes because of
.eh_frame* in .text
Date: Sun, 1 Oct 2017 20:15:25 +0300
On Sun, Oct 01, 2017 at 16:30:01 +0000, scole_mail wrote:
> That patch worked fine for me, had the same size .xcf as 4), and had
> these sections:
>
> Sections:
> Idx Name Size VMA LMA File off Algn
> 0 .text 0000f7b0 00e00000 00e00000 00001000 2**3
> CONTENTS, ALLOC, LOAD, CODE
> 1 .pad 00000850 00e0f7b0 00e0f7b0 000107b0 2**3
> CONTENTS
> 2 .data 00000258 00e10000 00e10000 00011000 2**3
> CONTENTS, ALLOC, LOAD, DATA
> 3 .bss 00002750 00e10258 00e10258 00000000 2**3
> ALLOC
>
> I'm not understanding how the padding works, but if you want the fixed
> checked in and PR closed I'm fine with it.
Thanks for testing. This looks like a bug in the firmware I guess.
-uwe
From: "Valeriy E. Ushakov" <uwe@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/52564 CVS commit: src/sys/arch/macppc/stand/fixcoff
Date: Mon, 2 Oct 2017 00:55:55 +0000
Module Name: src
Committed By: uwe
Date: Mon Oct 2 00:55:55 UTC 2017
Modified Files:
src/sys/arch/macppc/stand/fixcoff: elf32_powerpc_merge.x
Log Message:
PR port-macppc/52564: revert previous and use a different workaround.
The .eh_frame has nothing to do with it, especially since it's not
generated now anyway. The problem is that
. = (. + 0x0FFF) & 0xFFFFF000;
now seems to cause binutils to pad the preceding section, and when
that happens to be .text the powermac ofw is unhappy for whatever
reason.
For now provide .pad section that absorbs the padding as a workaround.
The binutils problem still needs to be looked into.
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/sys/arch/macppc/stand/fixcoff/elf32_powerpc_merge.x
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: port-macppc/52564: current ofwboot.xcf crashes because of
.eh_frame* in .text
Date: Mon, 2 Oct 2017 05:43:18 +0300
On -7 there is .eh_frame, but if I apply my changes from current to
suppress it, I get ELF:
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 0000eef0 00e00000 00e00000 00000060 2**4
CONTENTS, ALLOC, LOAD, CODE
1 .data 0000024e 00e0f000 00e0f000 0000f060 2**3
CONTENTS, ALLOC, LOAD, DATA
2 .bss 00002750 00e0f250 00e0f250 0000f2ae 2**3
ALLOC
converted to COFF:
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 0000eef0 00e00000 00e00000 00000130 2**3
CONTENTS, ALLOC, LOAD, CODE
1 .data 00000250 00e0f000 00e0f000 0000f020 2**3
CONTENTS, ALLOC, LOAD, DATA
2 .bss 00002750 00e0f250 00e0f250 00000000 2**3
ALLOC
On current objcopy seems to force extra alignment/padding now, so ELF
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 0000f6dc 00e00000 00e00000 00000060 2**4
CONTENTS, ALLOC, LOAD, CODE
1 .data 00000256 00e10000 00e10000 00010060 2**3
CONTENTS, ALLOC, LOAD, DATA
2 .bss 00002750 00e10258 00e10258 000102b6 2**3
ALLOC
becomes COFF
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 0000f6e0 00e00000 00e00000 00001000 2**3
CONTENTS, ALLOC, LOAD, CODE
1 .pad 00000920 00e0f6dc 00e0f6dc 000106e0 2**3
CONTENTS
2 .data 00000258 00e10000 00e10000 00011000 2**3
CONTENTS, ALLOC, LOAD, DATA
3 .bss 00002750 00e10258 00e10258 00000000 2**3
ALLOC
-uwe
State-Changed-From-To: open->needs-pullups
State-Changed-By: maya@NetBSD.org
State-Changed-When: Mon, 04 Jun 2018 22:27:19 +0000
State-Changed-Why:
This needs to be backported to -8 because -8 has elf32_powerpc_merge.x:1.4.
From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: port-macppc/52564 (current ofwboot.xcf crashes because of
.eh_frame* in .text)
Date: Tue, 5 Jun 2018 12:39:24 +0300
http://releng.netbsd.org/cgi-bin/req-8.cgi?show=863
-uwe
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/52564 CVS commit: [netbsd-8] src/sys/arch/macppc/stand/fixcoff
Date: Sat, 9 Jun 2018 14:47:37 +0000
Module Name: src
Committed By: martin
Date: Sat Jun 9 14:47:37 UTC 2018
Modified Files:
src/sys/arch/macppc/stand/fixcoff [netbsd-8]: elf32_powerpc_merge.x
Log Message:
Pull up following revision(s) (requested by uwe in ticket #863):
sys/arch/macppc/stand/fixcoff/elf32_powerpc_merge.x: revision 1.6,1.7 (patch)
PR port-macppc/52564
. = (. + 0x0FFF) & 0xFFFFF000;
now seems to cause binutils to pad the preceding section, and when
that happens to be .text the powermac ofw is unhappy for whatever
reason.
For now provide .pad section that absorbs the padding as a workaround.
The binutils problem still needs to be looked into.
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.4.1 \
src/sys/arch/macppc/stand/fixcoff/elf32_powerpc_merge.x
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: needs-pullups->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Sat, 09 Jun 2018 21:34:26 +0000
State-Changed-Why:
Pullups completed. Thanks for all the analysis and fixes.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.