mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-20 06:51:05 +02:00
+ relsym support
* give an error message when using @GOT in darwin/i386 assembler code (have to use a relsym instead) git-svn-id: trunk@9366 -
This commit is contained in:
parent
46e1bec6de
commit
df2980f0c0
@ -38,6 +38,8 @@ Interface
|
|||||||
procedure BuildOperand(oper : tx86operand);
|
procedure BuildOperand(oper : tx86operand);
|
||||||
procedure BuildOpCode(instr : tx86instruction);
|
procedure BuildOpCode(instr : tx86instruction);
|
||||||
procedure handlepercent;override;
|
procedure handlepercent;override;
|
||||||
|
protected
|
||||||
|
procedure MaybeGetPICModifier(var oper: tx86operand);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -259,6 +261,49 @@ Implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Procedure tx86attreader.MaybeGetPICModifier(var oper: tx86operand);
|
||||||
|
var
|
||||||
|
relsym: string;
|
||||||
|
asmsymtyp: tasmsymtype;
|
||||||
|
l: aint;
|
||||||
|
begin
|
||||||
|
case actasmtoken of
|
||||||
|
AS_AT:
|
||||||
|
begin
|
||||||
|
{ darwin/i386 needs a relsym instead, and we can't }
|
||||||
|
{ generate this automatically }
|
||||||
|
if (target_info.system=system_i386_darwin) then
|
||||||
|
Message(asmr_e_invalid_reference_syntax);
|
||||||
|
consume(AS_AT);
|
||||||
|
if actasmtoken=AS_ID then
|
||||||
|
begin
|
||||||
|
{$ifdef x86_64}
|
||||||
|
if actasmpattern='GOTPCREL' then
|
||||||
|
{$endif x86_64}
|
||||||
|
{$ifdef i386}
|
||||||
|
if actasmpattern='GOT' then
|
||||||
|
{$endif i386}
|
||||||
|
oper.opr.ref.refaddr:=addr_pic
|
||||||
|
else
|
||||||
|
Message(asmr_e_invalid_reference_syntax);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Message(asmr_e_invalid_reference_syntax);
|
||||||
|
end;
|
||||||
|
AS_MINUS:
|
||||||
|
begin
|
||||||
|
{ relsym? }
|
||||||
|
Consume(AS_MINUS);
|
||||||
|
BuildConstSymbolExpression(true,true,false,l,relsym,asmsymtyp);
|
||||||
|
if (relsym<>'') then
|
||||||
|
oper.opr.ref.relsymbol:=current_asmdata.RefAsmSymbol(relsym)
|
||||||
|
else
|
||||||
|
dec(oper.opr.ref.offset,l);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
Procedure tx86attreader.BuildOperand(oper : tx86operand);
|
Procedure tx86attreader.BuildOperand(oper : tx86operand);
|
||||||
var
|
var
|
||||||
tempstr,
|
tempstr,
|
||||||
@ -340,11 +385,6 @@ Implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure handleat;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
function MaybeBuildReference:boolean;
|
function MaybeBuildReference:boolean;
|
||||||
{ Try to create a reference, if not a reference is found then false
|
{ Try to create a reference, if not a reference is found then false
|
||||||
is returned }
|
is returned }
|
||||||
@ -391,24 +431,7 @@ Implementation
|
|||||||
Message(asmr_e_invalid_reference_syntax);
|
Message(asmr_e_invalid_reference_syntax);
|
||||||
inc(oper.opr.ref.offset,l);
|
inc(oper.opr.ref.offset,l);
|
||||||
end;
|
end;
|
||||||
if actasmtoken=AS_AT then
|
MaybeGetPICModifier(oper);
|
||||||
begin
|
|
||||||
consume(AS_AT);
|
|
||||||
if actasmtoken=AS_ID then
|
|
||||||
begin
|
|
||||||
{$ifdef x86_64}
|
|
||||||
if actasmpattern='GOTPCREL' then
|
|
||||||
{$endif x86_64}
|
|
||||||
{$ifdef i386}
|
|
||||||
if actasmpattern='GOT' then
|
|
||||||
{$endif i386}
|
|
||||||
oper.opr.ref.refaddr:=addr_pic
|
|
||||||
else
|
|
||||||
Message(asmr_e_invalid_reference_syntax);
|
|
||||||
end
|
|
||||||
else
|
|
||||||
Message(asmr_e_invalid_reference_syntax);
|
|
||||||
end;
|
|
||||||
case actasmtoken of
|
case actasmtoken of
|
||||||
AS_END,
|
AS_END,
|
||||||
AS_SEPARATOR,
|
AS_SEPARATOR,
|
||||||
@ -525,29 +548,7 @@ Implementation
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
if oper.SetupVar(expr,false) then
|
if oper.SetupVar(expr,false) then
|
||||||
begin
|
MaybeGetPICModifier(oper)
|
||||||
if actasmtoken=AS_AT then
|
|
||||||
begin
|
|
||||||
consume(AS_AT);
|
|
||||||
if actasmtoken=AS_ID then
|
|
||||||
begin
|
|
||||||
{$ifdef x86_64}
|
|
||||||
if actasmpattern='GOTPCREL' then
|
|
||||||
{$endif x86_64}
|
|
||||||
{$ifdef i386}
|
|
||||||
if actasmpattern='GOT' then
|
|
||||||
{$endif i386}
|
|
||||||
begin
|
|
||||||
oper.opr.ref.refaddr:=addr_pic;
|
|
||||||
consume(AS_ID);
|
|
||||||
end
|
|
||||||
else
|
|
||||||
Message(asmr_e_invalid_reference_syntax);
|
|
||||||
end
|
|
||||||
else
|
|
||||||
Message(asmr_e_invalid_reference_syntax);
|
|
||||||
end;
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
Begin
|
Begin
|
||||||
{ look for special symbols ... }
|
{ look for special symbols ... }
|
||||||
|
Loading…
Reference in New Issue
Block a user