Tarantool development patches archive
 help / color / mirror / Atom feed
From: Timur Safin <tsafin@tarantool.org>
To: imun@tarantool.org
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [V2] luajit: pass properly compile options to LuaJIT for RelWithDebInfo
Date: Fri, 24 Jul 2020 16:37:39 +0300	[thread overview]
Message-ID: <c45c92732da64a6ef4bd84206f6e89aa7e3d31df.1595597785.git.tsafin@tarantool.org> (raw)

It was discovered the harder way (while debugging) that LuaJIT
sources do not generate line info debug information while we are
in any of optimized modes (e.g. RelWithDebInfo).

Simplistically we need to append `-g -ggdb` to optimization
flags in luajit_cflags, but that would be fragile in the longer
run. We need just to pass CMAKE_C_FLAGS_<UPPER-MODE> instead,
because it would contain -g -ggdb for RelWithDebInfo, iff
selected compiler support those options.

Closes #4827
---
 cmake/luajit.cmake | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/cmake/luajit.cmake b/cmake/luajit.cmake
index 555bc8371..76155c0c6 100644
--- a/cmake/luajit.cmake
+++ b/cmake/luajit.cmake
@@ -139,7 +139,9 @@ macro(luajit_build)
     # will most certainly wreak havok.
     #
     # This stuff is extremely fragile, proceed with caution.
-    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}})
     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
+    set (upper_build_type)
+    set (c_flags_init)
+
     if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
-        set (luajit_ccopt -O0)
-        if (CC_HAS_GGDB)
-            set (luajit_ccdebug -g -ggdb)
-        else ()
-            set (luajit_ccdebug -g)
-        endif ()
         add_definitions(-DLUA_USE_APICHECK=1)
         add_definitions(-DLUA_USE_ASSERT=1)
-    else ()
-        set (luajit_ccopt -O2)
-        set (luajit_ccdbebug "")
     endif()
     if (${CMAKE_SYSTEM_NAME} STREQUAL Darwin)
         # Pass sysroot - prepended in front of system header/lib dirs,
-- 
2.20.1

             reply	other threads:[~2020-07-24 13:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-24 13:37 Timur Safin [this message]
2020-07-28 14:03 ` Alexander Turenko
2020-08-06 14:41 ` Igor Munkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c45c92732da64a6ef4bd84206f6e89aa7e3d31df.1595597785.git.tsafin@tarantool.org \
    --to=tsafin@tarantool.org \
    --cc=imun@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [V2] luajit: pass properly compile options to LuaJIT for RelWithDebInfo' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox