* keep the proper original section name and order (and not just the type) of the

last encountered section at the object cut location when writing a smartlinked
  library with the internal assembler. This fixes the $HUGECODE directive with
  the internal assembler on i8086 and maybe other things on other platforms,
  that use library based smartlinking in combination with the internal asm.

git-svn-id: trunk@30615 -
This commit is contained in:
nickysn 2015-04-16 23:33:26 +00:00
parent 3be51e1455
commit 7315175c32

View File

@ -1819,6 +1819,8 @@ Implementation
startsectype : TAsmSectiontype;
place: tcutplace;
ObjWriter : TObjectWriter;
startsecname: String;
startsecorder: TAsmSectionOrder;
begin
if not(cs_asm_leave in current_settings.globalswitches) and
not(af_needar in target_asm.flags) then
@ -1828,7 +1830,9 @@ Implementation
NextSmartName(cut_normal);
ObjOutput:=CObjOutput.Create(ObjWriter);
startsectype:=sec_code;
startsectype:=sec_none;
startsecname:='';
startsecorder:=secorder_default;
{ start with list 1 }
currlistidx:=1;
@ -1842,7 +1846,8 @@ Implementation
ObjData.currpass:=0;
ObjData.resetsections;
ObjData.beforealloc;
ObjData.createsection(startsectype);
if startsectype<>sec_none then
ObjData.CreateSection(startsectype,startsecname,startsecorder);
TreePass0(hp);
ObjData.afteralloc;
{ leave if errors have occured }
@ -1853,7 +1858,8 @@ Implementation
ObjData.currpass:=1;
ObjData.resetsections;
ObjData.beforealloc;
ObjData.createsection(startsectype);
if startsectype<>sec_none then
ObjData.CreateSection(startsectype,startsecname,startsecorder);
TreePass1(hp);
ObjData.afteralloc;
@ -1866,7 +1872,8 @@ Implementation
ObjOutput.startobjectfile(ObjFileName);
ObjData.resetsections;
ObjData.beforewrite;
ObjData.createsection(startsectype);
if startsectype<>sec_none then
ObjData.CreateSection(startsectype,startsecname,startsecorder);
hp:=TreePass2(hp);
ObjData.afterwrite;
@ -1892,12 +1899,18 @@ Implementation
place := cut_normal;
{ avoid empty files }
startsectype:=sec_code;
startsectype:=sec_none;
startsecname:='';
startsecorder:=secorder_default;
while assigned(hp) and
(Tai(hp).typ in [ait_marker,ait_comment,ait_section,ait_cutobject]) do
begin
if Tai(hp).typ=ait_section then
startsectype:=Tai_section(hp).sectype;
begin
startsectype:=Tai_section(hp).sectype;
startsecname:=Tai_section(hp).name^;
startsecorder:=Tai_section(hp).secorder;
end;
if (Tai(hp).typ=ait_cutobject) then
place:=Tai_cutobject(hp).place;
hp:=Tai(hp.next);