Fix some issues for Arm platform. (#457)

Motivation:
we found some issues during enable the WAMR on arm devices, such as relocation issues, stack alignment issues.

Proposed change:
We optimized the relocation process for arm platform, for relocation jump table, the SP should be aligned to 16 bytes. And we also make "getentropy" worked for other non-supported platform.
This commit is contained in:
sophy228
2020-12-02 10:22:55 +08:00
committed by GitHub
parent 591e4ce536
commit c8b0a1cee1
5 changed files with 166 additions and 18 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
* Copyright (C) 2020 Intel Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
@ -7,6 +7,9 @@
#include "bh_log.h"
#include "wasm_export.h"
#include "../interpreter/wasm.h"
#ifndef _DEFAULT_SOURCE
#include "sys/syscall.h"
#endif
#define get_module_inst(exec_env) \
wasm_runtime_get_module_inst(exec_env)
@ -264,7 +267,11 @@ getentropy_wrapper(wasm_exec_env_t exec_env, void *buffer, uint32 length)
{
if (buffer == NULL)
return -1;
#ifdef _DEFAULT_SOURCE
return getentropy(buffer, length);
#else
return syscall(SYS_getrandom, buffer, length, 0);
#endif
}
static int