From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp56.i.mail.ru (smtp56.i.mail.ru [217.69.128.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 1DA8E445320 for ; Tue, 28 Jul 2020 17:04:47 +0300 (MSK) Date: Tue, 28 Jul 2020 17:03:51 +0300 From: Alexander Turenko Message-ID: <20200728140351.gsnacxegpt22c2wq@tkn_work_nb> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Subject: Re: [Tarantool-patches] [V2] luajit: pass properly compile options to LuaJIT for RelWithDebInfo List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Timur Safin Cc: tarantool-patches@dev.tarantool.org > - set (luajit_cflags ${CMAKE_C_FLAGS}) > + string (TOUPPER ${CMAKE_BUILD_TYPE} upper_build_type) > + set (c_flags_init "CMAKE_C_FLAGS_${upper_build_type}") > + set (luajit_cflags ${${c_flags_init}}) Debug: -- CMAKE_C_FLAGS: -fexceptions -funwind-tables -fno-omit-frame-pointer -fno-stack-protector -fno-common -fopenmp -msse2 -- CMAKE_C_FLAGS_DEBUG: -g -ggdb -O0 RelWithDebInfo: -- CMAKE_C_FLAGS: -fexceptions -funwind-tables -fno-omit-frame-pointer -fno-stack-protector -fno-common -fopenmp -msse2 -- CMAKE_C_FLAGS_RELWITHDEBINFO: -O2 -g -DNDEBUG -ggdb -O2 So all those -fno-omit-frame-pointer was applied to luajit and we should proceed with each such option very carefully. For example, cite from cmake/compiler.cmake: | # | # Set flags for all include files: those maintained by us and | # coming from third parties. | # Since we began using luajit, which uses gcc stack unwind | # internally, we also need to make sure all code is compiled | # with unwind info. | # | | add_compile_flags("C;CXX" "-fexceptions" "-funwind-tables") | | # We must set -fno-omit-frame-pointer here, since we rely | # on frame pointer when getting a backtrace, and it must | # be used consistently across all object files. | # The same reasoning applies to -fno-stack-protector switch. | | if (ENABLE_BACKTRACE) | add_compile_flags("C;CXX" | "-fno-omit-frame-pointer" | "-fno-stack-protector") | endif() I would be okay to just enable '-g -ggdb' without changing base flags from CMAKE_C_FLAGS to CMAKE_C_FLAGS_{DEBUG,RELWITHDEBINFO}, but see below. > set (luajit_ldflags ${CMAKE_EXE_LINKER_FLAGS}) > separate_arguments(luajit_cflags) > separate_arguments(luajit_ldflags) > @@ -168,19 +170,12 @@ macro(luajit_build) > "-pagezero_size 10000 -image_base 100000000") > endif() > > - # We are consciously ommiting debug info in RelWithDebInfo mode So there was a reason. I don't know it, but we should know if we want to change it. Can it be related to performance? I would ask Nick Zavaritsky if you really want to know. I searched over commits and discussions that may be relevant, but didn't found anything. I asked about this in [1]. [1]: https://github.com/tarantool/tarantool/issues/4827#issuecomment-665059210 WBR, Alexander Turenko.