From: Jacob Lifshay Date: Fri, 8 Sep 2017 14:03:46 +0000 (-0700) Subject: fix building on arm X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2fb9f91ceebadfddd30b3c438252f1c7feeb106b;p=kazan.git fix building on arm --- diff --git a/src/demo/demo.cpp b/src/demo/demo.cpp index 151e9cd..cedf227 100644 --- a/src/demo/demo.cpp +++ b/src/demo/demo.cpp @@ -489,7 +489,7 @@ std::vector load_wavefront_obj_file(const char *filename) { std::size_t vertex_count = vertexes.size(); std::int64_t max_index = vertex_count; - std::int64_t min_index = -vertex_count; + std::int64_t min_index = -max_index; auto vertex_index = parse_signed_integer(vertex_index_str, max_index, min_index); if(!vertex_index || *vertex_index == 0) diff --git a/src/spirv_to_llvm/spirv_to_llvm.cpp b/src/spirv_to_llvm/spirv_to_llvm.cpp index aae4b04..4864bdd 100644 --- a/src/spirv_to_llvm/spirv_to_llvm.cpp +++ b/src/spirv_to_llvm/spirv_to_llvm.cpp @@ -496,6 +496,33 @@ void Spirv_to_llvm::handle_header(unsigned version_number_major, id_states.resize(id_bound - 1); } } + +namespace +{ +#define DECLARE_LIBRARY_SYMBOL(name) \ + static void library_symbol_##name() __attribute__((weakref(#name))); +#ifdef __ARM_EABI__ +DECLARE_LIBRARY_SYMBOL(__aeabi_unwind_cpp_pr0) +#endif +} + +Jit_symbol_resolver::Resolved_symbol Jit_symbol_resolver::resolve(util::string_view name) +{ +#define RESOLVE_LIBRARY_SYMBOL(symbol_name) \ + if(#symbol_name == name) \ + { \ + if(library_symbol_##symbol_name == nullptr) \ + throw std::runtime_error( \ + "JIT symbol resolve error: library symbol not linked: " #symbol_name); \ + return library_symbol_##symbol_name; \ + } + +#ifdef __ARM_EABI__ + RESOLVE_LIBRARY_SYMBOL(__aeabi_unwind_cpp_pr0) +#endif +#warning finish implementing + return nullptr; +} } spirv_to_llvm::Converted_module spirv_to_llvm::spirv_to_llvm( diff --git a/src/spirv_to_llvm/spirv_to_llvm.h b/src/spirv_to_llvm/spirv_to_llvm.h index d7e312a..45c2b58 100644 --- a/src/spirv_to_llvm/spirv_to_llvm.h +++ b/src/spirv_to_llvm/spirv_to_llvm.h @@ -591,11 +591,7 @@ struct Converted_module struct Jit_symbol_resolver { typedef void (*Resolved_symbol)(); - Resolved_symbol resolve(util::string_view name) - { -#warning finish implementing - return nullptr; - } + Resolved_symbol resolve(util::string_view name); static std::uint64_t resolve(const char *name, void *user_data) noexcept { return reinterpret_cast(