* detect RTOC-based accesses on AIX in inline assembly, and change the

symbol names to those of the associated TOC entries

git-svn-id: trunk@20797 -
This commit is contained in:
Jonas Maebe 2012-04-11 18:01:29 +00:00
parent b738657bf3
commit 71106219f2
2 changed files with 27 additions and 2 deletions

View File

@ -56,7 +56,7 @@ Unit rappcgas;
{ parser }
procinfo,
rabase,rautils,
cgbase,cgobj
cgbase,cgobj,cgppc
;
procedure tppcattreader.ReadSym(oper : tppcoperand);
@ -142,6 +142,7 @@ Unit rappcgas;
l : aint;
relsym: string;
asmsymtyp: tasmsymtype;
isflags: tindsymflags;
begin
Consume(AS_LPAREN);
@ -176,6 +177,18 @@ Unit rappcgas;
{ (reg) }
if actasmtoken=AS_RPAREN then
Begin
{ detect RTOC-based symbol accesses }
if assigned(oper.opr.ref.symbol) and
(oper.opr.ref.base=NR_RTOC) and
(oper.opr.ref.offset=0) then
begin
{ replace global symbol reference with TOC entry name
for AIX }
if target_info.system in systems_aix then
oper.opr.ref.symbol:=
tcgppcgen(cg).get_aix_toc_sym(oper.opr.ref.symbol.name,asmsym2indsymflags(oper.opr.ref.symbol));
oper.opr.ref.refaddr:=addr_pic_no_got;
end;
Consume_RParen;
exit;
end;

View File

@ -56,7 +56,7 @@ uses
{ parser }
procinfo,
rabase, rautils,
cgbase, cgobj
cgbase, cgobj, cgppc
;
procedure tppcattreader.ReadSym(oper: tppcoperand);
@ -188,6 +188,18 @@ begin
{ (reg) }
if actasmtoken = AS_RPAREN then
begin
{ detect RTOC-based symbol accesses }
if assigned(oper.opr.ref.symbol) and
(oper.opr.ref.base=NR_RTOC) and
(oper.opr.ref.offset=0) then
begin
{ replace global symbol reference with TOC entry name
for AIX }
if target_info.system in systems_aix then
oper.opr.ref.symbol:=
tcgppcgen(cg).get_aix_toc_sym(oper.opr.ref.symbol.name,asmsym2indsymflags(oper.opr.ref.symbol));
oper.opr.ref.refaddr:=addr_pic_no_got;
end;
Consume_RParen;
exit;
end;