This chapter describes the output modules included with Sassy.
Dumps the raw contents of the text section of sassy-output to file followed by the data section, if any. If there is no text section and only a data section, then the data section will be dumped. If the file exists, it will be overwritten. opts is a set of zero, one or more of the following quoted symbols:
'bootCreates a flat binary with the text section first, then the data section, then zero bytes until byte 510 at which
aa55is written. The resultant size of the assembled binary will be exactly 512 bytes–the common size of a boot sector.
'statsEmits to stdout the size of the text segment in bytes, the size of the data section in bytes, and the number of bytes consumed by alignment requirements.
Constructs a GNU/Linux x86 ELF object-file based on the contents of the sassy-output and writes it to file. If the file exists it will be overwritten.
If you are creating an executable, you’ll need to
_start, or use
If you are writing shared libraries:
You must write
importany labels in other libraries you want to use.
To call or branch to a procedure in another library, instead of writing the label “foo”, you write.(call (plt foo)) (jmp (plt foo))
To access local data in your library, you use the following sequence to get the address of the data into a register via
(lea ...). (in this example the address of foo is loaded into eax).:(begin get-got (lea eax (& ebx (got-offset foo))))
The important thing is to load the global offset table into ebx via the
get-gotmacro, and use the
(got-offset ...)macro to load the data.
To access data in another library, you do something slightly different to obtain its address. You load the GOT with
get-got, but instead you use the
(got ...)macro.(begin get-got (mov eax (& ebx (got foo))))