* Fixed linking for arm-wince target.

git-svn-id: trunk@3349 -
This commit is contained in:
yury 2006-04-29 09:44:22 +00:00
parent b4d0a212b6
commit 9ad6409662
2 changed files with 21 additions and 3 deletions

View File

@ -1367,8 +1367,13 @@ const win32stub : array[0..131] of byte=(
header.syms:=symidx;
if win32 then
begin
{$ifdef arm}
header.flag:=PE_FILE_32BIT_MACHINE or
PE_FILE_LINE_NUMS_STRIPPED or PE_FILE_LOCAL_SYMS_STRIPPED;
{$else arm}
header.flag:=PE_FILE_BYTES_REVERSED_LO or PE_FILE_32BIT_MACHINE or
PE_FILE_LINE_NUMS_STRIPPED or PE_FILE_LOCAL_SYMS_STRIPPED;
{$endif arm}
if not gotreloc then
header.flag:=header.flag or PE_FILE_RELOCS_STRIPPED;
end

View File

@ -328,16 +328,23 @@ implementation
objdata.free;
end;
procedure AddImport(const afuncname:string;ordnr:word;isvar:boolean);
procedure AddImport(const afuncname, implabelname:string;ordnr:word;isvar:boolean);
const
{$ifdef x86_64}
jmpopcode : array[0..2] of byte = (
$ff,$24,$25
);
{$else x86_64}
{$ifdef arm}
jmpopcode : array[0..7] of byte = (
$00,$c0,$9f,$e5, // ldr ip, [pc, #0]
$00,$f0,$9c,$e5 // ldr pc, [ip]
);
{$else arm}
jmpopcode : array[0..1] of byte = (
$ff,$25
);
{$endif arm}
{$endif x86_64}
nopopcodes : array[0..1] of byte = (
$90,$90
@ -393,7 +400,7 @@ implementation
if not isvar then
begin
objdata.SetSection(textobjsection);
implabel:=objdata.SymbolDefine(afuncname,AB_GLOBAL,AT_FUNCTION);
implabel:=objdata.SymbolDefine(implabelname,AB_GLOBAL,AT_FUNCTION);
objdata.writebytes(jmpopcode,sizeof(jmpopcode));
objdata.writereloc(0,sizeof(longint),idata5label,RELOC_ABSOLUTE32);
objdata.writebytes(nopopcodes,align(objdata.CurrObjSec.size,sizeof(nopopcodes))-objdata.CurrObjSec.size);
@ -406,6 +413,7 @@ implementation
var
hp1 : timportList;
hp2 : twin32imported_item;
mangledstring : string;
begin
AsmPrefix:='imp'+Lower(current_module.modulename^);
idatalabnr:=0;
@ -421,7 +429,11 @@ implementation
hp2:=twin32imported_item(hp1.imported_items.first);
while assigned(hp2) do
begin
AddImport(hp2.name^,hp2.ordnr,hp2.is_var);
if assigned(hp2.procdef) then
mangledstring:=hp2.procdef.mangledname
else
mangledstring:=hp2.name^;
AddImport(hp2.name^,mangledstring,hp2.ordnr,hp2.is_var);
hp2:=twin32imported_item(hp2.next);
end;
EndImport;
@ -1679,6 +1691,7 @@ initialization
{$endif x86_64}
{$ifdef arm}
RegisterExternalLinker(system_arm_wince_info,TLinkerWin32);
RegisterInternalLinker(system_arm_wince_info,TPECoffLinker);
RegisterImport(system_arm_wince,TImportLibWin32);
RegisterExport(system_arm_wince,TExportLibWin32);
RegisterRes(res_gnu_wince_windres_info);