diff options
Diffstat (limited to 'compiler/ngenutil.pas')
-rw-r--r-- | compiler/ngenutil.pas | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/compiler/ngenutil.pas b/compiler/ngenutil.pas index 1811029fb1..6b5a4169fd 100644 --- a/compiler/ngenutil.pas +++ b/compiler/ngenutil.pas @@ -605,9 +605,14 @@ implementation StructList: TFPList absolute arg; begin if (tdef(p).typ in [objectdef,recorddef]) and - not (df_generic in tdef(p).defoptions) and - ([oo_has_class_constructor,oo_has_class_destructor] * tabstractrecorddef(p).objectoptions <> []) then - StructList.Add(p); + not (df_generic in tdef(p).defoptions) then + begin + { first add the class... } + if ([oo_has_class_constructor,oo_has_class_destructor] * tabstractrecorddef(p).objectoptions <> []) then + StructList.Add(p); + { ... and then also add all subclasses } + tabstractrecorddef(p).symtable.deflist.foreachcall(@AddToStructInits,arg); + end; end; @@ -908,7 +913,7 @@ implementation begin if (target_res.id in [res_elf,res_macho,res_xcoff]) then begin - ResourceInfo:=TAsmList.Create; + ResourceInfo:=current_asmdata.asmlists[al_globals]; maybe_new_object_file(ResourceInfo); new_section(ResourceInfo,sec_data,'FPC_RESLOCATION',sizeof(aint)); @@ -923,9 +928,6 @@ implementation {$ELSE} ResourceInfo.Concat(Tai_const.Create_64bit(0)); {$ENDIF} - maybe_new_object_file(current_asmdata.asmlists[al_globals]); - current_asmdata.asmlists[al_globals].concatlist(ResourceInfo); - ResourceInfo.free; end; end; |