File tree Expand file tree Collapse file tree 12 files changed +68
-26
lines changed
product-mini/platforms/linux Expand file tree Collapse file tree 12 files changed +68
-26
lines changed Original file line number Diff line number Diff line change @@ -107,8 +107,6 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
107107
108108include (${WAMR_ROOT_DIR} /build -scripts/runtime_lib.cmake)
109109
110- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -pie -fPIE" )
111-
112110set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wshadow" )
113111# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wsign-conversion")
114112
Original file line number Diff line number Diff line change 11# Copyright (C) 2019 Intel Corporation. All rights reserved.
22# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33
4- cmake_minimum_required (VERSION 2.9)
4+ cmake_minimum_required (VERSION 3.14)
5+
6+ include (CheckPIESupported)
57
68project (iwasm)
79
@@ -119,7 +121,7 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
119121include (${WAMR_ROOT_DIR} /build -scripts/runtime_lib.cmake)
120122add_library (vmlib ${WAMR_RUNTIME_LIB_SOURCE} )
121123
122- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -pie -fPIE " )
124+ set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections" )
123125
124126set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wshadow" )
125127# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wsign-conversion")
@@ -164,6 +166,9 @@ include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
164166
165167add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE} )
166168
169+ check_pie_supported()
170+ set_target_properties (iwasm PROPERTIES POSITION_INDEPENDENT_CODE ON )
171+
167172install (TARGETS iwasm DESTINATION bin)
168173
169174target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread)
Original file line number Diff line number Diff line change 11# Copyright (C) 2019 Intel Corporation. All rights reserved.
22# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33
4- cmake_minimum_required (VERSION 2.9)
4+ cmake_minimum_required (VERSION 3.14)
5+
6+ include (CheckPIESupported)
57
68if (NOT WAMR_BUILD_PLATFORM STREQUAL "windows" )
79 project (basic)
@@ -56,7 +58,6 @@ endif ()
5658
5759if (NOT MSVC )
5860 # linker flags
59- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie -fPIE" )
6061 if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang" ))
6162 set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections" )
6263 endif ()
@@ -80,6 +81,9 @@ include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
8081
8182add_executable (basic src/main.c src/native_impl.c ${UNCOMMON_SHARED_SOURCE} )
8283
84+ check_pie_supported()
85+ set_target_properties (basic PROPERTIES POSITION_INDEPENDENT_CODE ON )
86+
8387if (APPLE )
8488 target_link_libraries (basic vmlib -lm -ldl -lpthread)
8589else ()
Original file line number Diff line number Diff line change 11# Copyright (C) 2022 Intel Corporation. All rights reserved.
22# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33
4- cmake_minimum_required (VERSION 3.0)
4+ cmake_minimum_required (VERSION 3.14)
5+
6+ include (CheckPIESupported)
57
68if (NOT WAMR_BUILD_PLATFORM STREQUAL "windows" )
79 project (iwasm)
@@ -56,7 +58,6 @@ endif ()
5658
5759if (NOT MSVC )
5860 # linker flags
59- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie -fPIE" )
6061 if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang" ))
6162 set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections" )
6263 endif ()
@@ -80,6 +81,9 @@ include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
8081
8182add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE} )
8283
84+ check_pie_supported()
85+ set_target_properties (iwasm PROPERTIES POSITION_INDEPENDENT_CODE ON )
86+
8387if (APPLE )
8488 target_link_libraries (iwasm vmlib -lm -ldl -lpthread)
8589else ()
Original file line number Diff line number Diff line change 11# Copyright (C) 2019 Intel Corporation. All rights reserved.
22# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33
4- cmake_minimum_required (VERSION 2.8...3.16)
4+ cmake_minimum_required (VERSION 3.14)
5+
6+ include (CheckPIESupported)
7+
58project (multi_module)
69
710################ runtime settings ################
@@ -47,7 +50,6 @@ set(WAMR_BUILD_LIBC_WASI 1)
4750set (WAMR_BUILD_MULTI_MODULE 1)
4851
4952# compiling and linking flags
50- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie -fPIE" )
5153if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang" ))
5254 set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections" )
5355endif ()
@@ -150,5 +152,8 @@ add_executable(multi_module src/main.c ${UNCOMMON_SHARED_SOURCE})
150152
151153add_dependencies (multi_module vmlib WASM_MODULE)
152154
155+ check_pie_supported()
156+ set_target_properties (multi_module PROPERTIES POSITION_INDEPENDENT_CODE ON )
157+
153158# libraries
154159target_link_libraries (multi_module PRIVATE vmlib -lpthread -lm)
Original file line number Diff line number Diff line change 11# Copyright (C) 2019 Intel Corporation. All rights reserved.
22# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33
4- cmake_minimum_required (VERSION 2.8)
4+ cmake_minimum_required (VERSION 3.14)
5+
6+ include (CheckPIESupported)
7+
58project (pthread)
69
710################ runtime settings ################
@@ -48,7 +51,6 @@ set(WAMR_BUILD_LIB_PTHREAD 1)
4851set (WAMR_BUILD_LIB_PTHREAD_SEMAPHORE 1)
4952
5053# compiling and linking flags
51- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie -fPIE" )
5254if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang" ))
5355 set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections" )
5456endif ()
@@ -73,5 +75,7 @@ set (RUNTIME_SOURCE_ALL
7375 ${UNCOMMON_SHARED_SOURCE}
7476)
7577add_executable (iwasm ${RUNTIME_SOURCE_ALL} )
78+ check_pie_supported()
79+ set_target_properties (iwasm PROPERTIES POSITION_INDEPENDENT_CODE ON )
7680target_link_libraries (iwasm vmlib -lpthread -lm -ldl)
7781
Original file line number Diff line number Diff line change 11# Copyright (C) 2019 Intel Corporation. All rights reserved.
22# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33
4- cmake_minimum_required (VERSION 3.0)
4+ cmake_minimum_required (VERSION 3.14)
5+
6+ include (CheckPIESupported)
7+
58project (native_lib)
69
710################ runtime settings ##############
@@ -46,7 +49,6 @@ set (WAMR_BUILD_LIBC_BUILTIN 1)
4649set (WAMR_BUILD_FAST_INTERP 1)
4750
4851# compiling and linking flags
49- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie -fPIE" )
5052if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang" ))
5153 set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections" )
5254endif ()
@@ -68,6 +70,9 @@ set (RUNTIME_SOURCE_ALL
6870
6971add_executable (iwasm ${RUNTIME_SOURCE_ALL} )
7072
73+ check_pie_supported()
74+ set_target_properties (iwasm PROPERTIES POSITION_INDEPENDENT_CODE ON )
75+
7176target_link_libraries (iwasm vmlib -lpthread -lm -ldl)
7277
7378################ native libraries ###############
Original file line number Diff line number Diff line change 11# Copyright (C) 2019 Intel Corporation. All rights reserved.
22# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33
4- cmake_minimum_required (VERSION 2.9)
4+ cmake_minimum_required (VERSION 3.14)
5+
6+ include (CheckPIESupported)
57
68if (NOT WAMR_BUILD_PLATFORM STREQUAL "windows" )
79 project (ref-types)
@@ -70,7 +72,6 @@ set(WAMR_BUILD_REF_TYPES 1)
7072
7173if (NOT MSVC )
7274 # compiling and linking flags
73- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie -fPIE" )
7475 if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang" ))
7576 set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections" )
7677 endif ()
@@ -107,6 +108,9 @@ include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
107108
108109add_executable (hello src/hello.c ${UNCOMMON_SHARED_SOURCE} )
109110
111+ check_pie_supported()
112+ set_target_properties (hello PROPERTIES POSITION_INDEPENDENT_CODE ON )
113+
110114target_include_directories (hello PRIVATE ${UNCOMMON_SHARED_DIR} )
111115
112116target_link_libraries (hello vmlib -lpthread -lm)
Original file line number Diff line number Diff line change 11# Copyright (C) 2019 Intel Corporation. All rights reserved.
22# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33
4- cmake_minimum_required (VERSION 2.8...3.18)
4+ cmake_minimum_required (VERSION 3.14)
5+
6+ include (CheckPIESupported)
7+
58project (socket_api_sample)
69
710#######################################
@@ -170,7 +173,6 @@ set(WAMR_BUILD_LIBC_WASI 1)
170173set (WAMR_BUILD_LIB_PTHREAD 1)
171174
172175# compiling and linking flags
173- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie -fPIE" )
174176if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang" ))
175177 set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections" )
176178endif ()
@@ -188,4 +190,6 @@ set (RUNTIME_SOURCE_ALL
188190 ${UNCOMMON_SHARED_SOURCE}
189191)
190192add_executable (iwasm ${RUNTIME_SOURCE_ALL} )
193+ check_pie_supported()
194+ set_target_properties (iwasm PROPERTIES POSITION_INDEPENDENT_CODE ON )
191195target_link_libraries (iwasm vmlib -lpthread -lm -ldl)
Original file line number Diff line number Diff line change 11# Copyright (C) 2019 Intel Corporation. All rights reserved.
22# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33
4- cmake_minimum_required (VERSION 2.8)
4+ cmake_minimum_required (VERSION 3.14)
5+
6+ include (CheckPIESupported)
7+
58project (spawn_thread)
69
710################ runtime settings ################
@@ -47,7 +50,6 @@ set(WAMR_BUILD_FAST_INTERP 1)
4750set (WAMR_BUILD_LIB_PTHREAD 1)
4851
4952# compiling and linking flags
50- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie -fPIE" )
5153if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang" ))
5254 set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections" )
5355endif ()
@@ -72,4 +74,6 @@ set (RUNTIME_SOURCE_ALL
7274 ${UNCOMMON_SHARED_SOURCE}
7375)
7476add_executable (spawn_thread ${RUNTIME_SOURCE_ALL} )
77+ check_pie_supported()
78+ set_target_properties (spawn_thread PROPERTIES POSITION_INDEPENDENT_CODE ON )
7579target_link_libraries (spawn_thread vmlib -lpthread -lm)
You can’t perform that action at this time.
0 commit comments