pouët.net

Laturi by The Digital Artists [web]

Laturi by TS/The Digital Artists
--------------------------------

Laturi is a linker and compression front-end intended to be used for Mac OS X
4k (and perhaps 64K) intros.

Compatibility:

Following executables can be created from corresponding object
- 10.5.x 32bit
- 10.6.x 32bit
- 10.6.x 64bit (64bit build system required. very experimental)
- multi 32bit binary that works for 10.5.x and 10.6.x (not recommended)

There exists options for different boot-stubs and cpu-options. The more
compatible the binary is, more larger it gets


Working principle:

Objects that are specified from commandline are read, linked into
one absolute linear segment starting from 0x0 (including bootstrap),
text-segments in order of command line appearance, then data segments
in same order. Finally BSS-segments are defined together with heap.
Top of the heap is stack. Entrypoint is '_main', no argc/argv/envp provided.

This one output segment has rwx-rights, thus allowing you make
self-modidyfying code if you like or defining variables together with your
code. These tricks are not recommended but choice is yours...

Bootstrap includes code which resolves external symbols from libraries
which are replaced by hashes. (Due to the inner workings of OS X typically
only top-level libraries need to specified, rest of them will get loaded by
dependencies f.e. GLUT also loads OpenGL)

The next optional step is to feed the output to compressor. The compresor
is content-adaptive deflate using simple shell script to unpack and execute
the resulting binary. the more properly you divide similar data-items into
their own sections, the more compressor can churn and probably improve
compression performance.

Usage:

Usage: laturi [options]

Options:
	-i,--input file 
		Input file(s) to be linked and optionally compressed
	-o,--output file
		Output file to be generated
	-l,--library library
		Link with library
	-f,--framework framework
		Link with framework
	-m,--heap-size
		Target program heap size incl. code, stack on top of heap
		[default: minimum 64k, rounded to next largest 2^n]
	-x,--tgt-os osversion
		Generate binary with 10.x compatibility, valid values 0,5-6
		0 builds larger executable compatible with all supported versions
		  x86_64 builds are only built for 10.6
		[default: match host]
		[WARNING: the target should match the build machine version]
	   --tgt-noclean
		Use smaller start-stub that does not delete tmp-file after exit
		[default: clean-version]
	   --tgt-nopack
		Do not compress, only link
		[default: compression enabled]
	-v,--verbose
		Be verbose
	-h,--help
		This page

please see examples!


I would like to thank these people for sharing their ideas/code in the net:

Marq/Fit  -- Thanks for the shell script unpacker idea: shortened it from 56
             bytes to 50 bytes though by abusing gzip headers...
jix/Titan -- You found some more creative ways to abuse Mach-O headers. I
             copied them. ( Get your stuff working in SL so we can compare ;) )


TODO:

- Feedback wanted on 64bit (there are bugs)
- Feedback wanted on difficult cases (complex objects/funny compression
  anomalies/etc.)

Have fun!