فهرست منبع

+ enable weak externals for OpenBSD
* converted the reference to _init in si_dll to be a weak external. This way we
can support creating shared libraries that link to the C library as well as
libraries that do not. If libc was linked, the compiler will link in
crtbeginS.o and crtendS.o; _init is defined in crtbeginS.o and initializes the
C library and calls all the C static constructors.

git-svn-id: trunk@41751 -

nickysn 6 سال پیش
والد
کامیت
52a5669117
2فایلهای تغییر یافته به همراه7 افزوده شده و 2 حذف شده
  1. 1 1
      compiler/systems.pas
  2. 6 1
      rtl/openbsd/x86_64/si_dll.inc

+ 1 - 1
compiler/systems.pas

@@ -346,7 +346,7 @@ interface
        systems_indirect_entry_information = systems_darwin+[system_i386_win32,system_x86_64_win64,system_x86_64_linux];
 
        { all systems for which weak linking has been tested/is supported }
-       systems_weak_linking = systems_darwin + systems_solaris + systems_linux + systems_android;
+       systems_weak_linking = systems_darwin + systems_solaris + systems_linux + systems_android + systems_openbsd;
 
        systems_internal_sysinit = [system_i386_win32,system_x86_64_win64,
                                    system_i386_linux,system_powerpc64_linux,system_sparc64_linux,system_x86_64_linux,

+ 6 - 1
rtl/openbsd/x86_64/si_dll.inc

@@ -16,7 +16,11 @@
 
 {$asmmode gas}
 
+{$ifdef VER3_0}
 procedure _init; external name '_init';
+{$else VER3_0}
+procedure _init; weakexternal name '_init';
+{$endif VER3_0}
 
 procedure _FPC_proc___start(argc: LongInt; argv: PPChar; envp: Pointer; para1, para2, para3: QWord); forward;
 
@@ -61,7 +65,8 @@ procedure _FPC_proc___start(argc: LongInt; argv: PPChar; envp: Pointer; para1, p
         __progname_storage[I]:=#0;
         __progname:=@__progname_storage;
       end;
-    _init;
+    if Assigned(@_init) then
+      _init;
     PascalMain;
     asm
       jmp     _FPC_proc_haltproc@PLT