patch-fpcsrc_compiler_systems_t_bsd_pas 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. $OpenBSD: patch-fpcsrc_compiler_systems_t_bsd_pas,v 1.4 2017/02/04 15:23:04 pascal Exp $
  2. Correct library search path for OpenBSD; always add -nopie to linker flags.
  3. Do not link to /usr/libexec/ld.so as a shared library.
  4. --- fpcsrc/compiler/systems/t_bsd.pas.orig Sun Dec 7 21:27:02 2014
  5. +++ fpcsrc/compiler/systems/t_bsd.pas Sat Feb 4 09:51:46 2017
  6. @@ -126,7 +126,10 @@ begin
  7. Inherited Create;
  8. if not Dontlinkstdlibpath Then
  9. if not(target_info.system in systems_darwin) then
  10. - LibrarySearchPath.AddPath(sysrootpath,'/lib;/usr/lib;/usr/X11R6/lib',true)
  11. + if not(target_info.system in systems_openbsd) then
  12. + LibrarySearchPath.AddPath(sysrootpath,'/lib;/usr/lib;/usr/X11R6/lib',true)
  13. + else
  14. + LibrarySearchPath.AddPath(sysrootpath,'/usr/lib;${X11BASE}/lib;${LOCALBASE}/lib',true)
  15. else
  16. { Mac OS X doesn't have a /lib }
  17. LibrarySearchPath.AddPath(sysrootpath,'/usr/lib',true)
  18. @@ -581,7 +584,8 @@ begin
  19. { when we have -static for the linker the we also need libgcc }
  20. if (cs_link_staticflag in current_settings.globalswitches) then
  21. LinkRes.Add('-lgcc');
  22. - if linkdynamic and (Info.DynamicLinker<>'') then
  23. + if linkdynamic and (Info.DynamicLinker<>'') and
  24. + not(target_info.system in systems_openbsd) then
  25. LinkRes.AddFileName(Info.DynamicLinker);
  26. if not LdSupportsNoResponseFile then
  27. LinkRes.Add(')');
  28. @@ -697,8 +701,7 @@ begin
  29. end;
  30. { Use -nopie on OpenBSD }
  31. - if (target_info.system in systems_openbsd) and
  32. - (target_info.system <> system_x86_64_openbsd) then
  33. + if (target_info.system in systems_openbsd) then
  34. Info.ExtraOptions:=Info.ExtraOptions+' -nopie';
  35. { Write used files and libraries }