Fix some relocation type issues in windows (#574)

Implement Windows PE file relocation type IMAGE_REL_AMD64_ADDR64/ADDR32/REL32, implement relocation for symbol "__xmm@xxx"/"__plt@xxx"/".rdata", implement Windows invokeNative simd asm code and enable SIMD by default for windows platform. Also update wamrc tool.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
This commit is contained in:
Wenyong Huang
2021-03-16 03:59:16 -05:00
committed by GitHub
parent afa1feb1a8
commit fda3a26903
7 changed files with 385 additions and 30 deletions

View File

@ -0,0 +1,62 @@
;
; Copyright (C) 2019 Intel Corporation. All rights reserved.
; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
;
_TEXT SEGMENT
; rcx func_ptr
; rdx argv
; r8 n_stacks
invokeNative PROC
push rbp
mov rbp, rsp
mov r10, rcx ; func_ptr
mov rax, rdx ; argv
mov rcx, r8 ; n_stacks
; fill all fp args
movdqu xmm0, xmmword ptr [rax + 0]
movdqu xmm1, xmmword ptr [rax + 16]
movdqu xmm2, xmmword ptr [rax + 32]
movdqu xmm3, xmmword ptr [rax + 48]
; check for stack args
cmp rcx, 0
jz cycle_end
mov rdx, rsp
and rdx, 15
jz no_abort
int 3
no_abort:
mov rdx, rcx
and rdx, 1
shl rdx, 3
sub rsp, rdx
; store stack args
lea r9, qword ptr [rax + rcx * 8 + 88]
sub r9, rsp ; offset
cycle:
push qword ptr [rsp + r9]
loop cycle
cycle_end:
mov rcx, [rax + 64]
mov rdx, [rax + 72]
mov r8, [rax + 80]
mov r9, [rax + 88]
sub rsp, 32 ; shadow space
call r10
leave
ret
invokeNative ENDP
_TEXT ENDS
END

View File

@ -19,7 +19,7 @@ if (WAMR_BUILD_TARGET STREQUAL "X86_64" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
endif ()
else ()
if (WAMR_BUILD_PLATFORM STREQUAL "windows")
message(FATAL_ERROR "need an implementation of SIMD on windows")
set (source_all ${c_source_all} ${IWASM_COMMON_DIR}/arch/invokeNative_em64_simd.asm)
else()
set (source_all ${c_source_all} ${IWASM_COMMON_DIR}/arch/invokeNative_em64_simd.s)
endif()