From: Sergey Bronnikov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Kaplun <skaplun@tarantool.org>
Cc: Sergey Bronnikov <estetus@gmail.com>,
tarantool-patches@dev.tarantool.org, max.kokryashkin@gmail.com
Subject: Re: [Tarantool-patches] [PATCH luajit] Fix C file generation in jit.bcsave.
Date: Wed, 8 Nov 2023 00:19:36 +0300 [thread overview]
Message-ID: <ea9f12df-5f05-464f-a936-9bfc70edcd68@tarantool.org> (raw)
In-Reply-To: <ZUD_bhh-8x_8_9Gm@root>
[-- Attachment #1: Type: text/plain, Size: 3395 bytes --]
Hello, Sergey
On 10/31/23 16:21, Sergey Kaplun wrote:
<snipped>
>> --- a/test/tarantool-tests/lj-551-bytecode-c-broken-macro/CMakeLists.txt
>> +++ b/test/tarantool-tests/lj-551-bytecode-c-broken-macro/CMakeLists.txt
>> @@ -1,5 +1,6 @@
>> set(LIB_NAME "bcsaved_clib") -set(LUA_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${LIB_NAME}.lua)
>> +set(LUA_FILE_ORIG ${CMAKE_CURRENT_SOURCE_DIR}/bcsaved.lua)
>> +set(LUA_FILE ${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}.lua)
>> set(C_FILE ${LIB_NAME}.c) make_lua_path(LUA_PATH @@ -8,11 +9,24 @@
>> make_lua_path(LUA_PATH ${PROJECT_SOURCE_DIR}/src/jit/?.lua )
>> +add_custom_target(copy_lua + COMMAND ${CMAKE_COMMAND} -E + copy
>> + ${LUA_FILE_ORIG} + ${LUA_FILE} + DEPENDS
>> ${LUA_FILE_ORIG} + BYPRODUCTS ${LUA_FILE} + COMMENT "Copying Lua module"
>> + VERBATIM
>> +)
>> +
>> add_custom_target(export_bc
>> COMMAND ${CMAKE_COMMAND} -E
>> env
>> LUA_PATH=${LUA_PATH}
>> ${LUAJIT_BINARY} -b ${LUA_FILE} ${C_FILE}
>> + COMMAND ${CMAKE_COMMAND} -E
>> + remove ${LUA_FILE}
>> DEPENDS luajit-main ${LUA_FILE}
>> BYPRODUCTS ${C_FILE}
>> COMMENT "Exporting bytecode to a C file"
> The test still doesn't fail before the commit.
> The reason is that the C file is compiled by C compiler, not the C++
> compiler (so this macro is irrelevant).
Fixed, thanks.
>
> I suppose that we should add a .cpp file for the test too (and add the
> LINKER_LANGUAGE CXX [1] property for this target if its necessary).
Unfortunately, setting property with LINKER_LANGUAGE is not enough.
Additionally one need setting CXX language for a project or enable CXX
in required CMakeLists.txt
and it is better to have .cc extension for a file too. Otherwise CMake
fails to build a file by CXX compiler.
I believe you will not against to backporting
e826d0c101d750fac8334d71e221c50d8dbe236c ("Add 'cc' file type for saving
bytecode.")
as well because commit enables saving bc to .cc file directly.
Final patch:
diff --git
a/test/tarantool-tests/lj-551-bytecode-c-broken-macro/CMakeLists.txt
b/test/tarantool-tests/lj-551-bytecode-c-broken-macro/CMakeLists.txt
index 45857386..1baf6ec8 100644
--- a/test/tarantool-tests/lj-551-bytecode-c-broken-macro/CMakeLists.txt
+++ b/test/tarantool-tests/lj-551-bytecode-c-broken-macro/CMakeLists.txt
@@ -1,7 +1,9 @@
+enable_language(CXX)
+
set(LIB_NAME "bcsaved_clib")
set(LUA_FILE_ORIG ${CMAKE_CURRENT_SOURCE_DIR}/bcsaved.lua)
set(LUA_FILE ${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}.lua)
-set(C_FILE ${LIB_NAME}.c)
+set(CXX_FILE ${LIB_NAME}.cc)
make_lua_path(LUA_PATH
PATHS
@@ -24,14 +26,14 @@ add_custom_target(export_bc
COMMAND ${CMAKE_COMMAND} -E
env
LUA_PATH=${LUA_PATH}
- ${LUAJIT_BINARY} -b ${LUA_FILE} ${C_FILE}
+ ${LUAJIT_BINARY} -b ${LUA_FILE} ${CXX_FILE}
COMMAND ${CMAKE_COMMAND} -E
remove ${LUA_FILE}
DEPENDS luajit-main ${LUA_FILE}
- BYPRODUCTS ${C_FILE}
+ BYPRODUCTS ${CXX_FILE}
- COMMENT "Exporting bytecode to a C file"
+ COMMENT "Exporting bytecode to a CXX file"
VERBATIM
)
-BuildTestCLib(${LIB_NAME} ${C_FILE})
+BuildTestCLib(${LIB_NAME} ${CXX_FILE})
add_dependencies(${LIB_NAME} export_bc)
>
> [1]:https://cmake.org/cmake/help/latest/prop_tgt/LINKER_LANGUAGE.html#linker-language
>
[-- Attachment #2: Type: text/html, Size: 5231 bytes --]
next prev parent reply other threads:[~2023-11-07 21:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-19 8:56 Sergey Bronnikov via Tarantool-patches
2023-10-23 11:12 ` Sergey Kaplun via Tarantool-patches
2023-10-31 9:57 ` Sergey Bronnikov via Tarantool-patches
2023-10-31 13:21 ` Sergey Kaplun via Tarantool-patches
2023-11-07 21:19 ` Sergey Bronnikov via Tarantool-patches [this message]
2023-11-08 8:48 ` Sergey Kaplun via Tarantool-patches
2024-03-20 15:07 ` Sergey Kaplun via Tarantool-patches
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=ea9f12df-5f05-464f-a936-9bfc70edcd68@tarantool.org \
--to=tarantool-patches@dev.tarantool.org \
--cc=estetus@gmail.com \
--cc=max.kokryashkin@gmail.com \
--cc=sergeyb@tarantool.org \
--cc=skaplun@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH luajit] Fix C file generation in jit.bcsave.' \
/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