summaryrefslogtreecommitdiff
path: root/src/cmd/6a/a.y
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/6a/a.y')
-rw-r--r--src/cmd/6a/a.y25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/cmd/6a/a.y b/src/cmd/6a/a.y
index 1089d4061..29011c7ff 100644
--- a/src/cmd/6a/a.y
+++ b/src/cmd/6a/a.y
@@ -71,15 +71,11 @@ prog:
line
line:
- LLAB ':'
- {
- if($1->value != pc)
- yyerror("redeclaration of %s", $1->name);
- $1->value = pc;
- }
- line
-| LNAME ':'
+ LNAME ':'
{
+ $1 = labellookup($1);
+ if($1->type == LLAB && $1->value != pc)
+ yyerror("redeclaration of %s (%s)", $1->labelname, $1->name);
$1->type = LLAB;
$1->value = pc;
}
@@ -197,11 +193,13 @@ spec1: /* DATA */
spec2: /* TEXT */
mem ',' imm2
{
+ settext($1.sym);
$$.from = $1;
$$.to = $3;
}
| mem ',' con ',' imm2
{
+ settext($1.sym);
$$.from = $1;
$$.from.scale = $3;
$$.to = $5;
@@ -363,15 +361,10 @@ rel:
}
| LNAME offset
{
+ $1 = labellookup($1);
$$ = nullgen;
- if(pass == 2)
- yyerror("undefined label: %s", $1->name);
- $$.type = D_BRANCH;
- $$.offset = $2;
- }
-| LLAB offset
- {
- $$ = nullgen;
+ if(pass == 2 && $1->type != LLAB)
+ yyerror("undefined label: %s", $1->labelname);
$$.type = D_BRANCH;
$$.offset = $1->value + $2;
}