mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 03:19:47 +01:00 
			
		
		
		
	* also recognise non-GOT based RIP-relative address expressions as PIC
git-svn-id: trunk@16565 -
This commit is contained in:
		
							parent
							
								
									b09ce75896
								
							
						
					
					
						commit
						709f1e8344
					
				@ -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 
 | 
			
		||||
 | 
			
		||||
@ -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)        }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user