From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 63DD0189E01; Mon, 5 Dec 2022 19:06:58 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 63DD0189E01 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1670256418; bh=ugZz/jGs+02nyEVUcnsfh7fOOgd5kvFapyfmG2UlL34=; h=In-Reply-To:Date:References:To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=TKQR1eYZ9qMF49sdn4yC5NdevP8pkDTJ0qvzHZSIQW9sR3f9SKXpUz7icKCyq9uBY svSYCpBPA/IIM3XtinJWvDwFWMshxg0bg71iMtwDjhjcm4h757juspP0HoYKeA3f8Z WWL98iVsLrv0UNx+lS3dkICYzCgaZ/70/viPN0p4= Received: from smtp29.i.mail.ru (smtp29.i.mail.ru [95.163.41.68]) (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 1A922189E01 for ; Mon, 5 Dec 2022 19:06:57 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 1A922189E01 Received: by smtp29.i.mail.ru with esmtpa (envelope-from ) id 1p2Dzc-00BAb4-5H; Mon, 05 Dec 2022 19:06:56 +0300 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.200.110.1.12\)) In-Reply-To: <20221028092638.11506-3-max.kokryashkin@gmail.com> Date: Mon, 5 Dec 2022 19:06:45 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20221028092638.11506-1-max.kokryashkin@gmail.com> <20221028092638.11506-3-max.kokryashkin@gmail.com> To: Maksim Kokryashkin X-Mailer: Apple Mail (2.3731.200.110.1.12) X-Mailru-Src: smtp X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD908190A22B884CF14F728BD2D4F82E7258B41E11569A987E5182A05F53808504009C1DB11BAFD78C4AF14851827ADFD89470608A29F6F5438BC77B4210FEEA90D X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34AC6E62257D6CD1C93C710569F46F7BCFDB3033EC5139B52AED980F5BE99A85F5F7206D43DCF4682F1D7E09C32AA3244CF66EA63427ABAB790E4EA2D00EA0BFD63A92A9747B6CC886927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojniwsktXAgUNjAAM7kyN69w== X-Mailru-Sender: 11C2EC085EDE56FA38FD4C59F7EFE4070A10006E13E02068D8B774992B6946B8A877D903728FDABB19381EE24192DF5555834048F03EF5D4C9A814A92B2E3B1BA4250FC3964EA4964198E0F3ECE9B5443453F38A29522196 X-Mras: OK Subject: Re: [Tarantool-patches] [PATCH luajit v4 2/8] OSX: Fix build by hardcoding external frame unwinding. X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: sergos via Tarantool-patches Reply-To: sergos Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi! Thanks for the patch! LGTM. Sergos > On 28 Oct 2022, at 12:26, Maksim Kokryashkin = wrote: >=20 > Apparently they can't even get 'grep' right, let alone a keyboard. >=20 > (cherry picked from commit d4a554d6ee1507f7313641b26ed09bf1b518fa1f) >=20 > MacOS uses BSD grep, which is slightly different from GNU grep. > Because of that, the shell script determining whether external > unwinding is possible doesn't work right. >=20 > External unwinding is possible on MacOS, so this patch enables > it by default. >=20 > Maxim Kokryashkin: > * added the description for the problem >=20 > Needed for tarantool/tarantool#6096 > Needed for tarantool/tarantool#7230 > --- > cmake/SetTargetFlags.cmake | 28 ++++++++++++++++------------ > src/Makefile.original | 15 ++++++++------- > 2 files changed, 24 insertions(+), 19 deletions(-) >=20 > diff --git a/cmake/SetTargetFlags.cmake b/cmake/SetTargetFlags.cmake > index 36896aff..a5a3407f 100644 > --- a/cmake/SetTargetFlags.cmake > +++ b/cmake/SetTargetFlags.cmake > @@ -15,18 +15,22 @@ endif() > LuaJITTestArch(TESTARCH "${TARGET_C_FLAGS}") > LuaJITArch(LUAJIT_ARCH "${TESTARCH}") >=20 > -string(FIND ${TARGET_C_FLAGS} "LJ_NO_UNWIND 1" UNWIND_POS) > -if(UNWIND_POS EQUAL -1) > - execute_process( > - COMMAND bash -c "exec 2>/dev/null; echo 'extern void b(void);int = a(void){b();return 0;}' | ${CMAKE_C_COMPILER} -c -x c - -o tmpunwind.o = && grep -qa -e eh_frame -e __unwind_info tmpunwind.o && echo E; rm -f = tmpunwind.o" > - WORKING_DIRECTORY ${LUAJIT_SOURCE_DIR} > - OUTPUT_VARIABLE TESTUNWIND > - RESULT_VARIABLE TESTUNWIND_RC > - ) > - if(TESTUNWIND_RC EQUAL 0) > - string(FIND "${TESTUNWIND}" "E" UNW_TEST_POS) > - if(NOT UNW_TEST_POS EQUAL -1) > - AppendFlags(TARGET_C_FLAGS -DLUAJIT_UNWIND_EXTERNAL) > +if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") > + AppendFlags(TARGET_C_FLAGS -DLUAJIT_UNWIND_EXTERNAL) > +else() > + string(FIND ${TARGET_C_FLAGS} "LJ_NO_UNWIND 1" UNWIND_POS) > + if(UNWIND_POS EQUAL -1) > + execute_process( > + COMMAND bash -c "exec 2>/dev/null; echo 'extern void = b(void);int a(void){b();return 0;}' | ${CMAKE_C_COMPILER} -c -x c - -o = tmpunwind.o && grep -qa -e eh_frame -e __unwind_info tmpunwind.o && echo = E; rm -f tmpunwind.o" > + WORKING_DIRECTORY ${LUAJIT_SOURCE_DIR} > + OUTPUT_VARIABLE TESTUNWIND > + RESULT_VARIABLE TESTUNWIND_RC > + ) > + if(TESTUNWIND_RC EQUAL 0) > + string(FIND "${TESTUNWIND}" "E" UNW_TEST_POS) > + if(NOT UNW_TEST_POS EQUAL -1) > + AppendFlags(TARGET_C_FLAGS -DLUAJIT_UNWIND_EXTERNAL) > + endif() > endif() > endif() > endif() > diff --git a/src/Makefile.original b/src/Makefile.original > index c9609700..d1373b40 100644 > --- a/src/Makefile.original > +++ b/src/Makefile.original > @@ -320,18 +320,12 @@ else > ifeq (,$(shell $(TARGET_CC) -o /dev/null -c -x c /dev/null = -fno-stack-protector 2>/dev/null || echo 1)) > TARGET_XCFLAGS+=3D -fno-stack-protector > endif > -ifeq (,$(findstring LJ_NO_UNWIND 1,$(TARGET_TESTARCH))) > - # Find out whether the target toolchain always generates unwind = tables. > - TARGET_TESTUNWIND=3D$(shell exec 2>/dev/null; echo 'extern void = b(void);int a(void){b();return 0;}' | $(TARGET_CC) -c -x c - -o = tmpunwind.o && grep -qa -e eh_frame -e __unwind_info tmpunwind.o && echo = E; rm -f tmpunwind.o) > - ifneq (,$(findstring E,$(TARGET_TESTUNWIND))) > - TARGET_XCFLAGS+=3D -DLUAJIT_UNWIND_EXTERNAL > - endif > -endif > ifeq (Darwin,$(TARGET_SYS)) > ifeq (,$(MACOSX_DEPLOYMENT_TARGET)) > export MACOSX_DEPLOYMENT_TARGET=3D10.4 > endif > TARGET_STRIP+=3D -x > + TARGET_XCFLAGS+=3D -DLUAJIT_UNWIND_EXTERNAL > TARGET_XSHLDFLAGS=3D -dynamiclib -single_module -undefined = dynamic_lookup -fPIC > TARGET_DYNXLDOPTS=3D > TARGET_XSHLDFLAGS+=3D -install_name $(TARGET_DYLIBPATH) = -compatibility_version $(MAJVER).$(MINVER) -current_version = $(MAJVER).$(MINVER).$(RELVER) > @@ -345,6 +339,13 @@ ifeq (iOS,$(TARGET_SYS)) > TARGET_XCFLAGS+=3D -fno-omit-frame-pointer > endif > else > + ifeq (,$(findstring LJ_NO_UNWIND 1,$(TARGET_TESTARCH))) > + # Find out whether the target toolchain always generates unwind = tables. > + TARGET_TESTUNWIND=3D$(shell exec 2>/dev/null; echo 'extern void = b(void);int a(void){b();return 0;}' | $(TARGET_CC) -c -x c - -o = tmpunwind.o && grep -qa -e eh_frame -e __unwind_info tmpunwind.o && echo = E; rm -f tmpunwind.o) > + ifneq (,$(findstring E,$(TARGET_TESTUNWIND))) > + TARGET_XCFLAGS+=3D -DLUAJIT_UNWIND_EXTERNAL > + endif > + endif > ifneq (SunOS,$(TARGET_SYS)) > ifneq (PS3,$(TARGET_SYS)) > TARGET_XLDFLAGS+=3D -Wl,-E > --=20 > 2.37.0 (Apple Git-136) >=20