1 This directory contains the necessary files to port the C compiler
2 ``LCC'' (available by FTP from sunsite.doc.ic.ac.uk in the directory
3 /computing/programming/languages/c/lcc) to compile for Linux (a.out
4 or ELF) by using NASM as a back-end code generator.
6 This patch has been tested on lcc version 3.6.
10 - Copy `x86nasm.md' into the `src' directory of the lcc tree.
12 - Copy either `lin-elf.c' or `lin-aout.c' into the `etc' directory.
14 - If you're installing for a.out, edit `x86nasm.md' and change the
15 conditional after the comment reading "CHANGE THIS FOR a.out" in
16 the `defsymbol' function from `#if 0' to `#if 1'.
18 - Make the following changes to `bind.c' in the `src' directory:
20 - Near the top of the file, add a line that reads
21 extern Interface x86nasmIR;
23 - In the `bindings' array, add the lines
24 "x86-nasm", &x86nasmIR,
25 "x86/nasm", &x86nasmIR,
26 (in sensible looking places...)
28 A sample `bind.c' has been provided to show what the result of
29 this might look like. You might be able to get away with using it
32 - Modify the lcc makefile to include rules for x86nasm.o: this will
33 have to be done in about three places. Just copy any line with
34 `x86' on it and modify it to read `x86nasm' everywhere. (Except
35 that in the list of object files that rcc is made up from, do
36 remember to ensure that every line but the last has a trailing
39 - You may have to modify the contents of `lin-elf.c' or `lin-aout.c'
40 to reflect the true locations of files such as crt0.o, crt1.o,
41 ld-linux.so and so forth. If you don't know where to find these,
42 compile a short C program with `gcc -v' and see what command line
45 - You should now be able to build lcc, using `lin-elf.c' or
46 `lin-aout.c' as the system-dependent part of the `lcc' wrapper
49 - Symlink x86nasm.c into the `src' directory before attempting the
50 triple test, or the compile will fail.
52 - Now it should pass the triple test, on either ELF or a.out. Voila!