mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-03 01:09:40 +01:00
* finalization sections in shared libraries under Darwin are now run
* cleaned up the way the initialisation sections of shared libraries
under Darwin are run
git-svn-id: trunk@2470 -
This commit is contained in:
parent
0dc6d51c08
commit
2435a7a93c
@ -306,7 +306,7 @@ interface
|
||||
end;
|
||||
|
||||
tasmdirective=(asd_non_lazy_symbol_pointer,asd_indirect_symbol,asd_lazy_symbol_pointer,
|
||||
asd_extern,asd_nasm_import, asd_toc_entry);
|
||||
asd_extern,asd_nasm_import, asd_toc_entry, asd_mod_init_func, asd_mod_term_func);
|
||||
|
||||
tai_directive = class(tailineinfo)
|
||||
name : pstring;
|
||||
@ -664,9 +664,9 @@ interface
|
||||
regallocstr : array[tregalloctype] of string[10]=('allocated','released','sync','resized');
|
||||
tempallocstr : array[boolean] of string[10]=('released','allocated');
|
||||
stabtypestr : array[tstabtype] of string[5]=('stabs','stabn','stabd');
|
||||
directivestr : array[tasmdirective] of string[24]=(
|
||||
directivestr : array[tasmdirective] of string[23]=(
|
||||
'non_lazy_symbol_pointer','indirect_symbol','lazy_symbol_pointer',
|
||||
'extern','nasm_import', 'tc'
|
||||
'extern','nasm_import', 'tc', 'mod_init_func', 'mod_term_func'
|
||||
);
|
||||
|
||||
var
|
||||
|
||||
@ -1787,6 +1787,21 @@ implementation
|
||||
list.concat(Tai_symbol_end.Createname(current_procinfo.procdef.mangledname));
|
||||
|
||||
current_procinfo.procdef.procendtai:=tai(list.last);
|
||||
|
||||
{ finalisation marker for Mac OS X }
|
||||
if (target_info.system in [system_powerpc_darwin,system_i386_darwin]) and
|
||||
(current_module.islibrary) and
|
||||
(((current_module.flags and uf_finalize)<>0) or
|
||||
(current_procinfo.procdef.proctypeoption = potype_proginit)) then
|
||||
begin
|
||||
if (current_procinfo.procdef.proctypeoption = potype_proginit) then
|
||||
list.concat(tai_directive.create(asd_mod_init_func,''))
|
||||
else
|
||||
list.concat(tai_directive.create(asd_mod_term_func,''));
|
||||
list.concat(tai_align.create(4));
|
||||
list.concat(Tai_const.Createname(current_procinfo.procdef.mangledname,AT_FUNCTION,0));
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
|
||||
|
||||
@ -1287,7 +1287,8 @@ implementation
|
||||
begin
|
||||
pd:=create_main_proc(make_mangledname('',current_module.localsymtable,mainaliasname),potype_proginit,current_module.localsymtable);
|
||||
{ Win32 startup code needs a single name }
|
||||
pd.aliasnames.insert('PASCALMAIN');
|
||||
if not(target_info.system in [system_powerpc_darwin,system_i386_darwin]) then
|
||||
pd.aliasnames.insert('PASCALMAIN');
|
||||
end
|
||||
else if (target_info.system = system_i386_netware) or
|
||||
(target_info.system = system_i386_netwlibc) then
|
||||
|
||||
@ -287,7 +287,7 @@ begin
|
||||
else
|
||||
begin
|
||||
ExeCmd[1]:='ld $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -multiply_defined suppress -L. -o $EXE `cat $RES`';
|
||||
DllCmd[1]:='libtool $OPT -dynamic -init PASCALMAIN -multiply_defined suppress -L. -o $EXE `cat $RES`'
|
||||
DllCmd[1]:='libtool $OPT -dynamic -multiply_defined suppress -L. -o $EXE `cat $RES`'
|
||||
end
|
||||
end
|
||||
else
|
||||
|
||||
Loading…
Reference in New Issue
Block a user