[racket] Adding OS X linker options using raco exe

From: Norman Gray (norman at astro.gla.ac.uk)
Date: Fri Oct 22 11:11:32 EDT 2010

Matthew, hello.

On 2010 Oct 22, at 14:45, Matthew Flatt wrote:

> `raco exe' doesn't use the system linker (in the sense of `ld') at all.
> It clones an existing binary and then adds an extra load command by
> manipulating the Mach-O format directly. Flags added by `++exf',
> meanwhile, are flags to the embedded `racket' or `gracket' in the
> executable.

Ah, I see -- this makes things clear.

> I'm not sure how you'd add a section to an already-linked executable.
> Maybe `libtool' can do that. It's possible that you could adapt the
> code in "collects/compiler/private/mach-o.rkt" to add a section, but
> I'm not sure how difficult it is to add a section as opposed to a load
> command.
> 
> It may be easiest to change the linker command in the Makefile when
> building racket or gracket to add the `-sectcreate' flag. Then, when
> `raco exe' clones the binary, your extra section would be there.

Hmm: these are sounding quite heavyweight, unless there is indeed a way of manipulating the resulting executable, as you suggest.

If I do manage to do this, I'll report back here.

Thanks for the pointers.

Best wishes,

Norman


-- 
Norman Gray  :  http://nxg.me.uk



Posted on the users mailing list.