summary refs log tree commit diff
path: root/gas.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2020-08-10 12:28:48 -0400
committerQuentin Carbonneaux <quentin@c9x.me>2021-03-02 10:00:08 +0100
commit83c210834197b7ad3208214a4f9d8669134c4a3c (patch)
tree82b5e49cf07c1f4453819ad9a317480d0cddc328 /gas.c
parentcdee1d81c4c73113eb293bf2ac816bee53047f36 (diff)
downloadroux-83c210834197b7ad3208214a4f9d8669134c4a3c.tar.gz
add data $name = section "section" ...
This allows you to explicitly specify the section to emit the data
directive for, allowing for sections other than .data: for example, .bss
or .init_array.
Diffstat (limited to 'gas.c')
-rw-r--r--gas.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gas.c b/gas.c
index 339154e..f8f4051 100644
--- a/gas.c
+++ b/gas.c
@@ -19,7 +19,11 @@ gasemitdat(Dat *d, FILE *f)
 	switch (d->type) {
 	case DStart:
 		align = 0;
-		fprintf(f, ".data\n");
+		if (d->u.str) {
+			fprintf(f, ".section %s\n", d->u.str);
+		} else {
+			fprintf(f, ".data\n");
+		}
 		break;
 	case DEnd:
 		break;