OCaml Forge

Browse | Submit A New Snippet | Create A Package

Link assembly files output by ocamlopt -S

GNU General Public License
Unix Shell
Describes the steps required to compile .s file as generated by the -S option to ocamlopt. This makes it possible to link an assembly file of ocaml code which has been edited by hand.

Versions Of This Snippet:

Snippet ID Download Version Date Posted Author Delete
130.12010-11-19 20:44Eric Schulte

Download a raw-text version of this code by clicking on "Download Version"


Latest Snippet Version: 0.1

# note this is not a functional shell script, # but rather a description of a series of steps to be taken in the shell PROG=$1 # 1) first we generate the required .s and startup files ocamlopt -dstartup -S $PROG # 2) the next step is to find which flags are passed from ocamlopt to gcc ocamlopt -verbose $PROG # 3) edit your .s file by hand # 4) call gcc manually using the flags output in step 2 being sure to pass both the startup.s and $PROG.s files to gcc as additional parameters

Submit a new version

You can submit a new version of this snippet if you have modified it and you feel it is appropriate to share with others..