* also recognise non-GOT based RIP-relative address expressions as PIC

git-svn-id: trunk@16565 -
This commit is contained in:
Jonas Maebe 2010-12-15 13:39:27 +00:00
parent b09ce75896
commit 709f1e8344
2 changed files with 7 additions and 1 deletions

View File

@ -230,7 +230,7 @@ begin
if (cs_create_pic in current_settings.moduleswitches) and
assigned(opr.ref.symbol) and
not assigned(opr.ref.relsymbol) and
(opr.ref.refaddr<>addr_pic) then
not(opr.ref.refaddr in [addr_pic,addr_pic_no_got]) then
begin
if (opr.ref.symbol.name <> '_GLOBAL_OFFSET_TABLE_') then
begin

View File

@ -176,6 +176,12 @@ Implementation
((oper.opr.typ=OPR_LOCAL) and (oper.opr.localsym.localloc.loc<>LOC_REGISTER)) then
message(asmr_e_cannot_index_relative_var);
oper.opr.ref.base:=actasmregister;
{$ifdef x86_64}
{ non-GOT based RIP-relative accesses are also position-independent }
if (oper.opr.ref.base=NR_RIP) and
(oper.opr.ref.refaddr<>addr_pic) then
oper.opr.ref.refaddr:=addr_pic_no_got;
{$endif x86_64}
Consume(AS_REGISTER);
{ can either be a register or a right parenthesis }
{ (reg) }