aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <[email protected]>2022-08-29 18:45:52 +0200
committerQuentin Carbonneaux <[email protected]>2022-08-31 21:42:49 +0200
commit8dddb971d923fa19dced39013e6d4a39676e065a (patch)
tree88192ecf3a60de73f06d03dab51dc51f17fb4ab7 /main.c
parent5490268683c82ad07eac6d2e8296a45702a8381e (diff)
drop -G flag and add target amd64_apple
apple support is more than assembly syntax in case of arm64 machines, and apple syntax is currently useless in all cases but amd64; rather than having a -G option that only makes sense with amd64, we add a new target amd64_apple
Diffstat (limited to 'main.c')
-rw-r--r--main.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/main.c b/main.c
index 5ea5704..e82b062 100644
--- a/main.c
+++ b/main.c
@@ -19,11 +19,13 @@ char debug['Z'+1] = {
};
extern Target T_amd64_sysv;
+extern Target T_amd64_apple;
extern Target T_arm64;
extern Target T_rv64;
static Target *tlist[] = {
&T_amd64_sysv,
+ &T_amd64_apple,
&T_arm64,
&T_rv64,
0
@@ -40,7 +42,7 @@ data(Dat *d)
fputs("/* end data */\n\n", outf);
freeall();
}
- gasemitdat(d, outf);
+ emitdat(d, outf);
}
static void
@@ -92,7 +94,6 @@ func(Fn *fn)
fn->rpo[n]->link = fn->rpo[n+1];
if (!dbg) {
T.emitfn(fn, outf);
- gasemitfntail(fn->name, outf);
fprintf(outf, "/* end function %s */\n\n", fn->name);
} else
fprintf(stderr, "\n");
@@ -105,12 +106,11 @@ main(int ac, char *av[])
Target **t;
FILE *inf, *hf;
char *f, *sep;
- int c, asmmode;
+ int c;
- asmmode = Defasm;
T = Deftgt;
outf = stdout;
- while ((c = getopt(ac, av, "hd:o:G:t:")) != -1)
+ while ((c = getopt(ac, av, "hd:o:t:")) != -1)
switch (c) {
case 'd':
for (; *optarg; optarg++)
@@ -144,16 +144,6 @@ main(int ac, char *av[])
}
}
break;
- case 'G':
- if (strcmp(optarg, "e") == 0)
- asmmode = Gaself;
- else if (strcmp(optarg, "m") == 0)
- asmmode = Gasmacho;
- else {
- fprintf(stderr, "unknown gas flavor '%s'\n", optarg);
- exit(1);
- }
- break;
case 'h':
default:
hf = c != 'h' ? stderr : stdout;
@@ -168,13 +158,10 @@ main(int ac, char *av[])
fputs(" (default)", hf);
}
fprintf(hf, "\n");
- fprintf(hf, "\t%-11s generate gas (e) or osx (m) asm\n", "-G {e,m}");
fprintf(hf, "\t%-11s dump debug information\n", "-d <flags>");
exit(c != 'h');
}
- gasinit(asmmode);
-
do {
f = av[optind];
if (!f || strcmp(f, "-") == 0) {
@@ -192,7 +179,7 @@ main(int ac, char *av[])
} while (++optind < ac);
if (!dbg)
- gasemitfin(outf);
+ T.emitfin(outf);
exit(0);
}