|
1 |
| -add_library(AddressInterceptPass MODULE |
2 |
| - # List your source files here. |
3 |
| - AddressIntercept.cpp |
4 |
| - AllocaRecognize |
5 |
| - MemoryOperationRecognize |
6 |
| - InlineInstrumentation |
7 |
| - Logger |
8 |
| -) |
9 |
| - |
10 |
| -# Use C++11 to compile your pass (i.e., supply -std=c++11). |
11 |
| -target_compile_features(AddressInterceptPass PRIVATE cxx_range_for cxx_auto_type) |
12 |
| - |
13 |
| -# LLVM is (typically) built with no C++ RTTI. We need to match that; |
14 |
| -# otherwise, we'll get linker errors about missing RTTI data. |
15 |
| -set_target_properties(AddressInterceptPass PROPERTIES |
16 |
| - COMPILE_FLAGS "-fno-rtti" |
17 |
| -) |
18 |
| - |
19 |
| -# Get proper shared-library behavior (where symbols are not necessarily |
20 |
| -# resolved when the shared library is linked) on OS X. |
21 |
| -if(APPLE) |
| 1 | +if(NOT DEFINED ENV{YOUR_LLVM_PATH}) |
| 2 | + |
| 3 | + add_llvm_library( LLVMAddressInterceptor |
| 4 | + # List your source files here. |
| 5 | + AddressIntercept.cpp |
| 6 | + AllocaRecognize.cpp |
| 7 | + MemoryOperationRecognize.cpp |
| 8 | + InlineInstrumentation.cpp |
| 9 | + Logger.cpp |
| 10 | + |
| 11 | + ADDITIONAL_HEADER_DIRS |
| 12 | + ${LLVM_MAIN_INCLUDE_DIR}/llvm/Transforms |
| 13 | + |
| 14 | + DEPENDS |
| 15 | + intrinsics_gen |
| 16 | + ) |
| 17 | + |
| 18 | +else () |
| 19 | + |
| 20 | + add_library(AddressInterceptPass MODULE |
| 21 | + # List your source files here. |
| 22 | + AddressIntercept.cpp |
| 23 | + AllocaRecognize |
| 24 | + MemoryOperationRecognize |
| 25 | + InlineInstrumentation |
| 26 | + Logger |
| 27 | + ) |
| 28 | + |
| 29 | + add_definitions(-DADIN_LOAD_MODULE) |
| 30 | + |
| 31 | + # Use C++11 to compile your pass (i.e., supply -std=c++11). |
| 32 | + target_compile_features(AddressInterceptPass PRIVATE cxx_range_for cxx_auto_type) |
| 33 | + |
| 34 | + # LLVM is (typically) built with no C++ RTTI. We need to match that; |
| 35 | + # otherwise, we'll get linker errors about missing RTTI data. |
22 | 36 | set_target_properties(AddressInterceptPass PROPERTIES
|
23 |
| - LINK_FLAGS "-undefined dynamic_lookup" |
| 37 | + COMPILE_FLAGS "-fno-rtti" |
24 | 38 | )
|
25 |
| -endif(APPLE) |
| 39 | + |
| 40 | + # Get proper shared-library behavior (where symbols are not necessarily |
| 41 | + # resolved when the shared library is linked) on OS X. |
| 42 | + if(APPLE) |
| 43 | + set_target_properties(AddressInterceptPass PROPERTIES |
| 44 | + LINK_FLAGS "-undefined dynamic_lookup" |
| 45 | + ) |
| 46 | + endif(APPLE) |
| 47 | + |
| 48 | +endif() |
0 commit comments