* static linking fixes

This commit is contained in:
Károly Balogh 2005-04-25 15:58:59 +00:00
parent 3c6d74c4d9
commit f57803d67a

View File

@ -137,45 +137,60 @@ begin
{ Write staticlibraries } { Write staticlibraries }
if not StaticLibFiles.Empty then if not StaticLibFiles.Empty then
begin begin
{ vlink doesn't need, and doesn't support GROUP } { vlink doesn't need, and doesn't support GROUP }
if (cs_link_on_target in aktglobalswitches) then begin if (cs_link_on_target in aktglobalswitches) then
begin
LinkRes.Add(')'); LinkRes.Add(')');
LinkRes.Add('GROUP('); LinkRes.Add('GROUP(');
end; end;
while not StaticLibFiles.Empty do while not StaticLibFiles.Empty do
begin begin
S:=StaticLibFiles.GetFirst; S:=StaticLibFiles.GetFirst;
LinkRes.AddFileName(maybequoted(s)); LinkRes.AddFileName(maybequoted(s));
end; end;
end; end;
LinkRes.Add(')');
if (cs_link_on_target in aktglobalswitches) then
begin
LinkRes.Add(')');
{ Write sharedlibraries like -l<lib>, also add the needed dynamic linker { Write sharedlibraries like -l<lib>, also add the needed dynamic linker
here to be sure that it gets linked this is needed for glibc2 systems (PFV) } here to be sure that it gets linked this is needed for glibc2 systems (PFV) }
linklibc:=false; linklibc:=false;
while not SharedLibFiles.Empty do while not SharedLibFiles.Empty do
begin
S:=SharedLibFiles.GetFirst;
if s<>'c' then
begin begin
i:=Pos(target_info.sharedlibext,S); S:=SharedLibFiles.GetFirst;
if i>0 then if s<>'c' then
Delete(S,i,255); begin
LinkRes.Add('-l'+s); i:=Pos(target_info.sharedlibext,S);
end if i>0 then
else Delete(S,i,255);
begin LinkRes.Add('-l'+s);
LinkRes.Add('-l'+s); end
linklibc:=true; else
begin
LinkRes.Add('-l'+s);
linklibc:=true;
end;
end; end;
end; { be sure that libc&libgcc is the last lib }
{ be sure that libc&libgcc is the last lib } if linklibc then
if linklibc then begin
LinkRes.Add('-lc');
LinkRes.Add('-lgcc');
end;
end
else
begin begin
LinkRes.Add('-lc'); while not SharedLibFiles.Empty do
LinkRes.Add('-lgcc'); begin
S:=SharedLibFiles.GetFirst;
LinkRes.Add('lib'+s+target_info.staticlibext);
end;
LinkRes.Add(')');
end; end;
{ Write and Close response } { Write and Close response }
linkres.writetodisk; linkres.writetodisk;
linkres.free; linkres.free;
@ -255,7 +270,10 @@ initialization
end. end.
{ {
$Log$ $Log$
Revision 1.13 2005-02-14 17:13:10 peter Revision 1.14 2005-04-25 15:58:59 karoly
* static linking fixes
Revision 1.13 2005/02/14 17:13:10 peter
* truncate log * truncate log
Revision 1.12 2005/02/11 07:23:22 karoly Revision 1.12 2005/02/11 07:23:22 karoly