|
@@ -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 }
|