diff --git a/compiler/ogbase.pas b/compiler/ogbase.pas index b40ff850a0..878a14f705 100644 --- a/compiler/ogbase.pas +++ b/compiler/ogbase.pas @@ -1085,17 +1085,29 @@ implementation function TObjData.symbolref(asmsym:TAsmSymbol):TObjSymbol; + var + s:string; begin if assigned(asmsym) then begin if not assigned(asmsym.cachedObjSymbol) then begin - result:=symbolref(asmsym.name); + s:=asmsym.name; + result:=TObjSymbol(FObjSymbolList.Find(s)); + if result=nil then + begin + result:=TObjSymbol.Create(FObjSymbolList,s); + if asmsym.bind=AB_WEAK_EXTERNAL then + result.bind:=AB_WEAK_EXTERNAL; + end; asmsym.cachedObjSymbol:=result; FCachedAsmSymbolList.add(asmsym); end else result:=TObjSymbol(asmsym.cachedObjSymbol); + { The weak bit could have been removed from asmsym. } + if (asmsym.bind=AB_EXTERNAL) and (result.bind=AB_WEAK_EXTERNAL) then + result.bind:=AB_EXTERNAL; end else result:=nil; diff --git a/compiler/systems.pas b/compiler/systems.pas index f6b49d5491..97cbd678a1 100644 --- a/compiler/systems.pas +++ b/compiler/systems.pas @@ -297,7 +297,7 @@ interface system_ia64_win64]+systems_linux; { all systems for which weak linking has been tested/is supported } - systems_weak_linking = systems_darwin + systems_solaris; + systems_weak_linking = systems_darwin + systems_solaris + systems_linux; systems_internal_sysinit = [system_i386_linux,system_i386_win32];