From 83c210834197b7ad3208214a4f9d8669134c4a3c Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Mon, 10 Aug 2020 12:28:48 -0400 Subject: 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. --- gas.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'gas.c') 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; -- cgit 1.4.1