Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Bronnikov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Kaplun <skaplun@tarantool.org>,
	Sergey Bronnikov <estetus@gmail.com>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit 4/4][v2] OSX/iOS/ARM64: Fix bytecode embedding in Mach-O object file.
Date: Thu, 13 Jun 2024 18:47:00 +0300	[thread overview]
Message-ID: <6875650e-463f-4709-9ffb-31fc113e34b0@tarantool.org> (raw)
In-Reply-To: <4d732fc9-d878-49ea-9216-68a8133da7de@tarantool.org>

[-- Attachment #1: Type: text/plain, Size: 4158 bytes --]


On 13.06.2024 18:40, Sergey Bronnikov via Tarantool-patches wrote:
>
> Hi, Sergey
>
>
> fixes applied and force-pushed
>
> On 12.04.2024 14:27, Sergey Kaplun via Tarantool-patches wrote:
>> Hi, Sergey!
>> Thanks for the fixes!
>> LGTM, with a several minor nits below.
>>
>> On 11.04.24, Sergey Bronnikov wrote:
>>> From: Mike Pall <mike>
>>>
>>> Thanks to Carlo Cabrera.
>>>
>>> (cherry picked from commit b98b37231bd2dcb79e10b0f974cefd91eb0d7b3a)
>>>
>>> Mach-O FAT object files generated by LuaJIT for ARM64 Had
>> Typo: s/Had/had/
> Fixed, thanks!
>>> an incorrect format due to the usage of the 32-bit version of
>>> FFI structure. This patch adds the 64-bit structure definition
>> Typo: s/FFI structure/the FFI structure/
> Fixed, thanks!
>>> and uses it for ARM64.
>>>
>>> Sergey Bronnikov:
>>> * added the description and the test for the problem
>>>
>>> Part of tarantool/tarantool#9595
>>> ---
>>>   src/jit/bcsave.lua                            | 14 ++++-
>>>   ...-865-cross-generation-mach-o-file.test.lua | 55 +++++++++++++++++--
>>>   2 files changed, 63 insertions(+), 6 deletions(-)
>>>
>> <snipped>
>>
>>>   
>>>     -- Mach-O FAT object header.
>>> @@ -221,9 +263,11 @@ end
>>>   --
>>>   local SUM_CPUTYPE = {
>>>     arm = 7 + 12,
>>> +  arm64 = 0x01000007 + 0x0100000c,
>> Minor: The comment will be appreciated:
>> | x64 + arm64.
> Added, thanks!
>>>   }
>>>   local SUM_CPUSUBTYPE = {
>>>     arm = 3 + 9,
>>> +  arm64 = 3 + 0,
>> Minor: The comment will be appreciated:
>> | x64 + arm64.
>
> Added, thanks!
>
>
> Iterative patch below
>
>
> diff --git 
> a/test/tarantool-tests/lj-865-fix_generation_of_mach-o_object_files.test.lua 
> b/test/tarantool-tests/lj-865-fix_generation_of_mach-o_object_files.test.lua
> index 661e148e..9c27e12d 100644
> --- 
> a/test/tarantool-tests/lj-865-fix_generation_of_mach-o_object_files.test.lua
> +++ 
> b/test/tarantool-tests/lj-865-fix_generation_of_mach-o_object_files.test.lua
> @@ -173,7 +173,7 @@ local function read_mach_o(buf, is64)
>    local mach_fat_arch_type = ffi.typeof('mach_fat_arch *')
>    for i = 0, res.header.nfat_arch - 1 do
>      local fat_arch = ffi.cast(mach_fat_arch_type, obj.fat_arch[i])
> -    arch = {
> +    local arch = {
>        cputype = be32(fat_arch.cputype),
>        cpusubtype = be32(fat_arch.cpusubtype),
>      }
> @@ -184,16 +184,18 @@ local function read_mach_o(buf, is64)
>  end
>
>  -- Defined in <src/jit/bcsave.lua:bcsave_machobj>.
> -local sum_cputype = {
> +local SUM_CPUTYPE = {
>    x86 = 7,
>    x64 = 0x01000007,
>    arm = 7 + 12,
> +  -- x64 + arm64.
>    arm64 = 0x01000007 + 0x0100000c,
>  }
> -local sum_cpusubtype = {
> +local SUM_CPUSUBTYPE = {
>    x86 = 3,
>    x64 = 3,
>    arm = 3 + 9,
> +  -- x64 + arm64.
>    arm64 = 3 + 0,
>  }
>
> @@ -257,8 +259,8 @@ local function build_and_check_mach_o(is64)
>      total_cputype = total_cputype + mach_o.fat_arch[i].cputype
>      total_cpusubtype = total_cpusubtype + mach_o.fat_arch[i].cpusubtype
>    end
> -  test:is(total_cputype, sum_cputype[arch], 'cputype is correct in 
> Mach-O, ' .. arch)
> -  test:is(total_cpusubtype, sum_cpusubtype[arch], 'cpusubtype is 
> correct in Mach-O, ' .. arch)
> +  test:is(total_cputype, SUM_CPUTYPE[arch], 'cputype is correct in 
> Mach-O, ' .. arch)
> +  test:is(total_cpusubtype, SUM_CPUSUBTYPE[arch], 'cpusubtype is 
> correct in Mach-O, ' .. arch)
>  end
>
>  -- ARM
>
This is a correct iterative patch:


--- a/test/tarantool-tests/lj-865-cross-generation-mach-o-file.test.lua
+++ b/test/tarantool-tests/lj-865-cross-generation-mach-o-file.test.lua
@@ -262,13 +262,15 @@ end
  -- 1. 
https://opensource.apple.com/source/xnu/xnu-4570.41.2/osfmk/mach/machine.h.auto.html
  --
  local SUM_CPUTYPE = {
-  -- x86 + arm
+  -- x86 + arm.
    arm = 7 + 12,
+  -- x64 + arm64.
    arm64 = 0x01000007 + 0x0100000c,
  }
  local SUM_CPUSUBTYPE = {
-  -- x86 + arm
+  -- x86 + arm.
    arm = 3 + 9,
+  -- x64 + arm64.
    arm64 = 3 + 0,
  }

>
>>>   }
>>>   
>>>   -- The function builds Mach-O FAT object file and retrieves
>> <snipped>
>>
>>> -- 
>>> 2.34.1
>>>

[-- Attachment #2: Type: text/html, Size: 7194 bytes --]

  reply	other threads:[~2024-06-13 15:47 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-11 13:22 [Tarantool-patches] [PATCH luajit 0/4][v2] Mach-O generation fixes Sergey Bronnikov via Tarantool-patches
2024-04-11 13:22 ` [Tarantool-patches] [PATCH luajit 1/4][v2] ci: add a workflow for testing with AVX512 Sergey Bronnikov via Tarantool-patches
2024-04-12 10:27   ` Sergey Kaplun via Tarantool-patches
2024-04-16 11:53     ` Sergey Bronnikov via Tarantool-patches
2024-04-18  8:24       ` Sergey Kaplun via Tarantool-patches
2024-05-05 12:29         ` Maxim Kokryashkin via Tarantool-patches
2024-06-14 13:55           ` Sergey Bronnikov via Tarantool-patches
2024-06-14 15:24         ` Sergey Bronnikov via Tarantool-patches
2024-04-11 13:22 ` [Tarantool-patches] [PATCH luajit 2/4][v2] test: introduce a helper read_file Sergey Bronnikov via Tarantool-patches
2024-04-12 10:47   ` Sergey Kaplun via Tarantool-patches
2024-04-16 12:02     ` Sergey Bronnikov via Tarantool-patches
2024-06-20 12:14     ` Sergey Bronnikov via Tarantool-patches
2024-04-11 13:22 ` [Tarantool-patches] [PATCH luajit 3/4][v2] OSX/iOS/ARM64: Fix generation of Mach-O object files Sergey Bronnikov via Tarantool-patches
2024-04-12 11:19   ` Sergey Kaplun via Tarantool-patches
2024-04-16 15:29     ` Sergey Bronnikov via Tarantool-patches
2024-06-13 15:50       ` Sergey Bronnikov via Tarantool-patches
2024-04-11 13:22 ` [Tarantool-patches] [PATCH luajit 4/4][v2] OSX/iOS/ARM64: Fix bytecode embedding in Mach-O object file Sergey Bronnikov via Tarantool-patches
2024-04-12 11:27   ` Sergey Kaplun via Tarantool-patches
2024-06-13 15:40     ` Sergey Bronnikov via Tarantool-patches
2024-06-13 15:47       ` Sergey Bronnikov via Tarantool-patches [this message]
2024-06-20 10:15 ` [Tarantool-patches] [PATCH luajit 0/4][v2] Mach-O generation fixes Sergey Kaplun via Tarantool-patches
2024-07-09  8: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=6875650e-463f-4709-9ffb-31fc113e34b0@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=estetus@gmail.com \
    --cc=sergeyb@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit 4/4][v2] OSX/iOS/ARM64: Fix bytecode embedding in Mach-O object file.' \
    /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