Subject: Re: evbppc/powerpc cant run init
To: Juergen Hannken-Illjes <hannken@eis.cs.tu-bs.de>
From: Matt Thomas <matt@3am-software.com>
List: port-macppc
Date: 12/12/2003 09:52:49
On Dec 12, 2003, at 8:52 AM, Juergen Hannken-Illjes wrote:

> With the recent change to kern/exec_elf32.c evbppc/powerpc can't run 
> init:
>
> kern/exec_elf32.c treats every program section with VM_PROT_WRITE as 
> data.
>
> /sbin/init is
>
> Program Headers:
>   Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg 
> Align
>   PHDR           0x000034 0x01800034 0x01800034 0x000c0 0x000c0 R E 0x4
>   INTERP         0x000114 0x01800114 0x01800114 0x00013 0x00013 R   0x1
>   LOAD           0x000000 0x01800000 0x01800000 0x0427c 0x0427c RWE 
> 0x10000
>   LOAD           0x00427c 0x0181427c 0x0181427c 0x00158 0x0066c RWE 
> 0x10000
>   DYNAMIC        0x0042e0 0x018142e0 0x018142e0 0x000c8 0x000c8 RW  0x4
>   NOTE           0x000128 0x01800128 0x01800128 0x00018 0x00018 R   0x4
>
> Both text and data are rwx and thus treated as data.
> -- 
> Juergen Hannken-Illjes - hannken@eis.cs.tu-bs.de - TU Braunschweig 
> (Germany)

This is actually due to a bug in gcc 3.3.2 which was marking the .init 
and
.fini sections as writable.  I pulled up a fix from gcc -current which 
fixes
the problem.

Program Headers:
   Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg 
Align
   PHDR           0x000034 0x01800034 0x01800034 0x000c0 0x000c0 R E 0x4
   INTERP         0x000114 0x01800114 0x01800114 0x00013 0x00013 R   0x1
       [Requesting program interpreter: /libexec/ld.elf_so]
   LOAD           0x000000 0x01800000 0x01800000 0x042b4 0x042b4 R E 
0x10000
   LOAD           0x0042b4 0x018142b4 0x018142b4 0x00158 0x00674 RWE 
0x10000
   DYNAMIC        0x004318 0x01814318 0x01814318 0x000c8 0x000c8 RW  0x4
   NOTE           0x000128 0x01800128 0x01800128 0x00018 0x00018 R   0x4

So you'll have to do a new full build to get things to work again.
-- 
Matt Thomas                     email: matt@3am-software.com
3am Software Foundry              www: http://3am-software.com/bio/matt/
Cupertino, CA              disclaimer: I avow all knowledge of this 
message.