Add support for consecutive labels; needed by the B compiler.

This commit is contained in:
David Given 2016-11-27 21:18:00 +01:00
parent b9665c7c99
commit fbd6e8f63d

View file

@ -12,14 +12,19 @@ static struct symbol* pending;
void data_label(const char* label) void data_label(const char* label)
{ {
if (pending) struct symbol* sym = symbol_get(label);
fatal("two consecutive data labels ('%s' and '%s')", if (sym->is_defined)
pending->name, label); fatal("label '%s' defined twice", sym->name);
pending = symbol_get(label); if (pending)
if (pending->is_defined) fprintf(outputfile, "%s = %s\n",
fatal("label '%s' defined twice", pending->name); platform_label(label), platform_label(pending->name));
pending->is_defined = true; else
{
pending = sym;
pending = symbol_get(label);
pending->is_defined = true;
}
} }
static const char* section_to_str(int section) static const char* section_to_str(int section)