From 6e9b51e48c6b8ddf65c6669a035b97e5d935f202 Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Tue, 20 Feb 2024 18:02:17 -0300 Subject: [PATCH] feat: upgrade llvm to 15.0.7 (#238) --- .gitignore | 2 +- .gitmodules | 4 ---- download_llvm.sh | 2 +- metadata-generator/CMakeLists.txt | 10 ++++++---- metadata-generator/src/Binary/binarySerializer.cpp | 7 ++++--- metadata-generator/src/Meta/Utils.cpp | 4 ++-- 6 files changed, 14 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 9aff7041..b481a975 100644 --- a/.gitignore +++ b/.gitignore @@ -45,7 +45,7 @@ v8 v8_build .npmrc -llvm/ +/llvm/ # v8 build files... .gclient* diff --git a/.gitmodules b/.gitmodules index 3c220897..fa45c83c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/download_llvm.sh b/download_llvm.sh index b93fba99..cc04f23f 100755 --- a/download_llvm.sh +++ b/download_llvm.sh @@ -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)..." diff --git a/metadata-generator/CMakeLists.txt b/metadata-generator/CMakeLists.txt index 757a0d45..49c3f365 100644 --- a/metadata-generator/CMakeLists.txt +++ b/metadata-generator/CMakeLists.txt @@ -1,5 +1,5 @@ -project(MetadataGenerator) cmake_minimum_required(VERSION 3.20) +project(MetadataGenerator) include(CheckCCompilerFlag) #set(CMAKE_VERBOSE_MAKEFILE ON) @@ -13,7 +13,7 @@ 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") @@ -21,10 +21,12 @@ set(LLVM_PREPROCESSOR_FLAGS "-I${LLVM_ROOT}/include -D__STDC_CONSTANT_MACROS -D_ # 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}") diff --git a/metadata-generator/src/Binary/binarySerializer.cpp b/metadata-generator/src/Binary/binarySerializer.cpp index 566e5064..27d99f3b 100644 --- a/metadata-generator/src/Binary/binarySerializer.cpp +++ b/metadata-generator/src/Binary/binarySerializer.cpp @@ -2,6 +2,7 @@ #include "Meta/Utils.h" #include "binarySerializerPrivate.h" #include +#include #include #include #include @@ -229,7 +230,7 @@ static llvm::ErrorOr> getFrameworkLib(clang::Module* fram return path; } - return errc::no_such_file_or_directory; + return llvm::errc::no_such_file_or_directory; } return path; @@ -245,7 +246,7 @@ static llvm::ErrorOr 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); @@ -294,7 +295,7 @@ static llvm::ErrorOr isStaticFramework(clang::Module* framework) } } - return errc::invalid_argument; + return llvm::errc::invalid_argument; } void binary::BinarySerializer::serializeModule(clang::Module* module, binary::ModuleMeta& binaryModule) diff --git a/metadata-generator/src/Meta/Utils.cpp b/metadata-generator/src/Meta/Utils.cpp index 99f1b58e..73333b15 100644 --- a/metadata-generator/src/Meta/Utils.cpp +++ b/metadata-generator/src/Meta/Utils.cpp @@ -179,8 +179,8 @@ void Utils::getAllLinkLibraries(clang::Module* module, std::vectorLinkLibraries) 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); } }