Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Antler run removal #237

Merged
merged 15 commits into from
Oct 5, 2023
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
5 changes: 1 addition & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
[submodule "libraries/native/softfloat"]
path = libraries/native/softfloat
url = https://github.com/AntelopeIO/berkeley-softfloat-3
[submodule "tools/external/eos-vm"]
path = tools/external/eos-vm
url = https://github.com/AntelopeIO/eos-vm
[submodule "tools/external/antler-proj"]
path = tools/external/antler-proj
url = https://github.com/AntelopeIO/antler-proj
url = https://github.com/AntelopeIO/antler-proj
95 changes: 36 additions & 59 deletions libraries/eosiolib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,72 +1,49 @@
set(PARENT_PROJECT_NAME ${PROJECT_NAME})

file(GLOB HEADERS "*.hpp"
"*.h")

if (${PARENT_PROJECT_NAME} STREQUAL "cdt_tools")
project(native_eosio)
add_library( ${PROJECT_NAME}
eosiolib.cpp
crypto.cpp
malloc.cpp
${HEADERS} )
target_compile_definitions(${PROJECT_NAME} PUBLIC EOSIO_NATIVE EOSIOLIB_DISABLE_MALLOC)
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_SOURCE_DIR}/../libraries/eosiolib/core
${CMAKE_SOURCE_DIR}/../libraries/meta_refl/include)
target_compile_options(${PROJECT_NAME} PUBLIC -fPIC -fexceptions -fno-rtti)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "12.0")
target_compile_options(${PROJECT_NAME} PUBLIC -Wno-attributes)
else()
target_compile_options(${PROJECT_NAME} PUBLIC -Wno-attributes=gnu::eosio_wasm_import)
target_compile_options(${PROJECT_NAME} PUBLIC -Wno-attributes=eosio::ignore)
endif()
endif()
else()
add_library(eosio
eosiolib.cpp
crypto.cpp
${HEADERS})
add_library(eosio
eosiolib.cpp
crypto.cpp
${HEADERS})

add_library(eosio_malloc
malloc.cpp
${HEADERS})
add_library(eosio_malloc
malloc.cpp
${HEADERS})

add_library(eosio_dsm
simple_malloc.cpp
${HEADERS})
add_library(eosio_dsm
simple_malloc.cpp
${HEADERS})

add_library(eosio_cmem
memory.cpp
${HEADERS})
add_library(eosio_cmem
memory.cpp
${HEADERS})


set_target_properties(eosio_malloc PROPERTIES LINKER_LANGUAGE C)
set_target_properties(eosio_malloc PROPERTIES LINKER_LANGUAGE C)

target_include_directories(eosio PUBLIC
${CMAKE_SOURCE_DIR}/libc/cdt-musl/include
${CMAKE_SOURCE_DIR}/libc/cdt-musl/src/internal
${CMAKE_SOURCE_DIR}/libc/cdt-musl/src/crypt
${CMAKE_SOURCE_DIR}/libc/cdt-musl/arch/eos
${CMAKE_SOURCE_DIR}/libc++/cdt-libcxx/include
${CMAKE_SOURCE_DIR})
target_include_directories(eosio PUBLIC
${CMAKE_SOURCE_DIR}/libc/cdt-musl/include
${CMAKE_SOURCE_DIR}/libc/cdt-musl/src/internal
${CMAKE_SOURCE_DIR}/libc/cdt-musl/src/crypt
${CMAKE_SOURCE_DIR}/libc/cdt-musl/arch/eos
${CMAKE_SOURCE_DIR}/libc++/cdt-libcxx/include
${CMAKE_SOURCE_DIR})

target_link_libraries( eosio c c++ )
add_custom_command( TARGET eosio POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:eosio> ${BASE_BINARY_DIR}/lib )
add_custom_command( TARGET eosio_malloc POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:eosio_malloc> ${BASE_BINARY_DIR}/lib )
add_custom_command( TARGET eosio_dsm POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:eosio_dsm> ${BASE_BINARY_DIR}/lib )
add_custom_command( TARGET eosio_cmem POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:eosio_cmem> ${BASE_BINARY_DIR}/lib )
target_link_libraries( eosio c c++ )
add_custom_command( TARGET eosio POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:eosio> ${BASE_BINARY_DIR}/lib )
add_custom_command( TARGET eosio_malloc POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:eosio_malloc> ${BASE_BINARY_DIR}/lib )
add_custom_command( TARGET eosio_dsm POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:eosio_dsm> ${BASE_BINARY_DIR}/lib )
add_custom_command( TARGET eosio_cmem POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:eosio_cmem> ${BASE_BINARY_DIR}/lib )

