From: David Given Date: Sun, 27 Nov 2016 20:18:00 +0000 (+0100) Subject: Add support for consecutive labels; needed by the B compiler. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=fbd6e8f63db91116fc8b1023a8c24bd584c8612b;p=ack.git Add support for consecutive labels; needed by the B compiler. --- diff --git a/mach/proto/mcg/data.c b/mach/proto/mcg/data.c index 13352ed37..ff4ddb5bd 100644 --- a/mach/proto/mcg/data.c +++ b/mach/proto/mcg/data.c @@ -12,14 +12,19 @@ static struct symbol* pending; void data_label(const char* label) { - if (pending) - fatal("two consecutive data labels ('%s' and '%s')", - pending->name, label); + struct symbol* sym = symbol_get(label); + if (sym->is_defined) + fatal("label '%s' defined twice", sym->name); - pending = symbol_get(label); - if (pending->is_defined) - fatal("label '%s' defined twice", pending->name); - pending->is_defined = true; + if (pending) + fprintf(outputfile, "%s = %s\n", + platform_label(label), platform_label(pending->name)); + else + { + pending = sym; + pending = symbol_get(label); + pending->is_defined = true; + } } static const char* section_to_str(int section)