Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Forth > Re: Sections in...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 7 Topic 3994 of 4065
Post > Topic >>

Re: Sections in assembler forth's on un*x

by Robert Spykerman <robert.spykerman@[EMAIL PROTECTED] > Apr 13, 2008 at 02:12 AM

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




 7 Posts in Topic:
Sections in assembler forth's on un*x
Albert van der Horst <  2008-04-13 04:21:15 
Re: Sections in assembler forth's on un*x
Robert Spykerman <robe  2008-04-13 02:12:05 
Re: Sections in assembler forth's on un*x
Albert van der Horst <  2008-04-13 11:49:03 
Re: Sections in assembler forth's on un*x
Robert Spykerman <robe  2008-04-13 17:57:07 
Re: Sections in assembler forth's on un*x
Albert van der Horst <  2008-04-16 06:09:26 
Re: Sections in assembler forth's on un*x
Robert Spykerman <robe  2008-04-16 01:08:00 
Re: Sections in assembler forth's on un*x
Robert Spykerman <robe  2008-04-25 01:40:38 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat May 17 5:22:42 CDT 2008.