On Apr 13, 2:21 pm, Albert van der Horst <alb...@[EMAIL PROTECTED]
>
wrote:
> Recent discussions about specification of sections and linking
> of lina on linux and xina on OSX set me thinking and experimenting.
>
> I declared with emphasis that the normal sections are unusable for
Forth,
> not being executable or not being writable.
>
> However, because the .text .data and .bss sections are special, they
> are known to the linker and may be treated as special by the linker.
> They do! It turns out that there is a linker flag, that makes the code
> section writable. It is the -N or --omagic flag. At least it is
> supported by the GNU loader.
As you probably realize, Albert, OS X unfortunately does not use the
standard ld linker.
Recapping the discussions with Josh on patching privileges on the mach
header so that the __TEXT and __DATA segments are rwx (it, of course,
works) - I found that a bit inconvenient after a few reassembles.
It turns out the linker has a 'rarely used' option -segprot
http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/ld.1.html
so:
$ ld forth.o -segprot __TEXT rwx rwx -segprot __DATA rwx rwx -o forth
Now I believe you got both your text and .bss in one segment, under
linux, didn't you Albert?
I'm still figuring out if this is possible under OS X but I don't
think so.
Robert Spykerman


|