Skip to content

Commit

Permalink
feat: upgrade llvm to 15.0.7 (#238)
Browse files Browse the repository at this point in the history
  • Loading branch information
edusperoni authored Feb 20, 2024
1 parent 17a5c5f commit 6e9b51e
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ v8
v8_build
.npmrc

llvm/
/llvm/

# v8 build files...
.gclient*
Expand Down
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,3 @@
path = libffi
url = https://github.com/NativeScript/libffi.git
branch = darind/v8-ios
[submodule "llvm"]
path = llvm
url = https://github.com/NativeScript/ios-llvm.git
branch = master
2 changes: 1 addition & 1 deletion download_llvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e
source "$(dirname "$0")/build_utils.sh"

LLVM_VERSION="13.0.1"
LLVM_VERSION="15.0.7"

function download_llvm() {
checkpoint "Downloading llvm (version $LLVM_VERSION)..."
Expand Down
10 changes: 6 additions & 4 deletions metadata-generator/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project(MetadataGenerator)
cmake_minimum_required(VERSION 3.20)
project(MetadataGenerator)
include(CheckCCompilerFlag)

#set(CMAKE_VERBOSE_MAKEFILE ON)
Expand All @@ -13,18 +13,20 @@ if (NOT LIBXML2_FOUND)
message(FATAL_ERROR "libXML2 not found")
endif ()

get_filename_component(LLVM_ROOT "../../llvm/13.0.1" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
get_filename_component(LLVM_ROOT "../../llvm/15.0.7" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
set(CMAKE_OSX_DEPLOYMENT_TARGET 11.0)

set(LLVM_SYSTEM_LIBS "-lz -lcurses -lm -lxml2")
set(LLVM_PREPROCESSOR_FLAGS "-I${LLVM_ROOT}/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS")
# these are all available libs currently, we probably don't need all
#set(LLVM_LIBS "-lLLVMCFGuard -lLLVMMipsInfo -lclangFrontend -lclangToolingRefactoring -lLLVMGlobalISel -lLLVMFileCheck -lLLVMAnalysis -lLLVMAArch64AsmParser -lLLVMBPFAsmParser -lclangToolingASTDiff -lLLVMAArch64Utils -lLLVMMCA -lclangHandleLLVM -lLLVMMIRParser -lLLVMHexagonAsmParser -lLLVMLanaiDesc -lLLVMSparcDisassembler -llldELF -lLLVMMipsAsmParser -lLLVMDebugInfoDWARF -lLLVMAVRDisassembler -lLLVMWebAssemblyInfo -lLLVMHexagonInfo -lLLVMARMCodeGen -lLLVMPowerPCCodeGen -lLLVMXRay -lLLVMMSP430CodeGen -lLLVMVectorize -lLLVMHexagonCodeGen -lclangCrossTU -lLLVMSupport -lLLVMDWP -lLLVMWindowsManifest -lclangToolingInclusions -lLLVMNVPTXDesc -lc++ -lLLVMXCoreCodeGen -lLLVMSystemZInfo -lclangFormat -lLLVMWebAssemblyUtils -lLLVMCFIVerify -lLLVMXCoreInfo -lLLVMAVRDesc -lLLVMARMDisassembler -lclangAPINotes -lLLVMSparcDesc -llldCOFF -lLLVMAggressiveInstCombine -lLLVMAMDGPUDesc -lLLVMMSP430AsmParser -lclangIndexSerialization -lLLVMExtensions -lLLVMInstCombine -lLLVMDWARFLinker -lclangHandleCXX -lLLVMRISCVDisassembler -lclangDependencyScanning -lLLVMRISCVAsmParser -lLLVMFuzzMutate -lLLVMExegesisMips -lclangDynamicASTMatchers -lclangTransformer -lclangCodeGen -lLLVMScalarOpts -lLLVMTextAPI -lclangSerialization -lLLVMPasses -lLLVMBPFInfo -lLLVMLinker -lLLVMObject -lLLVMMCJIT -lPollyISL -lLLVMExegesisPowerPC -lLLVMCore -lLLVMLanaiCodeGen -lLLVMipo -lLLVMAArch64Info -lLLVMMC -lLLVMObjCARCOpts -lclangRewrite -lLLVMCodeGen -lclangAST -lLLVMTarget -lLLVMX86AsmParser -lLLVMFrontendOpenACC -llldYAML -lLLVMDebugInfoPDB -lLLVMMCDisassembler -lclangEdit -lLLVMX86CodeGen -lLLVMX86Info -lLLVMBPFCodeGen -lLLVMDebugInfoGSYM -lLLVMBPFDisassembler -lclangRewriteFrontend -lclangLex -lLLVMRISCVInfo -lLLVMJITLink -lLLVMBitReader -lLLVMHexagonDisassembler -lLLVMExecutionEngine -lLLVMMSP430Desc -lLLVMPowerPCDesc -llldCommon -lLLVMWebAssemblyAsmParser -lclangBasic -lLLVMSystemZAsmParser -lLLVMLTO -lLLVMSystemZCodeGen -lLLVMRemarks -lLLVMOption -lLLVMARMDesc -lLLVMAMDGPUUtils -lclangAnalysis -lLLVMPowerPCAsmParser -lLLVMOrcTargetProcess -lLLVMInterfaceStub -lclangStaticAnalyzerCore -lclangASTMatchers -lLLVMIRReader -llldWasm -lLLVMFrontendOpenMP -llldDriver -lLLVMAArch64Desc -lclangDirectoryWatcher -lLLVMAVRCodeGen -lLLVMWebAssemblyDisassembler -lLLVMLanaiAsmParser -lLLVMRISCVCodeGen -lLLVMBPFDesc -lLLVMMSP430Disassembler -lclangDriver -lLLVMTransformUtils -lLLVMLibDriver -lLLVMCoverage -lLLVMARMInfo -lLLVMExegesisAArch64 -lclangParse -lLLVMInterpreter -lLLVMPowerPCInfo -lLLVMRuntimeDyld -lLLVMMSP430Info -lLLVMProfileData -lLLVMSymbolize -lLLVMSelectionDAG -lLLVMRISCVDesc -lLLVMExegesisX86 -lLLVMX86Desc -lLLVMSparcCodeGen -lLLVMBitWriter -lclangStaticAnalyzerCheckers -lLLVMObjectYAML -lclangTooling -lLLVMBinaryFormat -lLLVMMCParser -lLLVMWebAssemblyDesc -lLLVMHexagonDesc -lLLVMAMDGPUCodeGen -lLLVMX86Disassembler -lclangToolingCore -lLLVMDemangle -lLLVMARMAsmParser -lLLVMLanaiDisassembler -lLLVMLineEditor -lLLVMMipsCodeGen -lclangTesting -lLLVMLanaiInfo -lLLVMOrcJIT -lclangInterpreter -llldReaderWriter -lLLVMAsmPrinter -lLLVMExegesis -lLLVMAArch64Disassembler -lLLVMTableGenGlobalISel -lclangToolingSyntax -lLLVMMipsDesc -lPolly -lLLVMMCACustomBehaviourAMDGPU -llldMinGW -lLLVMXCoreDisassembler -lLLVMTableGen -lLLVMAArch64CodeGen -llldMachO -lLLVMCoroutines -llldMachO2 -lLLVMAVRAsmParser -lLLVMPowerPCDisassembler -lLLVMDebugInfoCodeView -lLLVMNVPTXCodeGen -lclangFrontendTool -lLLVMAMDGPUInfo -llldCore -lLLVMWebAssemblyCodeGen -lLLVMSystemZDisassembler -lLLVMSparcInfo -lLLVMAMDGPUDisassembler -lLLVMAVRInfo -lclangARCMigrate -lLLVMSparcAsmParser -lLLVMXCoreDesc -lLLVMAsmParser -lLLVMDebugInfoMSF -lLLVMOrcShared -lLLVMSystemZDesc -lLLVMNVPTXInfo -lLLVMBitstreamReader -lclangStaticAnalyzerFrontend -lclangIndex -lLLVMInstrumentation -lclangSema -lLLVMDlltoolDriver -lLLVMARMUtils -lLLVMMipsDisassembler -lLLVMAMDGPUAsmParser")
# these come from the older llvm plus some added ones at the end
set(LLVM_LIBS "-lLLVMLTO -lLLVMPasses -lLLVMObjCARCOpts -lLLVMMIRParser -lLLVMSymbolize -lLLVMDebugInfoPDB -lLLVMDebugInfoDWARF -lLLVMCoverage -lLLVMMCA -lLLVMTableGen -lLLVMDlltoolDriver -lLLVMXRay -lLLVMOrcJIT -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMWebAssemblyDisassembler -lLLVMWebAssemblyCodeGen -lLLVMWebAssemblyDesc -lLLVMWebAssemblyAsmParser -lLLVMWebAssemblyInfo -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSparcDisassembler -lLLVMSparcCodeGen -lLLVMSparcAsmParser -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMPowerPCDisassembler -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMMSP430Disassembler -lLLVMMSP430CodeGen -lLLVMMSP430AsmParser -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMLanaiDisassembler -lLLVMLanaiCodeGen -lLLVMLanaiAsmParser -lLLVMLanaiDesc -lLLVMLanaiInfo -lLLVMHexagonDisassembler -lLLVMHexagonCodeGen -lLLVMHexagonAsmParser -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMBPFDisassembler -lLLVMBPFCodeGen -lLLVMBPFAsmParser -lLLVMBPFDesc -lLLVMBPFInfo -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMUtils -lLLVMAMDGPUDisassembler -lLLVMAMDGPUCodeGen -lLLVMAMDGPUAsmParser -lLLVMAMDGPUDesc -lLLVMAMDGPUInfo -lLLVMAMDGPUUtils -lLLVMAArch64Disassembler -lLLVMAArch64CodeGen -lLLVMAArch64AsmParser -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64Utils -lLLVMObjectYAML -lLLVMLibDriver -lLLVMOption -lLLVMWindowsManifest -lLLVMTextAPI -lLLVMFuzzMutate -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMX86Desc -lLLVMMCDisassembler -lLLVMX86Info -lLLVMMCJIT -lLLVMLineEditor -lLLVMInterpreter -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMCodeGen -lLLVMTarget -lLLVMCoroutines -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize -lLLVMScalarOpts -lLLVMLinker -lLLVMIRReader -lLLVMAsmParser -lLLVMInstCombine -lLLVMBitWriter -lLLVMAggressiveInstCombine -lLLVMTransformUtils -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMMC -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle -lLLVMRemarks -lLLVMFrontendOpenMP -lLLVMBitstreamReader")
set(LLVM_LIBS "-lLLVMLTO -lLLVMPasses -lLLVMObjCARCOpts -lLLVMMIRParser -lLLVMSymbolize -lLLVMDebugInfoPDB -lLLVMDebugInfoDWARF -lLLVMCoverage -lLLVMMCA -lLLVMTableGen -lLLVMDlltoolDriver -lLLVMXRay -lLLVMOrcJIT -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMWebAssemblyDisassembler -lLLVMWebAssemblyCodeGen -lLLVMWebAssemblyDesc -lLLVMWebAssemblyAsmParser -lLLVMWebAssemblyInfo -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSparcDisassembler -lLLVMSparcCodeGen -lLLVMSparcAsmParser -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMPowerPCDisassembler -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMMSP430Disassembler -lLLVMMSP430CodeGen -lLLVMMSP430AsmParser -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMLanaiDisassembler -lLLVMLanaiCodeGen -lLLVMLanaiAsmParser -lLLVMLanaiDesc -lLLVMLanaiInfo -lLLVMHexagonDisassembler -lLLVMHexagonCodeGen -lLLVMHexagonAsmParser -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMBPFDisassembler -lLLVMBPFCodeGen -lLLVMBPFAsmParser -lLLVMBPFDesc -lLLVMBPFInfo -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMUtils -lLLVMAMDGPUDisassembler -lLLVMAMDGPUCodeGen -lLLVMAMDGPUAsmParser -lLLVMAMDGPUDesc -lLLVMAMDGPUInfo -lLLVMAMDGPUUtils -lLLVMAArch64Disassembler -lLLVMAArch64CodeGen -lLLVMAArch64AsmParser -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64Utils -lLLVMObjectYAML -lLLVMLibDriver -lLLVMOption -lLLVMWindowsManifest -lLLVMTextAPI -lLLVMFuzzMutate -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMX86Desc -lLLVMMCDisassembler -lLLVMX86Info -lLLVMMCJIT -lLLVMLineEditor -lLLVMInterpreter -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMCodeGen -lLLVMTarget -lLLVMCoroutines -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize -lLLVMScalarOpts -lLLVMLinker -lLLVMIRReader -lLLVMAsmParser -lLLVMInstCombine -lLLVMBitWriter -lLLVMAggressiveInstCombine -lLLVMTransformUtils -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMMC -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle -lLLVMRemarks -lLLVMFrontendOpenMP -lLLVMBitstreamReader -lclangASTMatchers -lLLVMRISCVAsmParser -lclangSupport -lLLVMWindowsDriver")

set(LLVM_LIBDIR "${LLVM_ROOT}/lib_${METADATA_BINARY_ARCH}")
set(LLVM_LINKER_FLAGS "-L${LLVM_LIBDIR} -Wl,-search_paths_first -Wl,-headerpad_max_install_names")
set(LLVM_LINKER_FLAGS "-L${LLVM_LIBDIR} -Wl,-search_paths_first -Wl,-headerpad_max_install_names -Wl,-dead_strip")

set(CMAKE_BUILD_TYPE Release)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -target ${METADATA_BINARY_ARCH}-apple-darwin -std=c++17 -fno-rtti ${LLVM_PREPROCESSOR_FLAGS}")

Expand Down
7 changes: 4 additions & 3 deletions metadata-generator/src/Binary/binarySerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "Meta/Utils.h"
#include "binarySerializerPrivate.h"
#include <clang/Basic/FileManager.h>
#include <llvm/Object/Archive.h>
#include <llvm/Object/Binary.h>
#include <llvm/Object/MachO.h>
#include <llvm/Object/MachOUniversal.h>
Expand Down Expand Up @@ -229,7 +230,7 @@ static llvm::ErrorOr<llvm::SmallString<128>> getFrameworkLib(clang::Module* fram
return path;
}

return errc::no_such_file_or_directory;
return llvm::errc::no_such_file_or_directory;
}

return path;
Expand All @@ -245,7 +246,7 @@ static llvm::ErrorOr<bool> isStaticFramework(clang::Module* framework)

if(path.getError()) {
if (framework->LinkLibraries.size() == 0) {
return errc::no_such_file_or_directory;
return llvm::errc::no_such_file_or_directory;
}

path = getFrameworkLib(framework, framework->LinkLibraries[0].Library);
Expand Down Expand Up @@ -294,7 +295,7 @@ static llvm::ErrorOr<bool> isStaticFramework(clang::Module* framework)
}
}

return errc::invalid_argument;
return llvm::errc::invalid_argument;
}

void binary::BinarySerializer::serializeModule(clang::Module* module, binary::ModuleMeta& binaryModule)
Expand Down
4 changes: 2 additions & 2 deletions metadata-generator/src/Meta/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ void Utils::getAllLinkLibraries(clang::Module* module, std::vector<clang::Module
{
for (clang::Module::LinkLibrary lib : module->LinkLibraries)
result.push_back(lib);
for (clang::Module::submodule_const_iterator it = module->submodule_begin();
it != module->submodule_end(); ++it)
for (clang::Module::submodule_const_iterator it = module->submodules().begin();
it != module->submodules().end(); ++it)
getAllLinkLibraries(*it, result);
}
}

0 comments on commit 6e9b51e

Please sign in to comment.