[haiku-development] single LOAD section modules

  • From: Lucian Adrian Grijincu <lucian.grijincu@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Mon, 5 Jul 2010 16:55:44 +0300

Hi,

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?

-- 
 .
..: Lucian

Other related posts: