diff options
author | svenbarth <svenbarth@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2016-06-11 20:29:51 +0000 |
---|---|---|
committer | svenbarth <svenbarth@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2016-06-11 20:29:51 +0000 |
commit | 39a41cd20bf437a4f4a4046e58fe6a2996adeb9a (patch) | |
tree | ff796062316e00d211403c09b12df78d0e20ce0e /rtl/bsd | |
parent | 3f7afd700b5154fb7afb017e16694275b1fd430b (diff) | |
download | fpc-39a41cd20bf437a4f4a4046e58fe6a2996adeb9a.tar.gz |
Merged revision(s) 31929-31931,32547 from branches/svenbarth/packages:
Switch Mac OS X to indirect entry information.
compiler/systems/t_bsd.pas, TLinkerBSD:
+ implement InitSysInitUnitName
compiler/system.pas:
* systems_internal_sysinit: add Darwin systems
compiler/hlcgobj.pas, thlcgobj:
* gen_proc_symbol_end: for Darwin systems don't directly call PascalMain for libraries, but FPC_LIBMAIN instead
rtl/darwin:
+ add sysinit.pas unit which contains the executable and library entry points for Darwin
rtl/darwin/Makefile.fpc:
* add sysinit unit
rtl/bsd/sysosh.inc:
+ add a Darwin specific TPlatformEntryInformation (could probably be used for all Unix systems...)
rtl/bsd/system.pp:
* define FPC_HAS_INDIRECT_MAIN_INFORMATION for Darwin systems once we're no longer bootstrapping with 2.6.x
+ add EntryInformation variable (this could maybe moved to system.inc...)
+ add new procedure SysEntry that is called from the entrypoint and which sets up necessary information required by other parts of the RTL
* the old FPC_SYSTEMMAIN is still in place for bootstrapping
rtl/inc/systemh.inc, TEntryInformation:
* PascalMain is cdecl on non-Windows systems (ToDo: really?)
rtl/inc/system.inc:
* initialstklen is provided by the indirect entry information, so no external here
........
Fix bootstrapping.
rtl/darwin/sysinit.pas:
* enable the code only when no longer bootstrapping with 2.6.x
........
Fix bootstrapping.
rtl/objpas/objpas.pp:
* define FPC_HAS_INDIRECT_MAIN_INFORMATION for Darwin only while not bootstrapping with 2.6.x
........
rtl/darwin/sysinit.pas:
* reference PASCALMAIN correctly (I wonder how this even worked previously :/ )
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@33949 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'rtl/bsd')
-rw-r--r-- | rtl/bsd/sysosh.inc | 10 | ||||
-rw-r--r-- | rtl/bsd/system.pp | 30 |
2 files changed, 39 insertions, 1 deletions
diff --git a/rtl/bsd/sysosh.inc b/rtl/bsd/sysosh.inc index d4442596d7..62585a26e0 100644 --- a/rtl/bsd/sysosh.inc +++ b/rtl/bsd/sysosh.inc @@ -26,6 +26,16 @@ type PRTLCriticalSection = ^TRTLCriticalSection; TRTLCriticalSection = {$i pmutext.inc} +{$ifdef darwin} +{$define HAS_ENTRYINFORMATION_OS} + TEntryInformationOS = record + argc: longint; + argv: ppchar; + envp: ppchar; + stklen: sizeuint; + end; +{$endif} + {$if defined(darwin) and defined(powerpc)} { for profiling support } procedure mcount(p: pointer); compilerproc; cdecl; external; diff --git a/rtl/bsd/system.pp b/rtl/bsd/system.pp index 35c4e23fbb..640e33a01a 100644 --- a/rtl/bsd/system.pp +++ b/rtl/bsd/system.pp @@ -32,7 +32,6 @@ Interface {$define FPC_USE_SYSCALL} {$endif} - {$define FPC_IS_SYSTEM} {$I sysunixh.inc} @@ -77,8 +76,23 @@ Implementation {$endif defined(CPUARM) or defined(CPUM68K)} +{$ifdef FPC_HAS_INDIRECT_MAIN_INFORMATION} +{$define FPC_SYSTEM_HAS_OSSETUPENTRYINFORMATION} +procedure OsSetupEntryInformation(const info: TEntryInformation); forward; +{$endif FPC_HAS_INDIRECT_MAIN_INFORMATION} + {$I system.inc} +{$ifdef FPC_HAS_INDIRECT_MAIN_INFORMATION} +procedure OsSetupEntryInformation(const info: TEntryInformation); +begin + argc := info.OS.argc; + argv := info.OS.argv; + envp := info.OS.envp; + initialstklen := info.OS.stklen; +end; +{$endif FPC_HAS_INDIRECT_MAIN_INFORMATION} + {$ifdef FPC_HAS_SETSYSNR_INC} {$I setsysnr.inc} {$endif FPC_HAS_SETSYSNR_INC} @@ -296,6 +310,19 @@ end; {$ifdef Darwin} +{$ifdef FPC_HAS_INDIRECT_MAIN_INFORMATION} + +procedure SysEntry(constref info: TEntryInformation);[public,alias:'FPC_SysEntry']; +begin + SetupEntryInformation(info); +{$ifdef cpui386} + Set8087CW(Default8087CW); +{$endif cpui386} + info.PascalMain(); +end; + +{$else FPC_HAS_INDIRECT_MAIN_INFORMATION} + procedure pascalmain;external name '_PASCALMAIN'; procedure FPC_SYSTEMMAIN(argcparam: Longint; argvparam: ppchar; envpparam: ppchar); cdecl; [public]; @@ -309,6 +336,7 @@ begin {$endif cpui386} pascalmain; {run the pascal main program} end; +{$endif FPC_HAS_INDIRECT_MAIN_INFORMATION} {$endif Darwin} {$endif FPC_USE_LIBC} |