From 9ad6409662f806172a8de8806f0fd7b6ccdf7f64 Mon Sep 17 00:00:00 2001 From: yury Date: Sat, 29 Apr 2006 09:44:22 +0000 Subject: [PATCH] * Fixed linking for arm-wince target. git-svn-id: trunk@3349 - --- compiler/ogcoff.pas | 5 +++++ compiler/systems/t_win.pas | 19 ++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/compiler/ogcoff.pas b/compiler/ogcoff.pas index e2d54fd59e..8193327713 100644 --- a/compiler/ogcoff.pas +++ b/compiler/ogcoff.pas @@ -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 diff --git a/compiler/systems/t_win.pas b/compiler/systems/t_win.pas index c5a3cf2c1d..b77a42c5c9 100644 --- a/compiler/systems/t_win.pas +++ b/compiler/systems/t_win.pas @@ -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);