NASM 0.98.16
[nasm/avx512.git] / lcc / lin-elf.c
blob3af9fe8f51e67700edba78f4818e5960de43fcdb
1 /* x86 running linux and using nasm as ELF */
3 #include <string.h>
5 #ifndef LCCDIR
6 #define LCCDIR "/usr/local/lib/lcc/"
7 #endif
9 #define NASMPATH "/usr/local/bin/nasm"
11 char *cpp[] = { LCCDIR "cpp", "-D__STDC__=1",
12 "-D__ELF__", "-Di386", "-D__i386", "-D__i386__",
13 "-Dlinux", "-D__linux", "-D__linux__",
14 "$1", "$2", "$3", 0 };
15 char *include[] = { "-I" LCCDIR "include", "-I/usr/local/include",
16 "-I/usr/include", 0 };
17 char *com[] = { LCCDIR "rcc", "-target=x86/nasm",
18 "$1", "$2", "$3", 0 };
19 char *as[] = { NASMPATH, "-a", "-felf", "-o", "$3", "$1", "$2", 0 };
20 char *ld[] = { "/usr/bin/ld", "-m", "elf_i386",
21 "-dynamic-linker", "/lib/ld-linux.so.1",
22 "-L/usr/i486-linux/lib",
23 "-o", "$3", "$1",
24 "/usr/lib/crt1.o", "/usr/lib/crti.o", "/usr/lib/crtbegin.o",
25 "$2", "",
26 "-lc", "", "/usr/lib/crtend.o", "/usr/lib/crtn.o", 0 };
27 static char *bbexit = LCCDIR "bbexit.o";
29 extern char *concat(char *, char *);
30 extern int access(const char *, int);
32 int option(char *arg) {
33 if (strncmp(arg, "-lccdir=", 8) == 0) {
34 cpp[0] = concat(&arg[8], "/cpp");
35 include[0] = concat("-I", concat(&arg[8], "/include"));
36 com[0] = concat(&arg[8], "/rcc");
37 bbexit = concat(&arg[8], "/bbexit.o");
38 } else if (strcmp(arg, "-g") == 0)
40 else if (strcmp(arg, "-b") == 0 && access(bbexit, 4) == 0)
41 ld[13] = bbexit;
42 else
43 return 0;
44 return 1;