On 2010-07-05 at 15:55:44 [+0200], Lucian Adrian Grijincu <lucian.grijincu@xxxxxxxxx> wrote: > > I had some nasty problems loading up LKL into Haiku a few weeks back. > > For some unknown (to me) reason the Linux build scripts produce an > executable with a single LOAD section with RWX rights. > > Haiku thinks that a module should have two LOAD sections a RX (.text) > one and a RW (.data) one. > This is the layout for normal modules produced by Haiku's build scripts. > > The module loader interpreted RWX as a .data section. Because of this, > there was no .text section and some other things got messed up from > this (for example the DYNAMIC section is loaded after the .text > section, but as there is no .text section, it is loaded at an offset > from the NULL pointer => kazam! invalid memory access in the module > loader code). > > I've changed things a bit to incorporate LKL: the IsExecutable check > in elf32.h now checks for RX or RWX sections and I map .text pages as > RWX not RX as before. > > I'd like to know what approach you consider correct: should I dig and > see how I can generate two LOAD sections from the Linux build scripts > or keep a Haiku patch that accepts RWX .text+.data sections? Depends a bit on the patch. Unless it is ugly, I wouldn't mind keeping it. CU, Ingo