diff options
-rw-r--r-- | subx/026labels.cc | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/subx/026labels.cc b/subx/026labels.cc index 33ab8a2d..eb3c255d 100644 --- a/subx/026labels.cc +++ b/subx/026labels.cc @@ -50,15 +50,12 @@ void compute_addresses_for_labels(const segment& code, map<string, uint32_t> add else { if (contains_any_operand_metadata(curr)) raise << "'" << to_string(inst) << "': label definition (':') not allowed in operand\n" << end(); - if (j == 0) { - string label = curr.data.substr(0, SIZE(curr.data)-1); - put(address, label, current_byte); - trace(99, "label") << "label '" << label << "' is at address " << (current_byte+code.start) << end(); - // no modifying current_byte; label definitions won't be in the final binary - } - else { + if (j > 0) raise << "'" << to_string(inst) << "': labels can only be the first word in a line.\n" << end(); - } + string label = curr.data.substr(0, SIZE(curr.data)-1); + put(address, label, current_byte); + trace(99, "label") << "label '" << label << "' is at address " << (current_byte+code.start) << end(); + // no modifying current_byte; label definitions won't be in the final binary } } } |