From 481b3d99a97cb9be870cc35cc6d946867fd99e52 Mon Sep 17 00:00:00 2001 From: Jonas Maebe <jonas@freepascal.org> Date: Wed, 11 Apr 2012 18:00:43 +0000 Subject: [PATCH] * just like Darwin and Classic Mac OS, AIX uses the system crt* files and hence contains a dummy "main" that refers to the system unit FPC_SYSTEMMAIN, which in turn jumps to the main program's PASCALMAIN * we call FPC_SYSTEMMAIN instead of jumping to it like on Darwin, so that the TOC gets set correctly git-svn-id: trunk@20792 - --- compiler/ncgutil.pas | 7 +++++-- compiler/pmodules.pas | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/compiler/ncgutil.pas b/compiler/ncgutil.pas index 9873062be0..a590fb07f4 100644 --- a/compiler/ncgutil.pas +++ b/compiler/ncgutil.pas @@ -2373,14 +2373,17 @@ implementation if (current_procinfo.procdef.proctypeoption=potype_proginit) then begin - if (target_info.system in (systems_darwin+[system_powerpc_macos])) and + if (target_info.system in (systems_darwin+[system_powerpc_macos]+systems_aix)) and not(current_module.islibrary) then begin new_section(list,sec_code,'',4); list.concat(tai_symbol.createname_global( target_info.cprefix+mainaliasname,AT_FUNCTION,0)); { keep argc, argv and envp properly on the stack } - cg.a_jmp_name(list,target_info.cprefix+'FPC_SYSTEMMAIN'); + if not(target_info.system in systems_aix) then + cg.a_jmp_name(list,target_info.cprefix+'FPC_SYSTEMMAIN') + else + cg.a_call_name(list,target_info.cprefix+'FPC_SYSTEMMAIN',false) end; end; end; diff --git a/compiler/pmodules.pas b/compiler/pmodules.pas index 18459915ea..cf6ddc9988 100644 --- a/compiler/pmodules.pas +++ b/compiler/pmodules.pas @@ -2261,12 +2261,12 @@ implementation begin main_procinfo:=create_main_proc(make_mangledname('',current_module.localsymtable,mainaliasname),potype_proginit,current_module.localsymtable); { Win32 startup code needs a single name } - if not(target_info.system in systems_darwin) then + if not(target_info.system in (systems_darwin+systems_aix)) then main_procinfo.procdef.aliasnames.insert('PASCALMAIN') else main_procinfo.procdef.aliasnames.insert(target_info.Cprefix+'PASCALMAIN') end - else if (target_info.system in ([system_i386_netware,system_i386_netwlibc,system_powerpc_macos]+systems_darwin)) then + else if (target_info.system in ([system_i386_netware,system_i386_netwlibc,system_powerpc_macos]+systems_darwin+systems_aix)) then begin main_procinfo:=create_main_proc('PASCALMAIN',potype_proginit,current_module.localsymtable); end