Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions core/iwasm/aot/arch/aot_reloc_dummy.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (C) 2020 Intel Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/

#include "aot_reloc.h"

SymbolMap *
get_target_symbol_map(uint32 *sym_num)
{
abort();
}

uint32
get_plt_table_size(void)
{
abort();
}

void
init_plt_table(uint8 *plt)
{
abort();
}

void
get_current_target(char *target_buf, uint32 target_buf_size)
{
abort();
}

bool
apply_relocation(AOTModule *module, uint8 *target_section_addr,
uint32 target_section_size, uint64 reloc_offset,
int64 reloc_addend, uint32 reloc_type, void *symbol_addr,
int32 symbol_index, char *error_buf, uint32 error_buf_size)
{
abort();
}
5 changes: 4 additions & 1 deletion core/iwasm/aot/iwasm_aot.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ if (WAMR_BUILD_AOT_VALIDATOR EQUAL 1)
list (APPEND c_source_all ${IWASM_AOT_DIR}/aot_validator.c)
endif ()

if (WAMR_BUILD_TARGET STREQUAL "X86_64" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
if (WAMR_BUILD_WAMR_COMPILER EQUAL 1)
# AOT reloc functions are not used during AOT compilation
set (arch_source ${IWASM_AOT_DIR}/arch/aot_reloc_dummy.c)
elseif (WAMR_BUILD_TARGET STREQUAL "X86_64" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
set (arch_source ${IWASM_AOT_DIR}/arch/aot_reloc_x86_64.c)
elseif (WAMR_BUILD_TARGET STREQUAL "X86_32")
set (arch_source ${IWASM_AOT_DIR}/arch/aot_reloc_x86_32.c)
Expand Down
35 changes: 17 additions & 18 deletions wamr-compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,20 @@ endif()
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")

# Turn on SIMD by default, can be turned off by setting WAMR_BUILD_SIMD to 0
if (WAMR_BUILD_SIMD EQUAL 0)
add_definitions(-DWASM_ENABLE_SIMD=0)
else()
add_definitions(-DWASM_ENABLE_SIMD=1)
endif()

add_definitions(-DWASM_ENABLE_INTERP=1)
add_definitions(-DWASM_ENABLE_WAMR_COMPILER=1)
add_definitions(-DWASM_ENABLE_BULK_MEMORY=1)
add_definitions(-DWASM_DISABLE_HW_BOUND_CHECK=1)
add_definitions(-DWASM_ENABLE_SHARED_MEMORY=1)
add_definitions(-DWASM_ENABLE_THREAD_MGR=1)
add_definitions(-DWASM_ENABLE_TAIL_CALL=1)
add_definitions(-DWASM_ENABLE_SIMD=1)
add_definitions(-DWASM_ENABLE_REF_TYPES=1)
add_definitions(-DWASM_ENABLE_CUSTOM_NAME_SECTION=1)
add_definitions(-DWASM_ENABLE_AOT_STACK_FRAME=1)
Expand Down Expand Up @@ -132,21 +138,11 @@ endif ()

message ("-- Build as target ${WAMR_BUILD_TARGET}")

if (CMAKE_SIZEOF_VOID_P EQUAL 8)
if (WAMR_BUILD_TARGET STREQUAL "X86_64" OR WAMR_BUILD_TARGET STREQUAL "AMD_64"
OR WAMR_BUILD_TARGET MATCHES "AARCH64.*" OR WAMR_BUILD_TARGET MATCHES "RISCV64.*")
if (NOT WAMR_BUILD_PLATFORM STREQUAL "windows")
# Add -fPIC flag if build as 64-bit
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS} -fPIC")
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS} -fPIC")
endif ()
else ()
add_definitions (-m32)
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m32")
endif ()
# Add -m32 flag if compiling on 64-bit system for 32-bit x86 target
Comment thread
lum1n0us marked this conversation as resolved.
if (CMAKE_SIZEOF_VOID_P EQUAL 8 AND WAMR_BUILD_TARGET STREQUAL "X86_32")
add_definitions (-m32)
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m32")
endif ()

if (NOT CMAKE_BUILD_TYPE)
Expand Down Expand Up @@ -275,6 +271,8 @@ else ()
message ("-- Lib wasi-threads disabled")
endif ()

set (WAMR_BUILD_WAMR_COMPILER 1)

include (${SHARED_DIR}/platform/${WAMR_BUILD_PLATFORM}/shared_platform.cmake)
include (${SHARED_DIR}/mem-alloc/mem_alloc.cmake)
include (${SHARED_DIR}/utils/shared_utils.cmake)
Expand Down Expand Up @@ -376,7 +374,7 @@ add_library (aotclib ${IWASM_COMPL_SOURCE})

add_executable (wamrc main.c)
check_pie_supported()
set_target_properties (wamrc PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_target_properties (wamrc vmlib aotclib PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_version_info (wamrc)

if (LLVM_LINK_LLVM_DYLIB)
Expand All @@ -398,4 +396,5 @@ else()
${UV_A_LIBS})
endif()

install (TARGETS wamrc DESTINATION bin)
include (GNUInstallDirs)
install (TARGETS wamrc)
Comment thread
lum1n0us marked this conversation as resolved.
Loading