Skip to content

Commit 5f009a1

Browse files
committed
build: provide LUAJIT_USE_PERFTOOLS option
This patch provides the LUAJIT_USE_PERFTOOLS flag via the CMake build system. It allows avoiding the definition of the cognominal macro definition via CMAKE_C_FLAGS to use integration with the Linux perf tools interface [1] to resolve symbols for traces generated by a JIT. It may be used like the following: | perf script record luajit test.lua | perf report -s symbol [1]: https://github.com/torvalds/linux/blob/master/tools/perf/Documentation/jit-interface.txt Resolves tarantool/tarantool#11300 Reviewed-by: Sergey Bronnikov <[email protected]> Signed-off-by: Sergey Kaplun <[email protected]> (cherry picked from commit ecc260c)
1 parent 8915fd6 commit 5f009a1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,14 @@ if(LUAJIT_USE_VALGRIND)
241241
AppendFlags(TARGET_C_FLAGS -DLUAJIT_USE_VALGRIND)
242242
endif()
243243

244+
# This creates a symbol table of the JIT-compiled code in
245+
# a </tmp/perf-%d.map> (%d = pid of process) file. It should be
246+
# used with Linux perf tools. See <src/lj_trace.c> for details.
247+
option(LUAJIT_USE_PERFTOOLS "Linux perf JIT support" OFF)
248+
if(LUAJIT_USE_PERFTOOLS)
249+
AppendFlags(TARGET_C_FLAGS -DLUAJIT_USE_PERFTOOLS)
250+
endif()
251+
244252
# This is the client for the GDB JIT API. GDB 7.0 or higher is
245253
# required to make use of it. See lj_gdbjit.c for details.
246254
# Enabling this causes a non-negligible overhead, even when not

0 commit comments

Comments
 (0)