From 28a9fde5b1c60f793a1ecde186a68f61564a0145 Mon Sep 17 00:00:00 2001 From: Matt Witherspoon <32485495+spoonincode@users.noreply.github.com> Date: Tue, 1 Oct 2019 20:38:30 -0400 Subject: [PATCH 1/2] get the linker order right for eosio tester cmakes --- CMakeModules/EosioTester.cmake.in | 4 +++- CMakeModules/EosioTesterBuild.cmake.in | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeModules/EosioTester.cmake.in b/CMakeModules/EosioTester.cmake.in index f0e45ee5c4a..dc9242dcdc6 100644 --- a/CMakeModules/EosioTester.cmake.in +++ b/CMakeModules/EosioTester.cmake.in @@ -79,7 +79,6 @@ find_library(GMP_LIBRARIES NAMES libgmp.a gmp.lib gmp libgmp-10 mpir macro(add_eosio_test_executable test_name) add_executable( ${test_name} ${ARGN} ) target_link_libraries( ${test_name} - ${LLVM_LIBS} ${libtester} ${libchain} ${libfc} @@ -103,6 +102,9 @@ macro(add_eosio_test_executable test_name) ${Boost_CHRONO_LIBRARY} ${Boost_IOSTREAMS_LIBRARY} ${Boost_DATE_TIME_LIBRARY} + + ${LLVM_LIBS} + ${PLATFORM_SPECIFIC_LIBS} ) diff --git a/CMakeModules/EosioTesterBuild.cmake.in b/CMakeModules/EosioTesterBuild.cmake.in index 954b0cd645d..390f9e5e6b9 100644 --- a/CMakeModules/EosioTesterBuild.cmake.in +++ b/CMakeModules/EosioTesterBuild.cmake.in @@ -78,7 +78,6 @@ find_library(GMP_LIBRARIES NAMES libgmp.a gmp.lib gmp libgmp-10 mpir macro(add_eosio_test_executable test_name) add_executable( ${test_name} ${ARGN} ) target_link_libraries( ${test_name} - ${LLVM_LIBS} ${libtester} ${libchain} ${libfc} @@ -102,6 +101,9 @@ macro(add_eosio_test_executable test_name) ${Boost_CHRONO_LIBRARY} ${Boost_IOSTREAMS_LIBRARY} ${Boost_DATE_TIME_LIBRARY} + + ${LLVM_LIBS} + ${PLATFORM_SPECIFIC_LIBS} ) From a59995d70772db04a7e8ab1f6c686baa424870a4 Mon Sep 17 00:00:00 2001 From: Matt Witherspoon <32485495+spoonincode@users.noreply.github.com> Date: Tue, 1 Oct 2019 20:43:16 -0400 Subject: [PATCH 2/2] when linking with a libchain containing EOS-VM OC, need to wrap main --- CMakeModules/EosioTester.cmake.in | 7 +++++++ CMakeModules/EosioTesterBuild.cmake.in | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/CMakeModules/EosioTester.cmake.in b/CMakeModules/EosioTester.cmake.in index dc9242dcdc6..b43f3740d78 100644 --- a/CMakeModules/EosioTester.cmake.in +++ b/CMakeModules/EosioTester.cmake.in @@ -76,6 +76,11 @@ find_library(GMP_LIBRARIES NAMES libgmp.a gmp.lib gmp libgmp-10 mpir DOC "Path to the GMP library" ) +set(EOSIO_WASM_RUNTIMES @EOSIO_WASM_RUNTIMES@) +if("eos-vm-oc" IN_LIST EOSIO_WASM_RUNTIMES) + set(WRAP_MAIN "-Wl,-wrap=main") +endif() + macro(add_eosio_test_executable test_name) add_executable( ${test_name} ${ARGN} ) target_link_libraries( ${test_name} @@ -106,6 +111,8 @@ macro(add_eosio_test_executable test_name) ${LLVM_LIBS} ${PLATFORM_SPECIFIC_LIBS} + + ${WRAP_MAIN} ) target_include_directories( ${test_name} PUBLIC diff --git a/CMakeModules/EosioTesterBuild.cmake.in b/CMakeModules/EosioTesterBuild.cmake.in index 390f9e5e6b9..54d5a3d7a8d 100644 --- a/CMakeModules/EosioTesterBuild.cmake.in +++ b/CMakeModules/EosioTesterBuild.cmake.in @@ -75,6 +75,11 @@ find_library(GMP_LIBRARIES NAMES libgmp.a gmp.lib gmp libgmp-10 mpir DOC "Path to the GMP library" ) +set(EOSIO_WASM_RUNTIMES @EOSIO_WASM_RUNTIMES@) +if("eos-vm-oc" IN_LIST EOSIO_WASM_RUNTIMES) + set(WRAP_MAIN "-Wl,-wrap=main") +endif() + macro(add_eosio_test_executable test_name) add_executable( ${test_name} ${ARGN} ) target_link_libraries( ${test_name} @@ -105,6 +110,8 @@ macro(add_eosio_test_executable test_name) ${LLVM_LIBS} ${PLATFORM_SPECIFIC_LIBS} + + ${WRAP_MAIN} ) target_include_directories( ${test_name} PUBLIC