Explorar o código

* link to crtbegin.o/crtend.o instead of crtbeginS.o/crtendS.o when creating
normal OpenBSD programs (not shared libraries) that link to the C library,
even when PIC code generation has been turned on. This is what gcc and clang
do on this platform.

git-svn-id: trunk@41740 -

nickysn %!s(int64=6) %!d(string=hai) anos
pai
achega
34a8032e11
Modificáronse 2 ficheiros con 10 adicións e 4 borrados
  1. 8 2
      compiler/systems/t_bsd.pas
  2. 2 2
      rtl/openbsd/x86_64/si_c.inc

+ 8 - 2
compiler/systems/t_bsd.pas

@@ -616,7 +616,10 @@ begin
    begin
      if librarysearchpath.FindFile('crti.o',false,s) then
       LinkRes.AddFileName(s);
-     if cs_create_pic in current_settings.moduleswitches then
+     if ((cs_create_pic in current_settings.moduleswitches) and
+         not (target_info.system in systems_openbsd)) or
+        (current_module.islibrary and
+         (target_info.system in systems_openbsd)) then
        begin
          if librarysearchpath.FindFile('crtbeginS.o',false,s) then
            LinkRes.AddFileName(s);
@@ -740,7 +743,10 @@ begin
   if linklibc and
      not IsDarwin Then
    begin
-     if cs_create_pic in current_settings.moduleswitches then
+     if ((cs_create_pic in current_settings.moduleswitches) and
+         not (target_info.system in systems_openbsd)) or
+        (current_module.islibrary and
+         (target_info.system in systems_openbsd)) then
        Fl1:=librarysearchpath.FindFile('crtendS.o',false,s1)
      else
        Fl1:=librarysearchpath.FindFile('crtend.o',false,s1);

+ 2 - 2
rtl/openbsd/x86_64/si_c.inc

@@ -28,7 +28,7 @@ var
 procedure _mcleanup; cdecl; external name '_mcleanup';
 function atexit(proc: TCdeclProcedure): cint; cdecl; external name 'atexit';
 procedure monstartup(lowpc, highpc: u_long); cdecl; external name 'monstartup';
-procedure _init; cdecl; external name '_init';
+procedure __init; cdecl; external name '__init';
 
 procedure _FPC_proc___start(argc: LongInt; argv: PPChar; envp: Pointer; para1, para2, para3: QWord); forward;
 
@@ -75,7 +75,7 @@ procedure _FPC_proc___start(argc: LongInt; argv: PPChar; envp: Pointer; para1, p
       end;
     atexit(@_mcleanup);
     monstartup(u_long(@_eprol),u_long(@_etext));
-    _init;
+    __init;
     PascalMain;
     asm
       jmp     _FPC_proc_haltproc