Pārlūkot izejas kodu

--- Merging r41637 into '.':
U compiler/systems/t_bsd.pas
--- Recording mergeinfo for merge of r41637 into '.':
U .
--- Merging r41638 into '.':
G compiler/systems/t_bsd.pas
--- Recording mergeinfo for merge of r41638 into '.':
G .
--- Merging r41639 into '.':
G compiler/systems/t_bsd.pas
--- Recording mergeinfo for merge of r41639 into '.':
G .
--- Merging r41652 into '.':
G compiler/systems/t_bsd.pas
--- Recording mergeinfo for merge of r41652 into '.':
G .
--- Merging r41668 into '.':
G compiler/systems/t_bsd.pas
--- Recording mergeinfo for merge of r41668 into '.':
G .

# revisions: 41637,41638,41639,41652,41668
r41637 | nickysn | 2019-03-08 16:59:00 +0100 (Fri, 08 Mar 2019) | 2 lines
Changed paths:
M /trunk/compiler/systems/t_bsd.pas

* Correct library search path for OpenBSD. Based on 1/3 of OpenBSD ports patch
patch-fpcsrc_compiler_systems_t_bsd_pas
r41638 | nickysn | 2019-03-08 17:01:30 +0100 (Fri, 08 Mar 2019) | 2 lines
Changed paths:
M /trunk/compiler/systems/t_bsd.pas

* always add -nopie to linker flags on OpenBSD. Based on 2/3 of OpenBSD ports
patch patch-fpcsrc_compiler_systems_t_bsd_pas
r41639 | nickysn | 2019-03-08 17:04:48 +0100 (Fri, 08 Mar 2019) | 2 lines
Changed paths:
M /trunk/compiler/systems/t_bsd.pas

* Do not link to /usr/libexec/ld.so as a shared library on OpenBSD. Based on 3/3
of OpenBSD ports patch patch-fpcsrc_compiler_systems_t_bsd_pas
r41652 | nickysn | 2019-03-09 17:11:52 +0100 (Sat, 09 Mar 2019) | 3 lines
Changed paths:
M /trunk/compiler/systems/t_bsd.pas

* link with -nopie on OpenBSD only if PIC code generation is disabled
r41668 | nickysn | 2019-03-10 16:56:09 +0100 (Sun, 10 Mar 2019) | 5 lines
Changed paths:
M /trunk/compiler/systems/t_bsd.pas

+ pass the -dynamic-linker option to the linker even when making a static binary
on OpenBSD, because that seems to be needed in order to produce a static
position independent executable in the correct format for that platform

git-svn-id: branches/fixes_3_2@41901 -

marco 6 gadi atpakaļ
vecāks
revīzija
4fd1f5ebe7
1 mainītis faili ar 12 papildinājumiem un 7 dzēšanām
  1. 12 7
      compiler/systems/t_bsd.pas

+ 12 - 7
compiler/systems/t_bsd.pas

@@ -126,11 +126,13 @@ Constructor TLinkerBSD.Create;
 begin
   Inherited Create;
   if not Dontlinkstdlibpath Then
-   if not(target_info.system in systems_darwin) then
-     LibrarySearchPath.AddPath(sysrootpath,'/lib;/usr/lib;/usr/X11R6/lib',true)
-   else
+   if target_info.system in systems_darwin then
      { Mac OS X doesn't have a /lib }
      LibrarySearchPath.AddPath(sysrootpath,'/usr/lib',true)
+   else if target_info.system in systems_openbsd then
+     LibrarySearchPath.AddPath(sysrootpath,'/usr/lib;${X11BASE}/lib;${LOCALBASE}/lib',true)
+   else
+     LibrarySearchPath.AddPath(sysrootpath,'/lib;/usr/lib;/usr/X11R6/lib',true);
 end;
 
 
@@ -682,7 +684,8 @@ begin
      { when we have -static for the linker the we also need libgcc }
      if (cs_link_staticflag in current_settings.globalswitches) then
       LinkRes.Add('-lgcc');
-     if linkdynamic and (Info.DynamicLinker<>'') then
+     if linkdynamic and (Info.DynamicLinker<>'') and
+        not(target_info.system in systems_openbsd) then
       LinkRes.AddFileName(Info.DynamicLinker);
      if not LdSupportsNoResponseFile then
        LinkRes.Add(')');
@@ -786,7 +789,9 @@ begin
 
    if(not(target_info.system in systems_darwin) and
       (cs_profile in current_settings.moduleswitches)) or
-     ((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then
+     ((Info.DynamicLinker<>'') and
+      ((not SharedLibFiles.Empty) or
+       (target_info.system in systems_openbsd))) then
    DynLinkStr:='-dynamic-linker='+Info.DynamicLinker;
 
   if CShared Then
@@ -797,9 +802,9 @@ begin
      DynLinKStr:=DynLinkStr+' -dynamic'; // one dash!
    end;
 
-{ Use -nopie on OpenBSD }
+{ Use -nopie on OpenBSD if PIC support is turned off }
   if (target_info.system in systems_openbsd) and
-     (target_info.system <> system_x86_64_openbsd) then
+     not(cs_create_pic in current_settings.moduleswitches) then
     Info.ExtraOptions:=Info.ExtraOptions+' -nopie';
 
 { -N seems to be needed on NetBSD/earm }