From 12709c475b38f354bb17dd12d543662fb6db370c Mon Sep 17 00:00:00 2001 From: Tae Won Ha Date: Sat, 11 Jul 2020 14:34:13 +0200 Subject: [PATCH 1/4] Use the latest luajit for arm64 Mac compatibility. --- third-party/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index d8923fd65b..5af5eb0a49 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -147,8 +147,8 @@ set(MSGPACK_URL https://github.com/msgpack/msgpack-c/releases/download/cpp-3.0.0 set(MSGPACK_SHA256 bfbb71b7c02f806393bc3cbc491b40523b89e64f83860c58e3e54af47de176e4) # https://github.com/LuaJIT/LuaJIT/tree/v2.1 -set(LUAJIT_URL https://github.com/LuaJIT/LuaJIT/archive/f0e865dd4861520258299d0f2a56491bd9d602e1.tar.gz) -set(LUAJIT_SHA256 ad5077bd861241bf5e50ae4bf543d291c5fcffab95ccc3218401131f503e45bd) +set(LUAJIT_URL https://github.com/LuaJIT/LuaJIT/archive/1d8b747c161db457e032a023ebbff511f5de5ec2.tar.gz) +set(LUAJIT_SHA256 20a159c38a98ecdb6368e8d655343b6036622a29a1621da9dc303f7ed9bf37f3) set(LUA_URL https://www.lua.org/ftp/lua-5.1.5.tar.gz) set(LUA_SHA256 2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333) From 27ddaa39db6ae18c2a6e4c1b816f3ee35466d05c Mon Sep 17 00:00:00 2001 From: Tae Won Ha Date: Sat, 11 Jul 2020 14:35:12 +0200 Subject: [PATCH 2/4] Do not set pagezero_size and image_base for LuaJIT >= 2.1.0-beta3 This is properly handled in LuaJIT now and setting causes "Malformed Mach-o file" error when running the resulting binary on arm64 Macs. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b34639d32..e3c67c55cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -352,8 +352,8 @@ if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang") add_definitions(-D_GNU_SOURCE) endif() -if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SIZEOF_VOID_P EQUAL 8) - # Required for luajit. +if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT PREFER_LUA AND LUAJIT_VERSION LESS "2.1.0-beta3") + # Required for luajit < 2.1.0-beta3. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pagezero_size 10000 -image_base 100000000") set(CMAKE_SHARED_LINKER_FLAGS From 9c5b4c87e19657d605f1917503be54298967ad45 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sat, 28 Nov 2020 10:14:30 -0500 Subject: [PATCH 3/4] third-party: Always set DEPLOYMENT_TARGET when building LuaJIT on macOS LuaJIT build now requires specifying a deployment target, so use the same baseline as our nightly builds. Co-authored-by: Christian Clason --- third-party/cmake/BuildLuajit.cmake | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/third-party/cmake/BuildLuajit.cmake b/third-party/cmake/BuildLuajit.cmake index c0b24fb2a5..ca41a7cee3 100644 --- a/third-party/cmake/BuildLuajit.cmake +++ b/third-party/cmake/BuildLuajit.cmake @@ -64,9 +64,12 @@ set(INSTALLCMD_UNIX ${MAKE_PRG} CFLAGS=-fPIC if(UNIX) if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") - # Set MACOSX_DEPLOYMENT_TARGET (else luajit defaults to 10.4). #9050 - # https://github.com/LuaJIT/LuaJIT/blob/b025b01c5b9d23f6218c7d72b7aafa3f1ab1e08a/src/Makefile#L301-L303 - set(DEPLOYMENT_TARGET "MACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}") + if(CMAKE_OSX_DEPLOYMENT_TARGET) + set(DEPLOYMENT_TARGET "MACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}") + else() + # Use the same target as our nightly builds + set(DEPLOYMENT_TARGET "MACOSX_DEPLOYMENT_TARGET=10.11") + endif() else() set(DEPLOYMENT_TARGET "") endif() From e8ae3ade770843681f72fc49be45338b39bea922 Mon Sep 17 00:00:00 2001 From: Matthew Nibecker Date: Sat, 12 Dec 2020 21:16:43 -0500 Subject: [PATCH 4/4] Fix lsp tests breaking from new LuaJIT version Apparently the new version of LuaJIT changed the consistency with which it sorted table dictionaries. IIRC lua sorts dictionary keys by memory address, so it would appear that the reasons tests were previously passing was because of a differentiation in the implementation of the lua runtime. Ensure that array fields in the lsp protocol tables are consistently created, by using ipair when generating arrays for completionItemKind and symbolItemKind. For CodeActionKind, the current implementation includes both the keys and the values in the array. This is incorrect. Ensure that only the values are included in the array and sort them for consistency. --- runtime/lua/vim/lsp/protocol.lua | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua index 218424fa14..fd86d8bb97 100644 --- a/runtime/lua/vim/lsp/protocol.lua +++ b/runtime/lua/vim/lsp/protocol.lua @@ -292,8 +292,9 @@ local constants = { } for k, v in pairs(constants) do - vim.tbl_add_reverse_lookup(v) - protocol[k] = v + local tbl = vim.deepcopy(v) + vim.tbl_add_reverse_lookup(tbl) + protocol[k] = tbl end --[=[ @@ -623,7 +624,11 @@ function protocol.make_client_capabilities() codeActionLiteralSupport = { codeActionKind = { - valueSet = vim.tbl_values(protocol.CodeActionKind); + valueSet = (function() + local res = vim.tbl_values(protocol.CodeActionKind) + table.sort(res) + return res + end)(); }; }; }; @@ -643,7 +648,7 @@ function protocol.make_client_capabilities() completionItemKind = { valueSet = (function() local res = {} - for k in pairs(protocol.CompletionItemKind) do + for k in ipairs(protocol.CompletionItemKind) do if type(k) == 'number' then table.insert(res, k) end end return res @@ -689,7 +694,7 @@ function protocol.make_client_capabilities() symbolKind = { valueSet = (function() local res = {} - for k in pairs(protocol.SymbolKind) do + for k in ipairs(protocol.SymbolKind) do if type(k) == 'number' then table.insert(res, k) end end return res @@ -708,7 +713,7 @@ function protocol.make_client_capabilities() symbolKind = { valueSet = (function() local res = {} - for k in pairs(protocol.SymbolKind) do + for k in ipairs(protocol.SymbolKind) do if type(k) == 'number' then table.insert(res, k) end end return res