* assemble.pas (TInternalAssembler.TreePass0): Avoid range/overflow check error.

(TInternalAssembler.TreePass2): Check that objsymend and objsym are in same section
    and avoid range/overflow check error.

git-svn-id: trunk@43028 -
This commit is contained in:
pierre 2019-09-17 21:06:18 +00:00
parent 94832d5eea
commit eb3a470f45

View File

@ -1615,9 +1615,11 @@ Implementation
(objsym.objsection<>ObjData.CurrObjSec) then (objsym.objsection<>ObjData.CurrObjSec) then
InternalError(200404124); InternalError(200404124);
end end
{$push} {$R-}{$Q-}
else else
Tai_const(hp).value:=objsymend.address-objsym.address+Tai_const(hp).symofs; Tai_const(hp).value:=objsymend.address-objsym.address+Tai_const(hp).symofs;
end; end;
{$pop}
end; end;
end; end;
ObjData.alloc(tai_const(hp).size); ObjData.alloc(tai_const(hp).size);
@ -1768,9 +1770,11 @@ Implementation
(objsym.objsection<>ObjData.CurrObjSec) then (objsym.objsection<>ObjData.CurrObjSec) then
internalerror(200905042); internalerror(200905042);
end end
{$push} {$R-}{$Q-}
else else
Tai_const(hp).value:=objsymend.address-objsym.address+Tai_const(hp).symofs; Tai_const(hp).value:=objsymend.address-objsym.address+Tai_const(hp).symofs;
end; end;
{$pop}
if (Tai_const(hp).consttype in [aitconst_uleb128bit,aitconst_sleb128bit]) then if (Tai_const(hp).consttype in [aitconst_uleb128bit,aitconst_sleb128bit]) then
Tai_const(hp).fixsize; Tai_const(hp).fixsize;
ObjData.alloc(tai_const(hp).size); ObjData.alloc(tai_const(hp).size);
@ -1981,8 +1985,17 @@ Implementation
objsym:=Objdata.SymbolRef(tai_const(hp).sym); objsym:=Objdata.SymbolRef(tai_const(hp).sym);
objsymend:=Objdata.SymbolRef(tai_const(hp).endsym); objsymend:=Objdata.SymbolRef(tai_const(hp).endsym);
relative_reloc:=(objsym.objsection<>objsymend.objsection); relative_reloc:=(objsym.objsection<>objsymend.objsection);
Tai_const(hp).value:=objsymend.address-objsym.address+Tai_const(hp).symofs; if objsymend.objsection<>objsym.objsection then
begin
if (Tai_const(hp).consttype in [aitconst_uleb128bit,aitconst_sleb128bit]) or
(objsym.objsection<>ObjData.CurrObjSec) then
internalerror(2019010301);
end
else
{$push} {$R-}{$Q-}
Tai_const(hp).value:=objsymend.address-objsym.address+Tai_const(hp).symofs;
end; end;
{$pop}
case tai_const(hp).consttype of case tai_const(hp).consttype of
aitconst_64bit, aitconst_64bit,
aitconst_32bit, aitconst_32bit,