Compiling and linking JOS


All the libraries you need to create your JOS executable are located in the class directory at /home/cs560/lib/sparc-sun-solaris2.9. The specific libraries you will need for JOS are listed below. You probably want to link with them in this order because you can get strange linking errors if you don't. You'll also need to link with -lnsl on all machines, and -lsocket on solaris machines. Here are the libraries:

Here is an example makefile.


Cross-compiling to JOS

You can compile your own c-code to run in the jos environment by using the cross compiler set up in the cs560 directory. Here is the makefile you need to use to do this. Using the makefile is pretty straightforward... it's just like using a normal makefile, only it's a little uglier. Here is an example:

cs560/test_execs/src>cat > evil_test.c
main() { while(1) fork(); }
cs560/test_execs/src>make evil_test
/home/cs560/xcomp/sparc-sun-solaris2.9/decstation-ultrix/bin/gcc -c -I \
/home/cs560/xcomp/include -G0  evil_test.c
/home/cs560/xcomp/sparc-sun-solaris2.9/decstation-ultrix/bin/ld -G0 -T 
/home/cs560/xcomp/support/noff.ld -N -L/home/cs560/xcomp/sparc-sun-s
olaris2.7/lib -o evil_test.coff /home/cs560/xcomp/support/crt0.o /h
ome/cs560/xcomp/support/assist.o evil_test.o -lc -lsys
/home/cs560/xcomp/coff2noff/sparc-sun-solaris2.9/coff2noff evil_test.coff
evil_test
numsections 3 
Loading 3 sections:
        ".text", filepos 0xd0, mempos 0x0, size 0x180
        ".data", filepos 0x250, mempos 0x200, size 0x10
        ".bss", filepos 0x0, mempos 0x210, size 0x0
/bin/rm evil_test.coff
cs560/test_execs/src>ls evil_test*
evil_test  evil_test.c  evil_test.o