mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-09 01:29:52 +00:00
Add first bits to cross-compile the runtime for OSX
Summary: Add first bits to cross-compile the runtime for OSX. (cherry picked from FBD24330977)
This commit is contained in:
parent
0b6df06e04
commit
bbd9d610fe
@ -30,3 +30,16 @@ target_include_directories(bolt_rt_hugify PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
install(TARGETS bolt_rt_instr DESTINATION lib)
|
||||
install(TARGETS bolt_rt_hugify DESTINATION lib)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
add_library(bolt_rt_instr_osx STATIC
|
||||
instr.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/config.h
|
||||
)
|
||||
target_include_directories(bolt_rt_instr_osx PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
target_compile_options(bolt_rt_instr_osx PRIVATE
|
||||
-target x86_64-apple-darwin19.6.0
|
||||
-ffreestanding
|
||||
-fno-exceptions
|
||||
-fno-rtti)
|
||||
install(TARGETS bolt_rt_instr_osx DESTINATION lib)
|
||||
endif()
|
||||
|
@ -1,5 +1,7 @@
|
||||
#if !defined(__APPLE__)
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_ELF_H
|
||||
@ -44,6 +46,8 @@
|
||||
"pop %%rbx\n" \
|
||||
"pop %%rax\n"
|
||||
|
||||
#if !defined(__APPLE__)
|
||||
|
||||
// Anonymous namespace covering everything but our library entry point
|
||||
namespace {
|
||||
|
||||
@ -327,3 +331,5 @@ inline uint64_t alignTo(uint64_t Value, uint64_t Align) {
|
||||
return (Value + Align - 1) / Align * Align;
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
#endif
|
||||
|
@ -9,6 +9,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if !defined(__APPLE__)
|
||||
|
||||
#include "common.h"
|
||||
#include <sys/mman.h>
|
||||
|
||||
@ -172,3 +174,5 @@ extern "C" __attribute((naked)) void __bolt_hugify_self() {
|
||||
"jmp *__bolt_hugify_init_ptr(%%rip)\n"
|
||||
:::);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -57,6 +57,8 @@
|
||||
{}
|
||||
#endif
|
||||
|
||||
#if !defined(__APPLE__)
|
||||
|
||||
// Main counters inserted by instrumentation, incremented during runtime when
|
||||
// points of interest (locations) in the program are reached. Those are direct
|
||||
// calls and direct and indirect branches (local ones). There are also counters
|
||||
@ -1460,3 +1462,11 @@ extern "C" void __bolt_instr_fini() {
|
||||
__bolt_instr_data_dump();
|
||||
DEBUG(report("Finished.\n"));
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// On OSX/iOS the final symbol name of an extern "C" function/variable contains
|
||||
// one extra leading underscore: _bolt_instr_setup -> __bolt_instr_setup.
|
||||
extern "C" __attribute((section("__TEXT,__setup"))) void _bolt_instr_setup() {}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user