Browse Source

* fixed placing of dynamiclinker in link.res (should be the last after
all other libraries)

peter 26 years ago
parent
commit
73151c592c
1 changed files with 13 additions and 4 deletions
  1. 13 4
      compiler/link.pas

+ 13 - 4
compiler/link.pas

@@ -390,6 +390,7 @@ Var
   prtobj       : string[80];
   prtobj       : string[80];
   s,s2         : string;
   s,s2         : string;
   found,linux_link_c,
   found,linux_link_c,
+  linkdynamic,
   linklibc     : boolean;
   linklibc     : boolean;
 
 
   procedure WriteRes(const s:string);
   procedure WriteRes(const s:string);
@@ -412,6 +413,7 @@ begin
   WriteResponseFile:=False;
   WriteResponseFile:=False;
   linux_link_c:=false;
   linux_link_c:=false;
 { set special options for some targets }
 { set special options for some targets }
+  linkdynamic:=not(SharedLibFiles.empty);
   linklibc:=SharedLibFiles.Find('c');
   linklibc:=SharedLibFiles.Find('c');
   prtobj:='prt0';
   prtobj:='prt0';
   cprtobj:='cprt0';
   cprtobj:='cprt0';
@@ -524,8 +526,6 @@ begin
 
 
   { 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) }
-  if (DynamicLinker<>'') and (not SharedLibFiles.Empty) then
-   WriteResFileName(DynamicLinker);
   While not SharedLibFiles.Empty do
   While not SharedLibFiles.Empty do
    begin
    begin
      S:=SharedLibFiles.Get;
      S:=SharedLibFiles.Get;
@@ -537,7 +537,10 @@ begin
         WriteRes(target_link.libprefix+s);
         WriteRes(target_link.libprefix+s);
       end
       end
      else
      else
-      linklibc:=true;
+      begin
+        linklibc:=true;
+        linkdynamic:=false; { C add's it automaticly }
+      end;
    end;
    end;
   { be sure that libc is the last lib }
   { be sure that libc is the last lib }
   { arghhhh  this is wrong for DJGPP !!!
   { arghhhh  this is wrong for DJGPP !!!
@@ -547,6 +550,8 @@ begin
   { add libgcc after ! }
   { add libgcc after ! }
   if linklibc and (target_info.target=target_i386_go32v2) then
   if linklibc and (target_info.target=target_i386_go32v2) then
    WriteRes(target_link.libprefix+'gcc');
    WriteRes(target_link.libprefix+'gcc');
+  if linkdynamic and (DynamicLinker<>'') then
+   WriteResFileName(DynamicLinker);
   WriteRes(target_link.inputend);
   WriteRes(target_link.inputend);
 
 
   { Write staticlibraries }
   { Write staticlibraries }
@@ -728,7 +733,11 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.63  1999-07-29 01:31:39  peter
+  Revision 1.64  1999-07-30 23:19:45  peter
+    * fixed placing of dynamiclinker in link.res (should be the last after
+      all other libraries)
+
+  Revision 1.63  1999/07/29 01:31:39  peter
     * fixed shared library linking for glibc2 systems
     * fixed shared library linking for glibc2 systems
 
 
   Revision 1.62  1999/07/27 11:05:51  peter
   Revision 1.62  1999/07/27 11:05:51  peter