Skip to content

Commit 76fadb2

Browse files
committed
Use dummy AOT reloc functions when building wamrc
AOT reloc functions are used only when loading AOT WebAssembly modules on target, not during AOT compilation. Original code led to build issues when building wamrc as cross-compiler, using arm header on x86 build.
1 parent b0ccae8 commit 76fadb2

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright (C) 2020 Intel Corporation. All rights reserved.
3+
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
*/
5+
6+
#include "aot_reloc.h"
7+
#include <stdlib.h>
8+
9+
SymbolMap *
10+
get_target_symbol_map(uint32 *sym_num)
11+
{
12+
abort();
13+
}
14+
15+
uint32
16+
get_plt_table_size(void)
17+
{
18+
abort();
19+
}
20+
21+
void
22+
init_plt_table(uint8 *plt)
23+
{
24+
abort();
25+
}
26+
27+
void
28+
get_current_target(char *target_buf, uint32 target_buf_size)
29+
{
30+
abort();
31+
}
32+
33+
bool
34+
apply_relocation(AOTModule *module,
35+
uint8 *target_section_addr, uint32 target_section_size,
36+
uint64 reloc_offset, int64 reloc_addend,
37+
uint32 reloc_type, void *symbol_addr, int32 symbol_index,
38+
char *error_buf, uint32 error_buf_size)
39+
{
40+
abort();
41+
}

core/iwasm/aot/iwasm_aot.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ if (WAMR_BUILD_AOT_VALIDATOR EQUAL 1)
2121
list (APPEND c_source_all ${IWASM_AOT_DIR}/aot_validator.c)
2222
endif ()
2323

24-
if (WAMR_BUILD_TARGET STREQUAL "X86_64" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
24+
if (WAMR_AOT_COMPILER EQUAL 1)
25+
# AOT reloc functions are not used during AOT compilation
26+
set (arch_source ${IWASM_AOT_DIR}/arch/aot_reloc_dummy.c)
27+
elseif (WAMR_BUILD_TARGET STREQUAL "X86_64" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
2528
set (arch_source ${IWASM_AOT_DIR}/arch/aot_reloc_x86_64.c)
2629
elseif (WAMR_BUILD_TARGET STREQUAL "X86_32")
2730
set (arch_source ${IWASM_AOT_DIR}/arch/aot_reloc_x86_32.c)

wamr-compiler/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ else ()
265265
message ("-- Lib wasi-threads disabled")
266266
endif ()
267267

268+
set (WAMR_AOT_COMPILER 1)
269+
268270
include (${SHARED_DIR}/platform/${WAMR_BUILD_PLATFORM}/shared_platform.cmake)
269271
include (${SHARED_DIR}/mem-alloc/mem_alloc.cmake)
270272
include (${SHARED_DIR}/utils/shared_utils.cmake)

0 commit comments

Comments
 (0)