diff options
author | peter <peter@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2006-04-01 22:47:50 +0000 |
---|---|---|
committer | peter <peter@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2006-04-01 22:47:50 +0000 |
commit | 1c8e158f943cccf4a81acaceb7695d2ae3535062 (patch) | |
tree | b3cc33aa3d563c854ac3a724a6ea7cbef2c0e738 | |
parent | c4e6dc39e43ab2ec5c846c17c7f9b645c5c9103d (diff) | |
download | fpc-linker.tar.gz |
* remove debug writelnslinker
* enable vtable optimizer with -Xv
git-svn-id: http://svn.freepascal.org/svn/fpc/branches/linker@3114 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r-- | compiler/globals.pas | 2 | ||||
-rw-r--r-- | compiler/globtype.pas | 3 | ||||
-rw-r--r-- | compiler/ogbase.pas | 65 | ||||
-rw-r--r-- | compiler/options.pas | 7 |
4 files changed, 45 insertions, 32 deletions
diff --git a/compiler/globals.pas b/compiler/globals.pas index cb1abf445b..6e96790d69 100644 --- a/compiler/globals.pas +++ b/compiler/globals.pas @@ -2258,7 +2258,7 @@ end; initmodeswitches:=fpcmodeswitches; initlocalswitches:=[cs_check_io,cs_typed_const_writable]; initmoduleswitches:=[cs_extsyntax,cs_implicit_exceptions]; - initglobalswitches:=[cs_check_unit_name,cs_link_static{$ifdef INTERNALLINKER},cs_link_internal,cs_link_map{$endif}]; + initglobalswitches:=[cs_check_unit_name,cs_link_static{$ifdef INTERNALLINKER},cs_link_internal{$endif}]; initoptimizerswitches:=[]; initsourcecodepage:='8859-1'; initpackenum:=4; diff --git a/compiler/globtype.pas b/compiler/globtype.pas index 639fa2d1f8..092659900e 100644 --- a/compiler/globtype.pas +++ b/compiler/globtype.pas @@ -124,7 +124,8 @@ than 255 characters. That's why using Ansi Strings} cs_asm_regalloc,cs_asm_tempalloc,cs_asm_nodes, { linking } cs_link_extern,cs_link_static,cs_link_smart,cs_link_shared,cs_link_deffile, - cs_link_strip,cs_link_staticflag,cs_link_on_target,cs_link_internal, + cs_link_strip,cs_link_staticflag,cs_link_on_target,cs_link_internal,cs_link_opt_vtable, + cs_link_opt_used_sections, cs_link_map,cs_link_pthread ); tglobalswitches = set of tglobalswitch; diff --git a/compiler/ogbase.pas b/compiler/ogbase.pas index 67c871cb92..614e9f0735 100644 --- a/compiler/ogbase.pas +++ b/compiler/ogbase.pas @@ -1134,7 +1134,6 @@ implementation procedure TExeVTable.AddChild(vt:TExeVTable); begin ChildList.Add(vt); -writeln(ExeSymbol.Name,'-',vt.ExeSymbol.Name); end; @@ -1178,7 +1177,6 @@ writeln(ExeSymbol.Name,'-',vt.ExeSymbol.Name); CheckIdx(VTableIdx); if EntryArray[VTableIdx].Used then exit; -writeln(ExeSymbol.Name,'(',VTableIdx,')'); { Restore relocation if available } if assigned(EntryArray[VTableIdx].ObjRelocation) then begin @@ -1739,19 +1737,22 @@ writeln(ExeSymbol.Name,'(',VTableIdx,')'); VTENTRY and VTINHERIT symbols } if objsym.bind=AB_LOCAL then begin - hs:=objsym.name; - if (hs[1]='V') then + if cs_link_opt_vtable in aktglobalswitches then begin - if Copy(hs,1,5)='VTREF' then + hs:=objsym.name; + if (hs[1]='V') then begin - if not assigned(objsym.ObjSection.VTRefList) then - objsym.ObjSection.VTRefList:=TFPObjectList.Create(false); - objsym.ObjSection.VTRefList.Add(objsym); - end - else if Copy(hs,1,7)='VTENTRY' then - VTEntryList.Add(objsym) - else if Copy(hs,1,9)='VTINHERIT' then - VTInheritList.Add(objsym); + if Copy(hs,1,5)='VTREF' then + begin + if not assigned(objsym.ObjSection.VTRefList) then + objsym.ObjSection.VTRefList:=TFPObjectList.Create(false); + objsym.ObjSection.VTRefList.Add(objsym); + end + else if Copy(hs,1,7)='VTENTRY' then + VTEntryList.Add(objsym) + else if Copy(hs,1,9)='VTINHERIT' then + VTInheritList.Add(objsym); + end; end; continue; end; @@ -1836,7 +1837,8 @@ writeln(ExeSymbol.Name,'(',VTableIdx,')'); Comment(V_Error,'Entrypoint '+EntryName+' not defined'); { Generate VTable tree } - BuildVTableTree(VTInheritList,VTEntryList); + if cs_link_opt_vtable in aktglobalswitches then + BuildVTableTree(VTInheritList,VTEntryList); VTInheritList.Free; VTEntryList.Free; end; @@ -2068,23 +2070,26 @@ writeln(ExeSymbol.Name,'(',VTableIdx,')'); DoReloc(TObjRelocation(objsec.ObjRelocations[i])); { Process Virtual Entry calls } - for i:=0 to objsec.VTRefList.count-1 do + if cs_link_opt_vtable in aktglobalswitches then begin - objsym:=TObjSymbol(objsec.VTRefList[i]); - hs:=objsym.name; - Delete(hs,1,Pos('_',hs)); - k:=Pos('$$',hs); - if k=0 then - internalerror(200603314); - vtableexesym:=texesymbol(FExeSymbolDict.search(Copy(hs,1,k-1))); - val(Copy(hs,k+2,length(hs)-k-1),vtableidx,code); - if (code<>0) then - internalerror(200603317); - if not assigned(vtableexesym) then - internalerror(200603315); - if not assigned(vtableexesym.vtable) then - internalerror(200603316); - DoVTableRef(vtableexesym.vtable,vtableidx); + for i:=0 to objsec.VTRefList.count-1 do + begin + objsym:=TObjSymbol(objsec.VTRefList[i]); + hs:=objsym.name; + Delete(hs,1,Pos('_',hs)); + k:=Pos('$$',hs); + if k=0 then + internalerror(200603314); + vtableexesym:=texesymbol(FExeSymbolDict.search(Copy(hs,1,k-1))); + val(Copy(hs,k+2,length(hs)-k-1),vtableidx,code); + if (code<>0) then + internalerror(200603317); + if not assigned(vtableexesym) then + internalerror(200603315); + if not assigned(vtableexesym.vtable) then + internalerror(200603316); + DoVTableRef(vtableexesym.vtable,vtableidx); + end; end; end; ObjSectionWorkList.Free; diff --git a/compiler/options.pas b/compiler/options.pas index 844d8e9485..99bfdedb62 100644 --- a/compiler/options.pas +++ b/compiler/options.pas @@ -1251,6 +1251,13 @@ begin 'c' : Cshared:=TRUE; 't' : include(initglobalswitches,cs_link_staticflag); + 'v' : + begin + If UnsetBool(More, j) then + exclude(initglobalswitches,cs_link_opt_vtable) + else + include(initglobalswitches,cs_link_opt_vtable); + end; 'D' : begin def_system_macro('FPC_LINK_DYNAMIC'); |