if (ENABLE_NATIVE_COMPILER)
add_native_library(native_eosio
eosiolib.cpp
crypto.cpp
malloc.cpp
${HEADERS})
if (ENABLE_NATIVE_COMPILER)
add_native_library(native_eosio
eosiolib.cpp
crypto.cpp
malloc.cpp
${HEADERS})

add_dependencies( native_eosio eosio )
add_custom_command( TARGET native_eosio POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:native_eosio> ${BASE_BINARY_DIR}/lib )
endif()
add_dependencies( native_eosio eosio )
add_custom_command( TARGET native_eosio POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:native_eosio> ${BASE_BINARY_DIR}/lib )
endif()

file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../eosiolib DESTINATION ${BASE_BINARY_DIR}/include FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp")
endif()
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../eosiolib DESTINATION ${BASE_BINARY_DIR}/include FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp")
2 changes: 0 additions & 2 deletions libraries/eosiolib/capi/eosio/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#pragma once

#include "types.h"
#include "eosio/types.hpp"

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
14 changes: 2 additions & 12 deletions libraries/eosiolib/capi/eosio/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,15 @@ typedef uint64_t capi_name;
/**
* EOSIO Public Key. K1 and R1 keys are 34 bytes. Newer keys can be variable-sized
*/
struct
#ifdef __GNUC__
__attribute__((deprecated("newer public key types cannot be represented as a fixed size structure, use char[] instead")))
#else
__attribute__((deprecated("newer public key types cannot be represented as a fixed size structure", "char[]")))
#endif
struct __attribute__((deprecated("newer public key types cannot be represented as a fixed size structure", "char[]")))
capi_public_key {
char data[34];
};

