summary refs log tree commit diff
path: root/fold.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin@c9x.me>2022-09-09 17:40:31 +0200
committerQuentin Carbonneaux <quentin@c9x.me>2022-10-08 21:48:42 +0200
commit00a30954aca97004cb6f586bdeeabb488f1e3c3f (patch)
tree951dc4c0a5be04fe7d5aed13f4201eb90c60f841 /fold.c
parent5cea0c20ee3573949a2c24e4b3dea65fcbf6e48b (diff)
downloadroux-00a30954aca97004cb6f586bdeeabb488f1e3c3f.tar.gz
add support for thread-local storage
The apple targets are not done yet.
Diffstat (limited to 'fold.c')
-rw-r--r--fold.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fold.c b/fold.c
index 24b09a6..0bbf8a7 100644
--- a/fold.c
+++ b/fold.c
@@ -334,9 +334,10 @@ foldint(Con *res, int op, int w, Con *cl, Con *cr)
 	} l, r;
 	uint64_t x;
 	uint32_t lab;
-	int typ;
+	int typ, rel;
 
 	typ = CBits;
+	rel = RelDef;
 	lab = 0;
 	l.s = cl->bits.i;
 	r.s = cr->bits.i;
@@ -345,10 +346,12 @@ foldint(Con *res, int op, int w, Con *cl, Con *cr)
 			if (cr->type == CAddr)
 				return 1;
 			lab = cl->label;
+			rel = cl->rel;
 			typ = CAddr;
 		}
 		else if (cr->type == CAddr) {
 			lab = cr->label;
+			rel = cr->rel;
 			typ = CAddr;
 		}
 	}
@@ -356,6 +359,7 @@ foldint(Con *res, int op, int w, Con *cl, Con *cr)
 		if (cl->type == CAddr) {
 			if (cr->type != CAddr) {
 				lab = cl->label;
+				rel = cl->rel;
 				typ = CAddr;
 			} else if (cl->label != cr->label)
 				return 1;
@@ -404,6 +408,7 @@ foldint(Con *res, int op, int w, Con *cl, Con *cr)
 		x = l.u;
 		if (cl->type == CAddr) {
 			lab = cl->label;
+			rel = cl->rel;
 			typ = CAddr;
 		}
 		break;
@@ -457,7 +462,7 @@ foldint(Con *res, int op, int w, Con *cl, Con *cr)
 		else
 			die("unreachable");
 	}
-	*res = (Con){.type=typ, .label=lab, .bits={.i=x}};
+	*res = (Con){.type=typ, .label=lab, .rel=rel, .bits={.i=x}};
 	return 0;
 }