* os2 fixes for import

* asmsymtype support for intel reader
This commit is contained in:
peter 2004-11-29 18:50:15 +00:00
parent 05127d887d
commit 06cfe01791
6 changed files with 75 additions and 34 deletions

View File

@ -30,6 +30,7 @@ Unit Ra386int;
cclasses,
cpubase,
globtype,
aasmbase,
rasm,
rax86;
@ -62,7 +63,7 @@ Unit Ra386int;
function consume(t : tasmtoken):boolean;
procedure RecoverConsume(allowcomma:boolean);
procedure BuildRecordOffsetSize(const expr: string;var offset:aint;var size:aint);
procedure BuildConstSymbolExpression(needofs,isref:boolean;var value:aint;var asmsym:string);
procedure BuildConstSymbolExpression(needofs,isref:boolean;var value:aint;var asmsym:string;var asmsymtyp:TAsmsymtype);
function BuildConstExpression:aint;
function BuildRefConstExpression:aint;
procedure BuildReference(oper : tx86operand);
@ -82,7 +83,7 @@ Unit Ra386int;
globals,verbose,
systems,
{ aasm }
aasmbase,aasmtai,aasmcpu,
aasmtai,aasmcpu,
{ symtable }
symconst,symbase,symtype,symsym,symdef,symtable,
{ parser }
@ -713,7 +714,7 @@ Unit Ra386int;
end;
Procedure ti386intreader.BuildConstSymbolExpression(needofs,isref:boolean;var value:aint;var asmsym:string);
Procedure ti386intreader.BuildConstSymbolExpression(needofs,isref:boolean;var value:aint;var asmsym:string;var asmsymtyp:TAsmsymtype);
var
tempstr,expr,hs : string;
parenlevel : longint;
@ -722,6 +723,7 @@ Unit Ra386int;
errorflag : boolean;
prevtok : tasmtoken;
hl : tasmlabel;
hssymtyp : Tasmsymtype;
def : tdef;
sym : tsym;
srsymtable : tsymtable;
@ -729,6 +731,7 @@ Unit Ra386int;
{ reset }
value:=0;
asmsym:='';
asmsymtyp:=AT_DATA;
errorflag:=FALSE;
tempstr:='';
expr:='';
@ -894,6 +897,7 @@ Unit Ra386int;
AS_ID:
Begin
hs:='';
hssymtyp:=AT_DATA;
def:=nil;
tempstr:=actasmpattern;
prevtok:=prevasmtoken;
@ -908,11 +912,15 @@ Unit Ra386int;
if is_locallabel(tempstr) then
begin
CreateLocalLabel(tempstr,hl,false);
hs:=hl.name
hs:=hl.name;
hssymtyp:=AT_FUNCTION;
end
else
if SearchLabel(tempstr,hl,false) then
hs:=hl.name
begin
hs:=hl.name;
hssymtyp:=AT_FUNCTION;
end
else
begin
searchsym(tempstr,sym,srsymtable);
@ -939,6 +947,7 @@ Unit Ra386int;
if Tprocsym(sym).procdef_count>1 then
Message(asmr_w_calling_overload_func);
hs:=tprocsym(sym).first_procdef.mangledname;
hssymtyp:=AT_FUNCTION;
end;
typesym :
begin
@ -956,7 +965,10 @@ Unit Ra386int;
if hs<>'' then
begin
if asmsym='' then
asmsym:=hs
begin
asmsym:=hs;
asmsymtyp:=hssymtyp;
end
else
Message(asmr_e_cant_have_multiple_relocatable_symbols);
if (expr='') or (expr[length(expr)]='+') then
@ -1039,8 +1051,9 @@ Unit Ra386int;
var
l : aint;
hs : string;
hssymtyp : TAsmsymtype;
begin
BuildConstSymbolExpression(false,false,l,hs);
BuildConstSymbolExpression(false,false,l,hs,hssymtyp);
if hs<>'' then
Message(asmr_e_relocatable_symbol_not_allowed);
BuildConstExpression:=l;
@ -1051,8 +1064,9 @@ Unit Ra386int;
var
l : aint;
hs : string;
hssymtyp : TAsmsymtype;
begin
BuildConstSymbolExpression(false,true,l,hs);
BuildConstSymbolExpression(false,true,l,hs,hssymtyp);
if hs<>'' then
Message(asmr_e_relocatable_symbol_not_allowed);
BuildRefConstExpression:=l;
@ -1063,6 +1077,7 @@ Unit Ra386int;
var
k,l,scale : aint;
tempstr,hs : string;
tempsymtyp : tasmsymtype;
typesize : longint;
code : integer;
hreg : tregister;
@ -1320,14 +1335,14 @@ Unit Ra386int;
begin
if not GotPlus and not GotStar then
Message(asmr_e_invalid_reference_syntax);
BuildConstSymbolExpression(true,true,l,tempstr);
BuildConstSymbolExpression(true,true,l,tempstr,tempsymtyp);
if tempstr<>'' then
begin
if GotStar then
Message(asmr_e_only_add_relocatable_symbol);
if not assigned(oper.opr.ref.symbol) then
oper.opr.ref.symbol:=objectlibrary.newasmsymbol(tempstr,AB_EXTERNAL,AT_FUNCTION)
oper.opr.ref.symbol:=objectlibrary.newasmsymbol(tempstr,AB_EXTERNAL,tempsymtyp)
else
Message(asmr_e_cant_have_multiple_relocatable_symbols);
end;
@ -1401,17 +1416,16 @@ Unit Ra386int;
var
l : aint;
tempstr : string;
tempsymtyp : tasmsymtype;
begin
if not (oper.opr.typ in [OPR_NONE,OPR_CONSTANT]) then
Message(asmr_e_invalid_operand_type);
BuildConstSymbolExpression(true,false,l,tempstr);
BuildConstSymbolExpression(true,false,l,tempstr,tempsymtyp);
if tempstr<>'' then
begin
oper.opr.typ:=OPR_SYMBOL;
oper.opr.symofs:=l;
{ the symbol already exists, but we don't know whether it is data or
a function. we can use AT_NONE }
oper.opr.symbol:=objectlibrary.newasmsymbol(tempstr,AB_EXTERNAL,AT_NONE);
oper.opr.symbol:=objectlibrary.newasmsymbol(tempstr,AB_EXTERNAL,tempsymtyp);
end
else
begin
@ -1832,9 +1846,10 @@ Unit Ra386int;
Procedure ti386intreader.BuildConstant(constsize: longint);
var
asmsym,
expr: string;
value : aint;
asmsymtyp : tasmsymtype;
asmsym,
expr: string;
value : aint;
Begin
Repeat
Case actasmtoken of
@ -1865,12 +1880,12 @@ Unit Ra386int;
AS_INTNUM,
AS_ID :
Begin
BuildConstSymbolExpression(false,false,value,asmsym);
BuildConstSymbolExpression(false,false,value,asmsym,asmsymtyp);
if asmsym<>'' then
begin
if constsize<>sizeof(aint) then
Message1(asmr_w_const32bit_for_address,asmsym);
ConcatConstSymbol(curlist,asmsym,value)
ConcatConstSymbol(curlist,asmsym,asmsymtyp,value)
end
else
ConcatConstant(curlist,value,constsize);
@ -2022,7 +2037,11 @@ begin
end.
{
$Log$
Revision 1.81 2004-11-21 21:36:13 peter
Revision 1.82 2004-11-29 18:50:15 peter
* os2 fixes for import
* asmsymtype support for intel reader
Revision 1.81 2004/11/21 21:36:13 peter
* allow spaces before : of a label
Revision 1.80 2004/11/09 22:32:59 peter

View File

@ -1118,7 +1118,7 @@ implementation
if not(current_module.uses_imports) then
begin
current_module.uses_imports:=true;
importlib.preparelib(current_module.modulename^);
importlib.preparelib(current_module.realmodulename^);
end;
importlib.importvariable(tglobalvarsym(vs),C_name,dll_name);
end
@ -1306,7 +1306,11 @@ implementation
end.
{
$Log$
Revision 1.85 2004-11-16 20:32:40 peter
Revision 1.86 2004-11-29 18:50:15 peter
* os2 fixes for import
* asmsymtype support for intel reader
Revision 1.85 2004/11/16 20:32:40 peter
* fixes for win32 mangledname
Revision 1.84 2004/11/15 23:35:31 peter

View File

@ -1277,9 +1277,11 @@ implementation
begin
consume(_LIBRARY);
stringdispose(current_module.modulename);
stringdispose(current_module.realmodulename);
current_module.modulename:=stringdup(pattern);
current_module.realmodulename:=stringdup(orgpattern);
current_module.islibrary:=true;
exportlib.preparelib(pattern);
exportlib.preparelib(orgpattern);
consume(_ID);
consume(_SEMICOLON);
end
@ -1293,7 +1295,7 @@ implementation
current_module.modulename:=stringdup(pattern);
current_module.realmodulename:=stringdup(orgpattern);
if (target_info.system in [system_i386_WIN32,system_i386_wdosx]) then
exportlib.preparelib(pattern);
exportlib.preparelib(orgpattern);
consume(_ID);
if token=_LKLAMMER then
begin
@ -1306,7 +1308,7 @@ implementation
consume(_SEMICOLON);
end
else if (target_info.system in [system_i386_WIN32,system_i386_wdosx]) then
exportlib.preparelib(current_module.modulename^);
exportlib.preparelib(current_module.realmodulename^);
{ global switches are read, so further changes aren't allowed }
current_module.in_global:=false;
@ -1521,7 +1523,11 @@ implementation
end.
{
$Log$
Revision 1.176 2004-11-19 08:17:02 michael
Revision 1.177 2004-11-29 18:50:15 peter
* os2 fixes for import
* asmsymtype support for intel reader
Revision 1.176 2004/11/19 08:17:02 michael
* Split po_public into po_public and po_global (Peter)
Revision 1.175 2004/11/16 20:32:40 peter

View File

@ -1289,7 +1289,7 @@ implementation
if not(current_module.uses_imports) then
begin
current_module.uses_imports:=true;
importlib.preparelib(current_module.modulename^);
importlib.preparelib(current_module.realmodulename^);
end;
if assigned(pd.import_name) then
@ -1438,7 +1438,11 @@ implementation
end.
{
$Log$
Revision 1.219 2004-11-21 17:17:03 florian
Revision 1.220 2004-11-29 18:50:15 peter
* os2 fixes for import
* asmsymtype support for intel reader
Revision 1.219 2004/11/21 17:17:03 florian
* changed funcret location back to tlocation
Revision 1.218 2004/11/19 08:17:02 michael

View File

@ -792,7 +792,7 @@ unit raatt;
begin
if constsize<>sizeof(aint) then
Message(asmr_w_32bit_const_for_address);
ConcatConstSymbol(curlist,asmsym,value)
ConcatConstSymbol(curlist,asmsym,asmsymtyp,value)
end
else
ConcatConstant(curlist,value,constsize);
@ -1514,7 +1514,11 @@ end.
{
$Log$
Revision 1.14 2004-11-21 15:35:23 peter
Revision 1.15 2004-11-29 18:50:15 peter
* os2 fixes for import
* asmsymtype support for intel reader
Revision 1.14 2004/11/21 15:35:23 peter
* float routines all use internproc and compilerproc helpers
Revision 1.13 2004/11/08 22:09:59 peter

View File

@ -200,7 +200,7 @@ Function SearchIConstant(const s:string; var l:aint): boolean;
Procedure ConcatDirect(p : TAAsmoutput;s:string);
Procedure ConcatLabel(p: TAAsmoutput;var l : tasmlabel);
Procedure ConcatConstant(p : TAAsmoutput;value: aint; constsize:byte);
Procedure ConcatConstSymbol(p : TAAsmoutput;const sym:string;l:aint);
Procedure ConcatConstSymbol(p : TAAsmoutput;const sym:string;symtyp:tasmsymtype;l:aint);
Procedure ConcatRealConstant(p : TAAsmoutput;value: bestreal; real_typ : tfloattype);
Procedure ConcatString(p : TAAsmoutput;s:string);
procedure ConcatAlign(p:TAAsmoutput;l:aint);
@ -1521,9 +1521,9 @@ Begin
end;
Procedure ConcatConstSymbol(p : TAAsmoutput;const sym:string;l:aint);
Procedure ConcatConstSymbol(p : TAAsmoutput;const sym:string;symtyp:tasmsymtype;l:aint);
begin
p.concat(Tai_const.Createname(sym,AT_DATA,l));
p.concat(Tai_const.Createname(sym,symtyp,l));
end;
@ -1617,7 +1617,11 @@ end;
end.
{
$Log$
Revision 1.96 2004-11-21 15:35:23 peter
Revision 1.97 2004-11-29 18:50:15 peter
* os2 fixes for import
* asmsymtype support for intel reader
Revision 1.96 2004/11/21 15:35:23 peter
* float routines all use internproc and compilerproc helpers
Revision 1.95 2004/11/09 22:32:59 peter