Better error message for .globl 1$

Local labels can't be exported (or imported).
This commit is contained in:
Olaf Seibert
2021-05-30 12:57:37 +02:00
parent 0ab2a4fa16
commit 652c047711
3 changed files with 21 additions and 5 deletions

View File

@@ -1131,16 +1131,22 @@ static int assemble(
case P_GLOBL:
{
SYMBOL *sym;
int islocal = 0;
while (!EOL(*cp)) {
/* Loop and make definitions for
comma-separated symbols */
label = get_symbol(cp, &ncp, NULL);
label = get_symbol(cp, &ncp, &islocal);
if (label == NULL) {
report(stack->top, "Illegal .GLOBL/.WEAK syntax\n");
return 0;
}
if (islocal) {
report(stack->top, "Local label used in .GLOBL/.WEAK\n");
return 0;
}
sym = lookup_sym(label, &symbol_st);
if (sym) {
sym->flags |= SYMBOLFLAG_GLOBAL | (op->value == P_WEAK ? SYMBOLFLAG_WEAK : 0);