From fbd6e8f63db91116fc8b1023a8c24bd584c8612b Mon Sep 17 00:00:00 2001 From: David Given Date: Sun, 27 Nov 2016 21:18:00 +0100 Subject: [PATCH] Add support for consecutive labels; needed by the B compiler. --- mach/proto/mcg/data.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) 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)