summary refs log tree commit diff
path: root/src/main.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-03-25 20:34:15 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-03-25 20:34:15 -0400
commitaad52241c88ad5327a8488c66dc906c8393c9c92 (patch)
tree43c6244cf40082b97d49840018e59be5f881a9c9 /src/main.c
parent62e238a6ef151d56b79e1f076a57463f2e1fb020 (diff)
downloadroux-aad52241c88ad5327a8488c66dc906c8393c9c92.tar.gz
compatibility fixes for mac os
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c27
1 files changed, 25 insertions, 2 deletions
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 <ctype.h>
 #include <getopt.h>
 
@@ -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 <flags>] [-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) {