From aad52241c88ad5327a8488c66dc906c8393c9c92 Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Fri, 25 Mar 2016 20:34:15 -0400 Subject: compatibility fixes for mac os --- src/main.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index b8cd7d6..c1664be 100644 --- a/src/main.c +++ b/src/main.c @@ -1,4 +1,5 @@ #include "all.h" +#include "config.h" #include #include @@ -74,10 +75,11 @@ main(int ac, char *av[]) { FILE *inf; char *f; - int c; + int c, asm; + asm = Defaultasm; outf = stdout; - while ((c = getopt(ac, av, "d:o:")) != -1) + while ((c = getopt(ac, av, "d:o:G:")) != -1) switch (c) { case 'd': for (; *optarg; optarg++) @@ -90,11 +92,32 @@ main(int ac, char *av[]) if (strcmp(optarg, "-") != 0) outf = fopen(optarg, "w"); break; + case 'G': + if (strcmp(optarg, "e") == 0) + asm = Gaself; + else if (strcmp(optarg, "m") == 0) + asm = Gasmacho; + else { + fprintf(stderr, "unknown gas flavor '%s'\n", optarg); + exit(1); + } + break; default: fprintf(stderr, "usage: %s [-d ] [-o out] {file.ssa, -}\n", av[0]); exit(1); } + switch (asm) { + case Gaself: + locprefix = ".L"; + symprefix = ""; + break; + case Gasmacho: + locprefix = "L"; + symprefix = "_"; + break; + } + do { f = av[optind]; if (!f || strcmp(f, "-") == 0) { -- cgit 1.4.1