2
0
Эх сурвалжийг харах

* fix mantis #25129 for non OS X BSD systems. Patch by A. Cardenas Marquez
- crtbegin and crtend suffix handling
- crti before crtbegin

git-svn-id: trunk@25620 -

marco 11 жил өмнө
parent
commit
2a9916baba

+ 15 - 3
compiler/systems/t_bsd.pas

@@ -489,10 +489,19 @@ begin
   if linklibc and
   if linklibc and
      not IsDarwin Then
      not IsDarwin Then
    begin
    begin
-     if librarysearchpath.FindFile('crtbegin.o',false,s) then
-      LinkRes.AddFileName(s);
      if librarysearchpath.FindFile('crti.o',false,s) then
      if librarysearchpath.FindFile('crti.o',false,s) then
       LinkRes.AddFileName(s);
       LinkRes.AddFileName(s);
+     if cs_create_pic in current_settings.moduleswitches then
+       begin
+         if librarysearchpath.FindFile('crtbeginS.o',false,s) then
+           LinkRes.AddFileName(s);
+       end
+       else
+         if (cs_link_staticflag in current_settings.globalswitches) and
+           librarysearchpath.FindFile('crtbeginT.o',false,s) then
+             LinkRes.AddFileName(s)
+         else if librarysearchpath.FindFile('crtbegin.o',false,s) then
+             LinkRes.AddFileName(s);
    end;
    end;
   { main objectfiles }
   { main objectfiles }
   while not ObjectFiles.Empty do
   while not ObjectFiles.Empty do
@@ -577,7 +586,10 @@ begin
   if linklibc and
   if linklibc and
      not IsDarwin Then
      not IsDarwin Then
    begin
    begin
-     Fl1:=librarysearchpath.FindFile('crtend.o',false,s1);
+     if cs_create_pic in current_settings.moduleswitches then
+       Fl1:=librarysearchpath.FindFile('crtendS.o',false,s1)
+     else
+       Fl1:=librarysearchpath.FindFile('crtend.o',false,s1);
      Fl2:=librarysearchpath.FindFile('crtn.o',false,s2);
      Fl2:=librarysearchpath.FindFile('crtn.o',false,s2);
      if Fl1 or Fl2 then
      if Fl1 or Fl2 then
       begin
       begin