outmacho64.c: Add PC-Relative GOT support and perform general code cleanup.
[nasm.git] / lcc / lin-aout.c
blobe4ac48f287e266ab701251ad692bfe3f4c70e1f5
1 /* x86 running linux and using nasm as a.out */
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 "-Di386", "-D__i386", "-D__i386__",
13 "-Dlinux", "-D__linux", "-D__linux__",
14 "-Dunix", "-D__unix", "-D__unix__",
15 "$1", "$2", "$3", 0
17 char *include[] = { "-I" LCCDIR "include", "-I/usr/local/include",
18 "-I/usr/include", 0
20 char *com[] = { LCCDIR "rcc", "-target=x86/nasm",
21 "$1", "$2", "$3", 0
23 char *as[] = { NASMPATH, "-a", "-faout", "-o", "$3", "$1", "$2", 0 };
24 char *ld[] = { "/usr/bin/ld", "-m", "i386linux",
25 "-L/usr/i486-linuxaout/lib",
26 "-o", "$3", "$1",
27 "/usr/i486-linuxaout/lib/crt0.o",
28 "$2", "", "-lc", 0
30 static char *bbexit = LCCDIR "bbexit.o";
32 extern char *concat(char *, char *);
33 extern int access(const char *, int);
35 int option(char *arg)
37 if (strncmp(arg, "-lccdir=", 8) == 0) {
38 cpp[0] = concat(&arg[8], "/cpp");
39 include[0] = concat("-I", concat(&arg[8], "/include"));
40 com[0] = concat(&arg[8], "/rcc");
41 bbexit = concat(&arg[8], "/bbexit.o");
42 } else if (strcmp(arg, "-g") == 0) ;
43 else if (strcmp(arg, "-b") == 0 && access(bbexit, 4) == 0)
44 ld[9] = bbexit;
45 else
46 return 0;
47 return 1;