65816 now generate EXPR_NEARADDR instead of EXPR_WORD0 for default assumed address mode, which will be validated by the linker's range check rather than blindly truncated. Assuming the assembler correctly validated this, the linker is allowed to truncate.

This commit is contained in:
bbbradsmith
2019-05-01 02:12:03 -04:00
committed by Oliver Schmidt
parent a01c4231f2
commit ac2ecb0b2c
7 changed files with 61 additions and 3 deletions

View File

@@ -1277,6 +1277,26 @@ static void StudyDWord (ExprNode* Expr, ExprDesc* D)
static void StudyNearAddr (ExprNode* Expr, ExprDesc* D)
/* Study an EXPR_NearAddr expression node */
{
/* Study the expression */
StudyExprInternal (Expr->Left, D);
/* We can handle only const expressions */
if (!ED_IsConst (D)) {
ED_Invalidate (D);
}
/* Promote to absolute if smaller. */
if (D->AddrSize < ADDR_SIZE_ABS)
{
D->AddrSize = ADDR_SIZE_ABS;
}
}
static void StudyExprInternal (ExprNode* Expr, ExprDesc* D)
/* Study an expression tree and place the contents into D */
{
@@ -1427,6 +1447,10 @@ static void StudyExprInternal (ExprNode* Expr, ExprDesc* D)
StudyWord1 (Expr, D);
break;
case EXPR_NEARADDR:
StudyNearAddr (Expr, D);
break;
case EXPR_FARADDR:
StudyFarAddr (Expr, D);
break;