* more fixes to support vasm on arm

* do not crash on empty eabi attribute strings

git-svn-id: trunk@49397 -
This commit is contained in:
florian 2021-05-22 20:22:53 +00:00
parent 19876ca805
commit e9b3db0d78
2 changed files with 43 additions and 12 deletions

View File

@ -1,4 +1,4 @@
{
{ f
Copyright (c) 1998-2006 by the Free Pascal team
This unit implements the generic part of the GNU assembler
@ -1408,7 +1408,8 @@ implementation
end
else
begin
if ((target_info.system <> system_arm_linux) and (target_info.system <> system_arm_android)) then
if ((target_info.system <> system_arm_linux) and (target_info.system <> system_arm_android)) or
(target_asm.id=as_arm_vasm) then
sepChar := '@'
else
sepChar := '#';
@ -1617,15 +1618,24 @@ implementation
end;
ait_eabi_attribute:
begin
case tai_eabi_attribute(hp).eattr_typ of
eattrtype_dword:
writer.AsmWrite(#9'.eabi_attribute '+tostr(tai_eabi_attribute(hp).tag)+','+tostr(tai_eabi_attribute(hp).value));
eattrtype_ntbs:
writer.AsmWrite(#9'.eabi_attribute '+tostr(tai_eabi_attribute(hp).tag)+',"'+tai_eabi_attribute(hp).valuestr^+'"');
else
Internalerror(2019100601);
end;
writer.AsmLn;
{ as of today, vasm does not support the eabi directives }
if target_asm.id<>as_arm_vasm then
begin
case tai_eabi_attribute(hp).eattr_typ of
eattrtype_dword:
writer.AsmWrite(#9'.eabi_attribute '+tostr(tai_eabi_attribute(hp).tag)+','+tostr(tai_eabi_attribute(hp).value));
eattrtype_ntbs:
begin
if assigned(tai_eabi_attribute(hp).valuestr) then
writer.AsmWrite(#9'.eabi_attribute '+tostr(tai_eabi_attribute(hp).tag)+',"'+tai_eabi_attribute(hp).valuestr^+'"')
else
writer.AsmWrite(#9'.eabi_attribute '+tostr(tai_eabi_attribute(hp).tag)+',""');
end
else
Internalerror(2019100601);
end;
writer.AsmLn;
end;
end;
{$ifdef WASM}

View File

@ -84,6 +84,27 @@ unit agarmvasm;
end;
const
cputype_to_vasm_march : array[tcputype] of string = (
'', // cpu_none
'a2',
'a3',
'a4',
'a4t',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
'');
function TARMVASM.MakeCmdLine: TCmdStr;
var
objtype: string;
@ -99,7 +120,7 @@ unit agarmvasm;
Replace(result,'$ASM',maybequoted(ScriptFixFileName(AsmFileName)));
Replace(result,'$OBJ',maybequoted(ScriptFixFileName(ObjFileName)));
Replace(result,'$ARCH','-m'+cputype_to_gas_march[current_settings.cputype]);
Replace(result,'$ARCH','-'+cputype_to_vasm_march[current_settings.cputype]);
Replace(result,'$OTYPE',objtype);
Replace(result,'$EXTRAOPT',asmextraopt);
end;