Skip to content

Commit 06bc571

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 b644e8c commit 06bc571

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
8+
SymbolMap *
9+
get_target_symbol_map(uint32 *sym_num)
10+
{
11+
abort();
12+
}
13+
14+
uint32
15+
get_plt_table_size(void)
16+
{
17+
abort();
18+
}
19+
20+
void
21+
init_plt_table(uint8 *plt)
22+
{
23+
abort();
24+
}
25+
26+
void
27+
get_current_target(char *target_buf, uint32 target_buf_size)
28+
{
29+
abort();
30+
}
31+
32+
bool
33+
apply_relocation(AOTModule *module, uint8 *target_section_addr,
34+
uint32 target_section_size, uint64 reloc_offset,
35+
int64 reloc_addend, uint32 reloc_type, void *symbol_addr,
36+
int32 symbol_index, char *error_buf, uint32 error_buf_size)
37+
{
38+
abort();
39+
}

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_BUILD_WAMR_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_BUILD_WAMR_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)