From eec8129738dbb81cb8853c7fac425b86bfed3d97 Mon Sep 17 00:00:00 2001 From: sergei Date: Sun, 18 Aug 2013 09:14:16 +0000 Subject: [PATCH] * TInternalLinker.Load_ReadStaticLibrary: exit if error has occurred while opening a static library or dynamic object, continuing can cause other errors/crashes in this case. * t_linux.pas: use sysrootpath when specifying dynamic interpreter (for cross-linking). git-svn-id: trunk@25277 - --- compiler/link.pas | 2 ++ compiler/systems/t_linux.pas | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/compiler/link.pas b/compiler/link.pas index 2972a2dcd9..f63b88018e 100644 --- a/compiler/link.pas +++ b/compiler/link.pas @@ -1033,6 +1033,8 @@ Implementation exit; Comment(V_Tried,'Opening library '+para); objreader:=TArObjectreader.create(para,true); + if ErrorCount>0 then + exit; if objreader.isarchive then TFPObjectList(FGroupStack.Last).Add(TStaticLibrary.Create(para,objreader,CObjInput)) else diff --git a/compiler/systems/t_linux.pas b/compiler/systems/t_linux.pas index 3005c5a7fa..f9e924a80f 100644 --- a/compiler/systems/t_linux.pas +++ b/compiler/systems/t_linux.pas @@ -502,8 +502,8 @@ begin end else begin - linklibc:=true; - end; + linklibc:=true; + end; end; Add(')'); end @@ -662,7 +662,7 @@ begin _end. Align after .bss to ensure correct alignment even if the .bss section disappears because there are no input sections.} add(' . = ALIGN(32 / 8);'); - add(' }'); + add('}'); add(' . = ALIGN(32 / 8);'); add(' PROVIDE (_end = .);'); add(' PROVIDE (end = .);'); @@ -1276,7 +1276,7 @@ begin { See tw9089*.pp: if more than one pure-Pascal shared libs are loaded, and none have rtld in their DT_NEEDED, then rtld cannot finalize correctly. } if IsSharedLibrary then - LinkScript.Concat('READSTATICLIBRARY '+maybequoted(dynlinker)); + LinkScript.Concat('READSTATICLIBRARY '+maybequoted(sysrootpath+dynlinker)); linkToSharedLibs:=(not SharedLibFiles.Empty);