File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -130,13 +130,8 @@ python: python-probe ## build CPython probe
130130
131131
132132go-probe : # # build golang probe
133- ifeq ($(STATIC ) , TRUE)
134- mkdir -p golang/build && cd golang/build && \
135- CC=$(CC) CXX=$(CXX) CFLAGS="-static-pie" CXXFLAGS=-static-pie cmake .. && make
136- else
137133 mkdir -p golang/build && cd golang/build && \
138- CC=$(CC) CXX=$(CXX) cmake .. && make
139- endif
134+ CC=$(CC ) CXX=$(CXX ) cmake -DSTATIC_BUILD=$(STATIC ) .. && make
140135
141136
142137go : go-probe # # build go probe
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ set(CMAKE_CXX_STANDARD 14)
66include_directories (include )
77include_directories (${CMAKE_SOURCE_DIR } )
88
9+ option (STATIC_BUILD "enable static build" OFF )
10+
911set (CMAKE_POSITION_INDEPENDENT_CODE TRUE )
1012set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR } /bin)
1113
@@ -44,6 +46,6 @@ add_executable(go_probe main.cpp asm/inline_hook.cpp asm/api_hook.cpp futex/mute
4446 go/symbol/line_table.cpp go/symbol/func.cpp go/registry/api_registry.cpp
4547 go/api/workspace.cpp go/api/api.cpp go/stack/printf/printf.c )
4648
47- target_link_libraries (go_probe elfio Zydis nlohmann_json event_core_static event_pthreads_static )
48- target_link_libraries (go_loader elfio Zydis nlohmann_json event_core_static event_pthreads_static )
49- target_link_libraries (go_sample elfio Zydis nlohmann_json event_core_static event_pthreads_static ${ CMAKE_DL_LIBS } )
49+ target_link_libraries (go_sample elfio Zydis nlohmann_json event_core_static event_pthreads_static ${ CMAKE_DL_LIBS } )
50+ target_link_libraries (go_loader elfio Zydis nlohmann_json event_core_static event_pthreads_static $<$< BOOL : ${STATIC_BUILD} >:- static - pie > )
51+ target_link_libraries (go_probe elfio Zydis nlohmann_json event_core_static event_pthreads_static $<$< BOOL : ${STATIC_BUILD} >:- static - pie > )
Original file line number Diff line number Diff line change 11<!-- PROJECT LOGO -->
2- <br />
32<p align =" center " >
43 <h3 align =" center " >go-probe</h3 >
54
@@ -147,4 +146,5 @@ Project Link: [https://github.com/bytedance/Elkeid](https://github.com/bytedance
147146* [ zydis] ( https://github.com/zyantific/zydis )
148147* [ libevent] ( https://github.com/libevent/libevent )
149148* [ ELFIO] ( https://github.com/serge1/ELFIO )
150- * [ json] ( https://github.com/nlohmann/json )
149+ * [ json] ( https://github.com/nlohmann/json )
150+ * [ printf] ( https://github.com/mpaland/printf )
You can’t perform that action at this time.
0 commit comments