mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-02 10:10:20 +02:00
Add several increfs to avoid troubles on AIX target OS
This commit is contained in:
parent
8499fb34b2
commit
dbbf7e7f3b
@ -185,7 +185,10 @@ Unit rappcgas;
|
|||||||
{ replace global symbol reference with TOC entry name
|
{ replace global symbol reference with TOC entry name
|
||||||
for AIX }
|
for AIX }
|
||||||
if target_info.system in systems_aix then
|
if target_info.system in systems_aix then
|
||||||
|
begin
|
||||||
|
opr.ref.symbol.increfs;
|
||||||
tcgppcgen(cg).get_aix_toc_sym(nil,oper.opr.ref.symbol.name,asmsym2indsymflags(oper.opr.ref.symbol),oper.opr.ref,true);
|
tcgppcgen(cg).get_aix_toc_sym(nil,oper.opr.ref.symbol.name,asmsym2indsymflags(oper.opr.ref.symbol),oper.opr.ref,true);
|
||||||
|
end;
|
||||||
oper.opr.ref.refaddr:=addr_pic_no_got;
|
oper.opr.ref.refaddr:=addr_pic_no_got;
|
||||||
end;
|
end;
|
||||||
Consume_RParen;
|
Consume_RParen;
|
||||||
|
@ -198,7 +198,10 @@ begin
|
|||||||
{ replace global symbol reference with TOC entry name
|
{ replace global symbol reference with TOC entry name
|
||||||
for AIX }
|
for AIX }
|
||||||
if target_info.system in systems_aix then
|
if target_info.system in systems_aix then
|
||||||
|
begin
|
||||||
|
oper.opr.ref.symbol.increfs;
|
||||||
tcgppcgen(cg).get_aix_toc_sym(nil,oper.opr.ref.symbol.name,asmsym2indsymflags(oper.opr.ref.symbol),oper.opr.ref,true);
|
tcgppcgen(cg).get_aix_toc_sym(nil,oper.opr.ref.symbol.name,asmsym2indsymflags(oper.opr.ref.symbol),oper.opr.ref,true);
|
||||||
|
end;
|
||||||
oper.opr.ref.refaddr:=addr_pic_no_got;
|
oper.opr.ref.refaddr:=addr_pic_no_got;
|
||||||
end;
|
end;
|
||||||
Consume_RParen;
|
Consume_RParen;
|
||||||
|
@ -813,17 +813,19 @@ unit cgppc;
|
|||||||
TPPCAsmData(current_asmdata).DirectTOCEntries:=TPPCAsmData(current_asmdata).DirectTOCEntries+1;
|
TPPCAsmData(current_asmdata).DirectTOCEntries:=TPPCAsmData(current_asmdata).DirectTOCEntries+1;
|
||||||
new_section(current_asmdata.AsmLists[al_picdata],sec_toc,'',sizeof(pint));
|
new_section(current_asmdata.AsmLists[al_picdata],sec_toc,'',sizeof(pint));
|
||||||
ref.symbol:=current_asmdata.DefineAsmSymbol(nlsymname,AB_LOCAL,AT_DATA,voidpointertype);
|
ref.symbol:=current_asmdata.DefineAsmSymbol(nlsymname,AB_LOCAL,AT_DATA,voidpointertype);
|
||||||
|
ref.symbol.increfs;
|
||||||
current_asmdata.asmlists[al_picdata].concat(tai_symbol.create(ref.symbol,0));
|
current_asmdata.asmlists[al_picdata].concat(tai_symbol.create(ref.symbol,0));
|
||||||
{ do not assign the result of these statements to ref.symbol: the
|
{ do not assign the result of these statements to ref.symbol: the
|
||||||
access must be done via the LC..symname symbol; these are just
|
access must be done via the LC..symname symbol; these are just
|
||||||
to define the symbol that's being accessed as either weak or
|
to define the symbol that's being accessed as either weak or
|
||||||
not }
|
not }
|
||||||
if not(is_weak in flags) then
|
if not(is_weak in flags) then
|
||||||
current_asmdata.RefAsmSymbol(symname,AT_DATA)
|
sym:=current_asmdata.RefAsmSymbol(symname,AT_DATA)
|
||||||
else if is_data in flags then
|
else if is_data in flags then
|
||||||
current_asmdata.WeakRefAsmSymbol(symname,AT_DATA)
|
sym:=current_asmdata.WeakRefAsmSymbol(symname,AT_DATA)
|
||||||
else
|
else
|
||||||
current_asmdata.WeakRefAsmSymbol('.'+symname,AT_DATA);
|
sym:=current_asmdata.WeakRefAsmSymbol('.'+symname,AT_DATA);
|
||||||
|
sym.increfs;
|
||||||
newsymname:=ApplyAsmSymbolRestrictions(symname);
|
newsymname:=ApplyAsmSymbolRestrictions(symname);
|
||||||
current_asmdata.asmlists[al_picdata].concat(tai_directive.Create(asd_toc_entry,newsymname+'[TC],'+newsymname));
|
current_asmdata.asmlists[al_picdata].concat(tai_directive.Create(asd_toc_entry,newsymname+'[TC],'+newsymname));
|
||||||
end;
|
end;
|
||||||
@ -840,11 +842,13 @@ unit cgppc;
|
|||||||
table of addresses }
|
table of addresses }
|
||||||
get_aix_toc_sym(list,'tocsubtable'+tostr(tocnr),[is_data],tmpref,true);
|
get_aix_toc_sym(list,'tocsubtable'+tostr(tocnr),[is_data],tmpref,true);
|
||||||
sym:=tmpref.symbol;
|
sym:=tmpref.symbol;
|
||||||
|
sym.increfs;
|
||||||
{ base address for this batch of toc table entries that we'll
|
{ base address for this batch of toc table entries that we'll
|
||||||
put in a data block instead }
|
put in a data block instead }
|
||||||
new_section(current_asmdata.AsmLists[al_indirectpicdata],sec_rodata,'',sizeof(pint));
|
new_section(current_asmdata.AsmLists[al_indirectpicdata],sec_rodata,'',sizeof(pint));
|
||||||
sym:=current_asmdata.DefineAsmSymbol('tocsubtable'+tostr(tocnr),AB_LOCAL,AT_DATA,voidpointertype);
|
sym:=current_asmdata.DefineAsmSymbol('tocsubtable'+tostr(tocnr),AB_LOCAL,AT_DATA,voidpointertype);
|
||||||
current_asmdata.asmlists[al_indirectpicdata].concat(tai_symbol.create(sym,0));
|
current_asmdata.asmlists[al_indirectpicdata].concat(tai_symbol.create(sym,0));
|
||||||
|
sym.increfs;
|
||||||
end;
|
end;
|
||||||
{ add the reference to the actual symbol inside the tocsubtable }
|
{ add the reference to the actual symbol inside the tocsubtable }
|
||||||
if not(is_weak in flags) then
|
if not(is_weak in flags) then
|
||||||
@ -855,10 +859,12 @@ unit cgppc;
|
|||||||
current_asmdata.WeakRefAsmSymbol('.'+symname,AT_DATA);
|
current_asmdata.WeakRefAsmSymbol('.'+symname,AT_DATA);
|
||||||
tocsym:=TTOCAsmSymbol(current_asmdata.DefineAsmSymbolByClass(TTOCAsmSymbol,nlsymname,AB_LOCAL,AT_DATA,voidpointertype));
|
tocsym:=TTOCAsmSymbol(current_asmdata.DefineAsmSymbolByClass(TTOCAsmSymbol,nlsymname,AB_LOCAL,AT_DATA,voidpointertype));
|
||||||
ref.symbol:=tocsym;
|
ref.symbol:=tocsym;
|
||||||
|
tocsym.increfs;
|
||||||
tocsym.ftocsecnr:=tocnr;
|
tocsym.ftocsecnr:=tocnr;
|
||||||
current_asmdata.asmlists[al_indirectpicdata].concat(tai_symbol.create(tocsym,0));
|
current_asmdata.asmlists[al_indirectpicdata].concat(tai_symbol.create(tocsym,0));
|
||||||
newsymname:=ApplyAsmSymbolRestrictions(symname);
|
newsymname:=ApplyAsmSymbolRestrictions(symname);
|
||||||
sym:=current_asmdata.RefAsmSymbol(newsymname,AT_DATA);
|
sym:=current_asmdata.RefAsmSymbol(newsymname,AT_DATA);
|
||||||
|
sym.increfs;
|
||||||
current_asmdata.asmlists[al_indirectpicdata].concat(tai_const.Create_sym(sym));
|
current_asmdata.asmlists[al_indirectpicdata].concat(tai_const.Create_sym(sym));
|
||||||
end;
|
end;
|
||||||
{ first load the address of the table from the TOC }
|
{ first load the address of the table from the TOC }
|
||||||
|
Loading…
Reference in New Issue
Block a user