mirror of
https://github.com/netwide-assembler/nasm.git
synced 2024-12-21 09:19:31 +08:00
53 lines
2.0 KiB
Plaintext
53 lines
2.0 KiB
Plaintext
This directory contains the necessary files to port the C compiler
|
|
``LCC'' (available by FTP from sunsite.doc.ic.ac.uk in the directory
|
|
/computing/programming/languages/c/lcc) to compile for Linux (a.out
|
|
or ELF) by using NASM as a back-end code generator.
|
|
|
|
This patch has been tested on lcc version 3.6.
|
|
|
|
To install:
|
|
|
|
- Copy `x86nasm.md' into the `src' directory of the lcc tree.
|
|
|
|
- Copy either `lin-elf.c' or `lin-aout.c' into the `etc' directory.
|
|
|
|
- If you're installing for a.out, edit `x86nasm.md' and change the
|
|
conditional after the comment reading "CHANGE THIS FOR a.out" in
|
|
the `defsymbol' function from `#if 0' to `#if 1'.
|
|
|
|
- Make the following changes to `bind.c' in the `src' directory:
|
|
|
|
- Near the top of the file, add a line that reads
|
|
extern Interface x86nasmIR;
|
|
|
|
- In the `bindings' array, add the lines
|
|
"x86-nasm", &x86nasmIR,
|
|
"x86/nasm", &x86nasmIR,
|
|
(in sensible looking places...)
|
|
|
|
A sample `bind.c' has been provided to show what the result of
|
|
this might look like. You might be able to get away with using it
|
|
directly...
|
|
|
|
- Modify the lcc makefile to include rules for x86nasm.o: this will
|
|
have to be done in about three places. Just copy any line with
|
|
`x86' on it and modify it to read `x86nasm' everywhere. (Except
|
|
that in the list of object files that rcc is made up from, do
|
|
remember to ensure that every line but the last has a trailing
|
|
backslash...)
|
|
|
|
- You may have to modify the contents of `lin-elf.c' or `lin-aout.c'
|
|
to reflect the true locations of files such as crt0.o, crt1.o,
|
|
ld-linux.so and so forth. If you don't know where to find these,
|
|
compile a short C program with `gcc -v' and see what command line
|
|
gcc feeds to `ld'.
|
|
|
|
- You should now be able to build lcc, using `lin-elf.c' or
|
|
`lin-aout.c' as the system-dependent part of the `lcc' wrapper
|
|
program.
|
|
|
|
- Symlink x86nasm.c into the `src' directory before attempting the
|
|
triple test, or the compile will fail.
|
|
|
|
- Now it should pass the triple test, on either ELF or a.out. Voila!
|