/**
* EOSIO Signature. K1 and R1 signatures are 66 bytes. Newer signatures can be variable-sized
*/
struct
#ifdef __GNUC__
__attribute__((deprecated("newer public key types cannot be represented as a fixed size structure, use char[] instead")))
#else
__attribute__((deprecated("newer public key types cannot be represented as a fixed size structure", "char[]")))
#endif
struct __attribute__((deprecated("newer signature types cannot be represented as a fixed size structure", "char[]")))
capi_signature {
uint8_t data[66];
};
Expand Down
4 changes: 2 additions & 2 deletions libraries/eosiolib/contracts/eosio/action.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,12 @@ namespace eosio {
/**
* Name of the account the action is intended for
*/
eosio::name account;
name account;

/**
* Name of the action
*/
eosio::name name;
name name;

/**
* List of permissions that authorize this action
Expand Down
2 changes: 1 addition & 1 deletion libraries/eosiolib/core/eosio/datastream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <optional>
#include <variant>

#include <cstring>
#include <string.h>

namespace eosio {

Expand Down
1 change: 0 additions & 1 deletion libraries/eosiolib/core/eosio/fixed_bytes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/
#pragma once
#include "datastream.hpp"
#include "types.hpp"

#include <array>
#include <algorithm>
Expand Down
2 changes: 1 addition & 1 deletion libraries/eosiolib/core/eosio/print.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#pragma once
#include <utility>
#include <string>
#include "types.hpp"



namespace eosio {
Expand Down
2 changes: 1 addition & 1 deletion libraries/eosiolib/core/eosio/reflect.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
#include <bluegrass/meta/refl.hpp>

#define CDT_REFLECT(...) \
BLUEGRASS_META_REFL(__VA_ARGS__);
BLUEGRASS_META_REFL(__VA_ARGS__); \
10 changes: 0 additions & 10 deletions libraries/eosiolib/core/eosio/types.hpp

This file was deleted.

4 changes: 0 additions & 4 deletions libraries/eosiolib/malloc.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <cstdlib>
#include <alloca.h>
#include <string.h>
#include "core/eosio/check.hpp"
#include "core/eosio/print.hpp"

Expand Down Expand Up @@ -526,8 +525,6 @@ namespace eosio {
} /// namespace eosio

extern "C" {
#ifndef EOSIOLIB_DISABLE_MALLOC

void* malloc(size_t size) {
return eosio::memory_heap.malloc(size);
}
Expand All @@ -545,6 +542,5 @@ void* realloc(void* ptr, size_t size) {
void free(void* ptr) {
return eosio::memory_heap.free(ptr);
}
#endif
}

Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#define BLUEGRASS_HAS_TEMPLATE_MEMBER(ARG, NAME) \
bluegrass::meta::overloaded { \
[](auto&& f, std::enable_if_t<std::is_class_v<std::decay_t<decltype(f)>> && \
[&](auto&& f, std::enable_if_t<std::is_class_v<std::decay_t<decltype(f)>> && \
bluegrass::meta::detail::pass_type< \
decltype(&std::decay_t<decltype(f)>::type::template NAME)>(), int> = 0) constexpr { \
return true; \
Expand Down
32 changes: 7 additions & 25 deletions libraries/native/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
set(PARENT_PROJECT_NAME ${PROJECT_NAME})

project(native LANGUAGES CXX ASM)

if (NOT __APPLE)
Expand All @@ -8,10 +6,8 @@ else()
set(CRT_ASM macho_crt.s)
endif()

if (NOT ${PARENT_PROJECT_NAME} MATCHES "cdt_tools")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-everything -allow-sse")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-everything -allow-sse")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-everything -allow-sse")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-everything -allow-sse")

file(GLOB HEADERS "*.hpp"
"*.h")
Expand Down Expand Up @@ -336,29 +332,15 @@ list( APPEND softfloat_sources ${softfloat_headers} )
add_library ( sf STATIC ${softfloat_sources} )
target_include_directories( sf PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/softfloat/source/include" "${CMAKE_CURRENT_SOURCE_DIR}/softfloat/source/8086-SSE" "${CMAKE_CURRENT_SOURCE_DIR}/softfloat/build/Linux-x86_64-GCC" ${CMAKE_SOURCE_DIR})

if (${PARENT_PROJECT_NAME} STREQUAL "cdt_tools")
add_library(${PROJECT_NAME} STATIC ${softfloat_sources} intrinsics.cpp crt_lib.cpp)

target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_SOURCE_DIR}/../libraries/eosiolib/core
${CMAKE_SOURCE_DIR}/../libraries/eosiolib/contracts
${CMAKE_SOURCE_DIR}/../libraries/eosiolib/capi
${CMAKE_SOURCE_DIR}/../libraries/meta_refl/include)
# suppress executable stack warning. this is due to absence of .note.GNU-stack
target_link_libraries(${PROJECT_NAME} PUBLIC "-Wl,-z,noexecstack")
else()
add_native_library ( native STATIC ${softfloat_sources} intrinsics.cpp crt.cpp ${CRT_ASM})
endif()

add_native_library ( native STATIC ${softfloat_sources} intrinsics.cpp crt.cpp ${CRT_ASM} )
target_include_directories( native PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/softfloat/source/include" "${CMAKE_CURRENT_SOURCE_DIR}/softfloat/source/8086-SSE" "${CMAKE_CURRENT_SOURCE_DIR}/softfloat/build/Linux-x86_64-GCC" ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/eosiolib/capi ${CMAKE_SOURCE_DIR}/eosiolib/contracts ${CMAKE_SOURCE_DIR}/eosiolib/core)

add_dependencies(native native_eosio)

if (NOT ${PARENT_PROJECT_NAME} MATCHES "cdt_tools")
add_custom_command( TARGET native POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:native> ${BASE_BINARY_DIR}/lib )
add_custom_command( TARGET native POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:native> ${BASE_BINARY_DIR}/lib )

add_custom_command( TARGET sf POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:sf> ${BASE_BINARY_DIR}/lib )
add_custom_command( TARGET sf POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:sf> ${BASE_BINARY_DIR}/lib )

file(COPY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION ${BASE_BINARY_DIR}/include/eosio FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp" PATTERN "softfloat" EXCLUDE)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION ${BASE_BINARY_DIR}/include/eosio FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp" PATTERN "softfloat" EXCLUDE)

file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/native DESTINATION ${BASE_BINARY_DIR}/include/eosiolib FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp" PATTERN "softfloat" EXCLUDE)
endif()
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/native DESTINATION ${BASE_BINARY_DIR}/include/eosiolib FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp" PATTERN "softfloat" EXCLUDE)
3 changes: 0 additions & 3 deletions libraries/native/crt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ extern "C" {
}
}

jmp_buf* __get_jmp_buf() {
return ___env_ptr;
}
void __set_env_test() {
___env_ptr = &test_env;
}
Expand Down
45 changes: 0 additions & 45 deletions libraries/native/crt_lib.cpp

This file was deleted.

10 changes: 2 additions & 8 deletions libraries/native/native/eosio/crt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <string>

namespace eosio { namespace cdt {

enum output_stream_kind {
std_out,
std_err,
Expand All @@ -26,15 +25,10 @@ namespace eosio { namespace cdt {

extern eosio::cdt::output_stream std_out;
extern eosio::cdt::output_stream std_err;
extern "C" jmp_buf* ___env_ptr;
extern "C" char* ___heap_ptr;

extern "C" {
extern jmp_buf* ___env_ptr;
extern char* ___heap_ptr;
extern bool ___disable_output;
extern bool ___has_failed;
extern bool ___earlier_unit_test_has_failed;

jmp_buf* __get_jmp_buf();
void __set_env_test();
void __reset_env();
void _prints_l(const char* cstr, uint32_t len, uint8_t which);
Expand Down
Loading