From 4c940dcd9cb8acbfb3092a9cb9132d3a63ccf428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Mon, 10 Mar 2025 19:04:17 +0100 Subject: [PATCH] llvm20: new recipe --- sys-devel/llvm/llvm20-20.1.0.recipe | 810 ++++++++++++++++++ sys-devel/llvm/patches/llvm20-20.1.0.patchset | 371 ++++++++ 2 files changed, 1181 insertions(+) create mode 100644 sys-devel/llvm/llvm20-20.1.0.recipe create mode 100644 sys-devel/llvm/patches/llvm20-20.1.0.patchset diff --git a/sys-devel/llvm/llvm20-20.1.0.recipe b/sys-devel/llvm/llvm20-20.1.0.recipe new file mode 100644 index 000000000..c727920cd --- /dev/null +++ b/sys-devel/llvm/llvm20-20.1.0.recipe @@ -0,0 +1,810 @@ +SUMMARY="Modular and reuseable compiler and toolchain technologies" +DESCRIPTION="LLVM is a collection of modular and reuseable compiler and and \ +toolchain technologies. The LLVM compiler system for C and C++ includes the \ +following: + +- Front-ends for C, C++, Objective-C, Fortran, etc. based on the GCC 4.2 \ +parsers. They support the ANSI-standard C and C++ languages to the same \ +degree that GCC supports them. Additionally, many GCC extensions are \ +supported. +- A stable implementation of the LLVM instruction set, which serves as both \ +the online and offline code representation, together with assembly (ASCII) \ +and bytecode (binary) readers and writers, and a verifier. +- A powerful pass-management system that automatically sequences passes \ +(including analysis, transformation, and code-generation passes) based on \ +their dependences, and pipelines them for efficiency. +- A wide range of global scalar optimizations. +- A link-time interprocedural optimization framework with a rich set of \ +analyses and transformations, including sophisticated whole-program pointer \ +analysis, call graph construction, and support for profile-guided optimizations. +- An easily retargettable code generator, which currently supports X86, \ +X86-64, PowerPC, PowerPC-64, ARM, Thumb, SPARC, MIPS, MSP430, SystemZ, and XCore. +- A Just-In-Time (JIT) code generation system, which currently supports X86, \ +X86-64, ARM, AArch64, Mips, SystemZ, PowerPC, and PowerPC-64. +- Support for generating DWARF debugging information. +- A C back-end useful for testing and for generating native code on targets \ +other than the ones listed above. +- A profiling system similar to gprof. +- A test framework with a number of benchmark codes and applications. +- APIs and debugging tools to simplify rapid development of LLVM components." +HOMEPAGE="https://www.llvm.org/" +COPYRIGHT="2003-2025 University of Illinois at Urbana-Champaign" +LICENSE="Apache v2 with LLVM Exception" +REVISION="1" +SOURCE_URI="https://github.com/llvm/llvm-project/releases/download/llvmorg-$portVersion/llvm-project-$portVersion.src.tar.xz" +CHECKSUM_SHA256="4579051e3c255fb4bb795d54324f5a7f3ef79bd9181e44293d7ee9a7f62aad9a" +SOURCE_DIR="llvm-project-$portVersion.src" +PATCHES="llvm20-$portVersion.patchset" + +ARCHITECTURES="all !x86_gcc2" +SECONDARY_ARCHITECTURES="x86" + +portVersionCompat="$portVersion compat >= ${portVersion%%.*}" + +PROVIDES=" + llvm20$secondaryArchSuffix = $portVersionCompat + cmd:bugpoint + cmd:dsymutil + cmd:llc + cmd:lli + cmd:llvm_addr2line + cmd:llvm_ar + cmd:llvm_as + cmd:llvm_bcanalyzer + cmd:llvm_bitcode_strip + cmd:llvm_c_test + cmd:llvm_cat + cmd:llvm_cfi_verify + cmd:llvm_cgdata + cmd:llvm_config = $portVersionCompat + cmd:llvm_cov + cmd:llvm_ctxprof_util + cmd:llvm_cvtres + cmd:llvm_cxxdump + cmd:llvm_cxxfilt + cmd:llvm_cxxmap + cmd:llvm_debuginfo_analyzer + cmd:llvm_debuginfod + cmd:llvm_debuginfod_find + cmd:llvm_diff + cmd:llvm_dis + cmd:llvm_dlltool + cmd:llvm_dwarfdump + cmd:llvm_dwarfutil + cmd:llvm_dwp + cmd:llvm_exegesis + cmd:llvm_extract + cmd:llvm_gsymutil + cmd:llvm_ifs + cmd:llvm_install_name_tool + cmd:llvm_jitlink + cmd:llvm_lib + cmd:llvm_libtool_darwin + cmd:llvm_link + cmd:llvm_lipo + cmd:llvm_lto + cmd:llvm_lto2 + cmd:llvm_mc + cmd:llvm_mca + cmd:llvm_ml + cmd:llvm_modextract + cmd:llvm_mt + cmd:llvm_nm + cmd:llvm_objcopy + cmd:llvm_objdump + cmd:llvm_opt_report + cmd:llvm_otool + cmd:llvm_pdbutil + cmd:llvm_profdata + cmd:llvm_profgen + cmd:llvm_ranlib + cmd:llvm_rc + cmd:llvm_readelf + cmd:llvm_readobj + cmd:llvm_readtapi + cmd:llvm_reduce + cmd:llvm_remarkutil + cmd:llvm_rtdyld + cmd:llvm_sim + cmd:llvm_size + cmd:llvm_split + cmd:llvm_stress + cmd:llvm_strings + cmd:llvm_strip + cmd:llvm_symbolizer + cmd:llvm_tblgen + cmd:llvm_tli_checker + cmd:llvm_undname + cmd:llvm_windres + cmd:llvm_xray + cmd:opt + cmd:reduce_chunk_list + cmd:sancov + cmd:sanstats + cmd:verify_uselistorder + devel:libfindAllSymbols$secondaryArchSuffix + devel:libLLVM$secondaryArchSuffix = $portVersionCompat + devel:libLLVM_20$secondaryArchSuffix = $portVersionCompat + devel:libLLVMAArch64AsmParser$secondaryArchSuffix + devel:libLLVMAArch64CodeGen$secondaryArchSuffix + devel:libLLVMAArch64Desc$secondaryArchSuffix + devel:libLLVMAArch64Disassembler$secondaryArchSuffix + devel:libLLVMAArch64Info$secondaryArchSuffix + devel:libLLVMAArch64Utils$secondaryArchSuffix + devel:libLLVMAMDGPUAsmParser$secondaryArchSuffix + devel:libLLVMAMDGPUCodeGen$secondaryArchSuffix + devel:libLLVMAMDGPUDesc$secondaryArchSuffix + devel:libLLVMAMDGPUDisassembler$secondaryArchSuffix + devel:libLLVMAMDGPUInfo$secondaryArchSuffix + devel:libLLVMAMDGPUTargetMCA$secondaryArchSuffix + devel:libLLVMAMDGPUUtils$secondaryArchSuffix + devel:libLLVMARMAsmParser$secondaryArchSuffix + devel:libLLVMARMCodeGen$secondaryArchSuffix + devel:libLLVMARMDesc$secondaryArchSuffix + devel:libLLVMARMDisassembler$secondaryArchSuffix + devel:libLLVMARMInfo$secondaryArchSuffix + devel:libLLVMARMUtils$secondaryArchSuffix + devel:libLLVMAggressiveInstCombine$secondaryArchSuffix + devel:libLLVMAnalysis$secondaryArchSuffix + devel:libLLVMAsmParser$secondaryArchSuffix + devel:libLLVMAsmPrinter$secondaryArchSuffix + devel:libLLVMBinaryFormat$secondaryArchSuffix + devel:libLLVMBitReader$secondaryArchSuffix + devel:libLLVMBitWriter$secondaryArchSuffix + devel:libLLVMBitstreamReader$secondaryArchSuffix + devel:libLLVMCFGuard$secondaryArchSuffix + devel:libLLVMCGData$secondaryArchSuffix + devel:libLLVMCFIVerify$secondaryArchSuffix + devel:libLLVMCodeGen$secondaryArchSuffix + devel:libLLVMCodeGenData$secondaryArchSuffix + devel:libLLVMCodeGenTypes$secondaryArchSuffix + devel:libLLVMCore$secondaryArchSuffix + devel:libLLVMCoroutines$secondaryArchSuffix + devel:libLLVMCoverage$secondaryArchSuffix + devel:libLLVMDebugInfoBTF$secondaryArchSuffix + devel:libLLVMDebugInfoCodeView$secondaryArchSuffix + devel:libLLVMDebugInfoDWARF$secondaryArchSuffix + devel:libLLVMDebugInfoGSYM$secondaryArchSuffix + devel:libLLVMDebugInfoLogicalView$secondaryArchSuffix + devel:libLLVMDebugInfoMSF$secondaryArchSuffix + devel:libLLVMDebugInfoPDB$secondaryArchSuffix + devel:libLLVMDebuginfod$secondaryArchSuffix + devel:libLLVMDemangle$secondaryArchSuffix + devel:libLLVMDiff$secondaryArchSuffix + devel:libLLVMDlltoolDriver$secondaryArchSuffix + devel:libLLVMDWARFLinker$secondaryArchSuffix + devel:libLLVMDWARFLinkerClassic$secondaryArchSuffix + devel:libLLVMDWARFLinkerParallel$secondaryArchSuffix + devel:libLLVMDWP$secondaryArchSuffix + devel:libLLVMExecutionEngine$secondaryArchSuffix + devel:libLLVMExegesis$secondaryArchSuffix + devel:libLLVMExegesisAArch64$secondaryArchSuffix + devel:libLLVMExegesisRISCV$secondaryArchSuffix + devel:libLLVMExegesisX86$secondaryArchSuffix + devel:libLLVMExtensions$secondaryArchSuffix + devel:libLLVMFileCheck$secondaryArchSuffix + devel:libLLVMFrontendAtomic$secondaryArchSuffix + devel:libLLVMFrontendDriver$secondaryArchSuffix + devel:libLLVMFrontendHLSL$secondaryArchSuffix + devel:libLLVMFrontendOffloading$secondaryArchSuffix + devel:libLLVMFrontendOpenAcc$secondaryArchSuffix + devel:libLLVMFrontendOpenMP$secondaryArchSuffix + devel:libLLVMFuzzMutate$secondaryArchSuffix + devel:libLLVMFuzzerCLI$secondaryArchSuffix + devel:libLLVMGlobalISel$secondaryArchSuffix + devel:libLLVMHipStdPar$secondaryArchSuffix + devel:libLLVMIRPrinter$secondaryArchSuffix + devel:libLLVMIRReader$secondaryArchSuffix + devel:libLLVMInstCombine$secondaryArchSuffix + devel:libLLVMInstrumentation$secondaryArchSuffix + devel:libLLVMInterfaceStub$secondaryArchSuffix + devel:libLLVMInterpreter$secondaryArchSuffix + devel:libLLVMJITLink$secondaryArchSuffix + devel:libLLVMLTO$secondaryArchSuffix + devel:libLLVMLibDriver$secondaryArchSuffix + devel:libLLVMLineEditor$secondaryArchSuffix + devel:libLLVMLinker$secondaryArchSuffix + devel:libLLVMMC$secondaryArchSuffix + devel:libLLVMMCA$secondaryArchSuffix + devel:libLLVMMCDisassembler$secondaryArchSuffix + devel:libLLVMMCJIT$secondaryArchSuffix + devel:libLLVMMCParser$secondaryArchSuffix + devel:libLLVMMIRParser$secondaryArchSuffix + devel:libLLVMObjCARCOpts$secondaryArchSuffix + devel:libLLVMObjCopy$secondaryArchSuffix + devel:libLLVMObject$secondaryArchSuffix + devel:libLLVMObjectYAML$secondaryArchSuffix + devel:libLLVMOptDriver$secondaryArchSuffix + devel:libLLVMOption$secondaryArchSuffix + devel:libLLVMOrcDebugging$secondaryArchSuffix + devel:libLLVMOrcJIT$secondaryArchSuffix + devel:libLLVMOrcShared$secondaryArchSuffix + devel:libLLVMOrcTargetProcess$secondaryArchSuffix + devel:libLLVMPasses$secondaryArchSuffix + devel:libLLVMProfileData$secondaryArchSuffix + devel:libLLVMRISCVAsmParser$secondaryArchSuffix + devel:libLLVMRISCVCodeGen$secondaryArchSuffix + devel:libLLVMRISCVDesc$secondaryArchSuffix + devel:libLLVMRISCVDisassembler$secondaryArchSuffix + devel:libLLVMRISCVInfo$secondaryArchSuffix + devel:libLLVMRISCVTargetMCA$secondaryArchSuffix + devel:libLLVMRemarks$secondaryArchSuffix + devel:libLLVMRuntimeDyld$secondaryArchSuffix + devel:libLLVMSandboxIR$secondaryArchSuffix + devel:libLLVMScalarOpts$secondaryArchSuffix + devel:libLLVMSelectionDAG$secondaryArchSuffix + devel:libLLVMSupport$secondaryArchSuffix + devel:libLLVMSymbolize$secondaryArchSuffix + devel:libLLVMTableGen$secondaryArchSuffix + devel:libLLVMTableGenBasic$secondaryArchSuffix + devel:libLLVMTableGenCommon$secondaryArchSuffix + devel:libLLVMTableGenGlobalISel$secondaryArchSuffix + devel:libLLVMTarget$secondaryArchSuffix + devel:libLLVMTargetParser$secondaryArchSuffix + devel:libLLVMTelemetry$secondaryArchSuffix + devel:libLLVMTextAPI$secondaryArchSuffix + devel:libLLVMTextAPIBinaryReader$secondaryArchSuffix + devel:libLLVMTransformUtils$secondaryArchSuffix + devel:libLLVMVectorize$secondaryArchSuffix + devel:libLLVMWebAssemblyAsmParser$secondaryArchSuffix + devel:libLLVMWebAssemblyCodeGen$secondaryArchSuffix + devel:libLLVMWebAssemblyDesc$secondaryArchSuffix + devel:libLLVMWebAssemblyDisassembler$secondaryArchSuffix + devel:libLLVMWebAssemblyInfo$secondaryArchSuffix + devel:libLLVMWebAssemblyUtils$secondaryArchSuffix + devel:libLLVMWindowsDriver$secondaryArchSuffix + devel:libLLVMWindowsManifest$secondaryArchSuffix + devel:libLLVMX86AsmParser$secondaryArchSuffix + devel:libLLVMX86CodeGen$secondaryArchSuffix + devel:libLLVMX86Desc$secondaryArchSuffix + devel:libLLVMX86Disassembler$secondaryArchSuffix + devel:libLLVMX86Info$secondaryArchSuffix + devel:libLLVMX86TargetMCA$secondaryArchSuffix + devel:libLLVMXRay$secondaryArchSuffix + devel:libLLVMipo$secondaryArchSuffix + devel:libLTO$secondaryArchSuffix = $portVersionCompat + devel:libRemarks$secondaryArchSuffix = $portVersionCompat + " +REQUIRES=" + haiku$secondaryArchSuffix + lib:libclang_cpp$secondaryArchSuffix + lib:libLLVM$secondaryArchSuffix + lib:libz$secondaryArchSuffix + " +CONFLICTS=" + llvm9$secondaryArchSuffix + llvm12$secondaryArchSuffix + llvm16$secondaryArchSuffix + llvm17$secondaryArchSuffix + llvm18$secondaryArchSuffix + llvm19$secondaryArchSuffix + " + +PROVIDES_clang=" + llvm20${secondaryArchSuffix}_clang = $portVersion + cmd:amdgpu_arch = $portVersion + cmd:c_index_test = $portVersion + cmd:clang = $portVersion + cmd:clang++ = $portVersion + cmd:clang_20 = $portVersion + cmd:clang_apply_replacements = $portVersion + cmd:clang_change_namespace = $portVersion + cmd:clang_check = $portVersion + cmd:clang_cl = $portVersion + cmd:clang_cpp = $portVersion + cmd:clang_doc = $portVersion + cmd:clang_extdef_mapping = $portVersion + cmd:clang_format = $portVersion + cmd:clang_include_cleaner = $portVersion + cmd:clang_include_fixer = $portVersion + cmd:clang_installapi = $portVersion + cmd:clang_linker_wrapper = $portVersion + cmd:clang_move = $portVersion + cmd:clang_nvlink_wrapper = $portVersion + cmd:clang_offload_bundler = $portVersion + cmd:clang_offload_packager = $portVersion + cmd:clang_pseudo = $portVersion + cmd:clang_query = $portVersion + cmd:clang_refactor = $portVersion + cmd:clang_rename = $portVersion + cmd:clang_reorder_fields = $portVersion + cmd:clang_repl = $portVersion + cmd:clang_scan_deps = $portVersion + cmd:clang_sycl_linker = $portVersion + cmd:clang_tblgen = $portVersion + cmd:clang_tidy = $portVersion + cmd:clangd = $portVersion + cmd:diagtool = $portVersion + cmd:find_all_symbols = $portVersion + cmd:git_clang_format = $portVersion + cmd:hmaptool = $portVersion + cmd:modularize = $portVersion + cmd:nvptx_arch = $portVersion + cmd:pp_trace = $portVersion + cmd:run_clang_tidy = $portVersion + devel:libclang$secondaryArchSuffix = $portVersionCompat + devel:libclang_cpp$secondaryArchSuffix = $portVersionCompat + devel:libclanganalysis$secondaryArchSuffix = $portVersion + devel:libclanganalysisflowsensitive$secondaryArchSuffix = $portVersion + devel:libclanganalysisflowsensitivemodels$secondaryArchSuffix = $portVersion + devel:libclangapinotes$secondaryArchSuffix = $portVersion + devel:libclangapplyreplacements$secondaryArchSuffix = $portVersion + devel:libclangarcmigrate$secondaryArchSuffix = $portVersion + devel:libclangast$secondaryArchSuffix = $portVersion + devel:libclangastmatchers$secondaryArchSuffix = $portVersion + devel:libclangbasic$secondaryArchSuffix = $portVersion + devel:libclangchangenamespace$secondaryArchSuffix = $portVersion + devel:libclangcodegen$secondaryArchSuffix = $portVersion + devel:libclangcrosstu$secondaryArchSuffix = $portVersion + devel:libclangdaemon$secondaryArchSuffix = $portVersion + devel:libclangdaemontweaks$secondaryArchSuffix = $portVersion + devel:libclangdependencyscanning$secondaryArchSuffix = $portVersion + devel:libclangdoc$secondaryArchSuffix = $portVersion + devel:libclangdirectorywatcher$secondaryArchSuffix = $portVersion + devel:libclangdmain$secondaryArchSuffix = $portVersion + devel:libclangdremoteindex$secondaryArchSuffix = $portVersion + devel:libclangdriver$secondaryArchSuffix = $portVersion + devel:libclangdsupport$secondaryArchSuffix = $portVersion + devel:libclangdynamicastmatchers$secondaryArchSuffix = $portVersion + devel:libclangedit$secondaryArchSuffix = $portVersion + devel:libclangextractapi$secondaryArchSuffix = $portVersion + devel:libclangformat$secondaryArchSuffix = $portVersion + devel:libclangfrontend$secondaryArchSuffix = $portVersion + devel:libclangfrontendtool$secondaryArchSuffix = $portVersion + devel:libclanghandlecxx$secondaryArchSuffix = $portVersion + devel:libclanghandlellvm$secondaryArchSuffix = $portVersion + devel:libclangincludecleaner$secondaryArchSuffix = $portVersion + devel:libclangincludefixer$secondaryArchSuffix = $portVersion + devel:libclangincludefixerplugin$secondaryArchSuffix = $portVersion + devel:libclangindex$secondaryArchSuffix = $portVersion + devel:libclangindexserialization$secondaryArchSuffix = $portVersion + devel:libclanginstallapi$secondaryArchSuffix = $portVersion + devel:libclanginterpreter$secondaryArchSuffix = $portVersion + devel:libclanglex$secondaryArchSuffix = $portVersion + devel:libclangmove$secondaryArchSuffix = $portVersion + devel:libclangparse$secondaryArchSuffix = $portVersion + #devel:libclangpseudo$secondaryArchSuffix = $portVersion + devel:libclangpseudocli$secondaryArchSuffix = $portVersion + devel:libclangpseudocxx$secondaryArchSuffix = $portVersion + devel:libclangpseudogrammar$secondaryArchSuffix = $portVersion + devel:libclangquery$secondaryArchSuffix = $portVersion + devel:libclangreorderfields$secondaryArchSuffix = $portVersion + devel:libclangrewrite$secondaryArchSuffix = $portVersion + devel:libclangrewritefrontend$secondaryArchSuffix = $portVersion + devel:libclangsema$secondaryArchSuffix = $portVersion + devel:libclangserialization$secondaryArchSuffix = $portVersion + devel:libclangstaticanalyzercheckers$secondaryArchSuffix = $portVersion + devel:libclangstaticanalyzercore$secondaryArchSuffix = $portVersion + devel:libclangstaticanalyzerfrontend$secondaryArchSuffix = $portVersion + devel:libclangsupport$secondaryArchSuffix = $portVersion + devel:libclangtidy$secondaryArchSuffix = $portVersion + devel:libclangtidyabseilmodule$secondaryArchSuffix = $portVersion + devel:libclangtidyalteramodule$secondaryArchSuffix = $portVersion + devel:libclangtidyandroidmodule$secondaryArchSuffix = $portVersion + devel:libclangtidyboostmodule$secondaryArchSuffix = $portVersion + devel:libclangtidybugpronemodule$secondaryArchSuffix = $portVersion + devel:libclangtidycertmodule$secondaryArchSuffix = $portVersion + devel:libclangtidyconcurrencymodule$secondaryArchSuffix = $portVersion + devel:libclangtidycppcoreguidelinesmodule$secondaryArchSuffix = $portVersion + devel:libclangtidydarwinmodule$secondaryArchSuffix = $portVersion + devel:libclangtidyfuchsiamodule$secondaryArchSuffix = $portVersion + devel:libclangtidygooglemodule$secondaryArchSuffix = $portVersion + devel:libclangtidyhicppmodule$secondaryArchSuffix = $portVersion + devel:libclangtidylinuxkernelmodule$secondaryArchSuffix = $portVersion + devel:libclangtidyllvmlibcmodule$secondaryArchSuffix = $portVersion + devel:libclangtidyllvmmodule$secondaryArchSuffix = $portVersion + devel:libclangtidymain$secondaryArchSuffix = $portVersion + devel:libclangtidymiscmodule$secondaryArchSuffix = $portVersion + devel:libclangtidymodernizemodule$secondaryArchSuffix = $portVersion + devel:libclangtidympimodule$secondaryArchSuffix = $portVersion + devel:libclangtidyobjcmodule$secondaryArchSuffix = $portVersion + devel:libclangtidyopenmpmodule$secondaryArchSuffix = $portVersion + devel:libclangtidyperformancemodule$secondaryArchSuffix = $portVersion + devel:libclangtidyplugin$secondaryArchSuffix = $portVersion + devel:libclangtidyportabilitymodule$secondaryArchSuffix = $portVersion + devel:libclangtidyreadabilitymodule$secondaryArchSuffix = $portVersion + devel:libclangtidyutils$secondaryArchSuffix = $portVersion + devel:libclangtidyzirconmodule$secondaryArchSuffix = $portVersion + devel:libclangtooling$secondaryArchSuffix = $portVersion + devel:libclangtoolingastdiff$secondaryArchSuffix = $portVersion + devel:libclangtoolingcore$secondaryArchSuffix = $portVersion + devel:libclangtoolinginclusions$secondaryArchSuffix = $portVersion + devel:libclangtoolinginclusionsstdlib$secondaryArchSuffix = $portVersion + devel:libclangtoolingrefactoring$secondaryArchSuffix = $portVersion + devel:libclangtoolingsyntax$secondaryArchSuffix = $portVersion + devel:libclangtransformer$secondaryArchSuffix = $portVersion + lib:libclang$secondaryArchSuffix = $portVersionCompat + lib:libclang_cpp$secondaryArchSuffix = $portVersionCompat + " +REQUIRES_clang=" + haiku$secondaryArchSuffix + cmd:ld.lld + lib:libLLVM$secondaryArchSuffix + lib:libz$secondaryArchSuffix + " +CONFLICTS_clang=" + llvm9${secondaryArchSuffix}_clang + llvm12${secondaryArchSuffix}_clang + llvm16${secondaryArchSuffix}_clang + llvm17${secondaryArchSuffix}_clang + llvm18${secondaryArchSuffix}_clang + llvm19${secondaryArchSuffix}_clang + " + +PROVIDES_clang_analysis=" + llvm20${secondaryArchSuffix}_clang_analysis = $portVersion + cmd:analyze_build = $portVersion + cmd:intercept_build = $portVersion + cmd:scan_build = $portVersion + cmd:scan_build_py = $portVersion + cmd:scan_view = $portVersion + " +REQUIRES_clang_analysis=" + llvm20${secondaryArchSuffix}_clang == $portVersion base + cmd:python3 + " +CONFLICTS_clang_analysis=" + llvm9${secondaryArchSuffix}_clang_analysis + llvm12${secondaryArchSuffix}_clang_analysis + llvm16${secondaryArchSuffix}_clang_analysis + llvm17${secondaryArchSuffix}_clang_analysis + llvm18${secondaryArchSuffix}_clang_analysis + llvm19${secondaryArchSuffix}_clang_analysis + " + +PROVIDES_lld=" + llvm20${secondaryArchSuffix}_lld = $portVersion + cmd:ld.lld = $portVersion + cmd:ld64.lld = $portVersion + cmd:lld = $portVersion + cmd:lld_link = $portVersion + cmd:wasm_ld = $portVersion + devel:liblldCOFF$secondaryArchSuffix = $portVersion + devel:liblldCommon$secondaryArchSuffix = $portVersion + devel:liblldELF$secondaryArchSuffix = $portVersion + devel:liblldMinGW$secondaryArchSuffix = $portVersion + devel:liblldWasm$secondaryArchSuffix = $portVersion + " +REQUIRES_lld=" + haiku$secondaryArchSuffix + lib:libLLVM$secondaryArchSuffix + lib:libz$secondaryArchSuffix + " + +PROVIDES_libs=" + llvm20${secondaryArchSuffix}_libs = $portVersion + lib:libLLVM$secondaryArchSuffix = $portVersionCompat + lib:libLTO$secondaryArchSuffix = $portVersionCompat + lib:libRemarks$secondaryArchSuffix = $portVersionCompat + " +REQUIRES_libs=" + haiku$secondaryArchSuffix + lib:libz$secondaryArchSuffix + " + +PYTHON3_VERSION="3.10" +PROVIDES_python310=" + llvm20${secondaryArchSuffix}_python310 = $portVersion + cmd:lit + " +REQUIRES_python310=" + setuptools_python310 + cmd:python$PYTHON3_VERSION + " + +libunwindSoVersion="1" +libunwindLibVersion="1.0" +SUMMARY_libunwind="LLVM Unwinder - libunwind" +DESCRIPTION_libunwind="libunwind is an implementation of the interface defined \ +by the HP libunwind project. It was contributed by Apple as a way to enable \ +clang++ to port to platforms that do not have a system unwinder. It is \ +intended to be a small and fast implementation of the ABI, leaving off some \ +features of HP's libunwind that never materialized (e.g. remote unwinding). + +The unwinder has two levels of API. The high level APIs are the _Unwind_* \ +functions which implement functionality required by __cxa_* exception \ +functions. The low level APIs are the unw_* functions which are an \ +interface defined by the old HP libunwind project." +PROVIDES_libunwind=" + llvm20${secondaryArchSuffix}_libunwind = $portVersion + lib:libunwind$secondaryArchSuffix = $libunwindLibVersion compat >= $libunwindSoVersion + " +REQUIRES_libunwind=" + haiku$secondaryArchSuffix + " +CONFLICTS_libunwind=" + llvm12${secondaryArchSuffix}_libunwind + llvm16${secondaryArchSuffix}_libunwind + llvm17${secondaryArchSuffix}_libunwind + llvm18${secondaryArchSuffix}_libunwind + llvm19${secondaryArchSuffix}_libunwind + " + +SUMMARY_libunwind_devel="Headers and static libraries for LLVM Unwinder - libunwind" +DESCRIPTION_libunwind_devel="libunwind is an implementation of the interface \ +defined by the HP libunwind project. It was contributed by Apple as a way to \ +enable clang++ to port to platforms that do not have a system unwinder. It is \ +intended to be a small and fast implementation of the ABI, leaving off some \ +features of HP's libunwind that never materialized (e.g. remote unwinding). + +The unwinder has two levels of API. The high level APIs are the _Unwind_* \ +functions which implement functionality required by __cxa_* exception \ +functions. The low level APIs are the unw_* functions which are an \ +interface defined by the old HP libunwind project." +PROVIDES_libunwind_devel=" + llvm20${secondaryArchSuffix}_libunwind_devel = $portVersion + devel:libunwind$secondaryArchSuffix = $libunwindLibVersion compat >= $libunwindSoVersion + " +REQUIRES_libunwind_devel=" + llvm20${secondaryArchSuffix}_libunwind == $portVersion base + haiku${secondaryArchSuffix}_devel + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + devel:libz$secondaryArchSuffix + setuptools_python310 + " +BUILD_PREREQUIRES=" + cmd:cmake + cmd:diff + cmd:find + cmd:gcc$secondaryArchSuffix + cmd:grep + cmd:groff + cmd:ld$secondaryArchSuffix + cmd:make + cmd:ninja + cmd:python$PYTHON3_VERSION + cmd:sed + " + +BUILD() +{ + local cmakeFlags + if [ -n "$secondaryArchSuffix" ]; then + cmakeFlags=-DHAIKU_HYBRID_SECONDARY="\"${effectiveTargetArchitecture}\"" + cmakeFlags="$cmakeFlags -DLLVM_LIBDIR_SUFFIX=/${effectiveTargetArchitecture}" + fi + + # Haiku C++ requires rtti in a lot of central system components + # such as Mesa + + # LLVM in default targets AArch64, AMDGPU, ARM, AVR, BPF, Hexagon, Lanai, \ + # Mips, MSP430, NVPTX, PowerPC, RISCV, Sparc, SystemZ, WebAssembly, X86, \ + # XCore on Haiku. There is currently no good reason to build all of those. + + if [ "$targetArchitecture" = x86_gcc2 ];then + export LIBRARY_PATH=$LIBRARY_PATH:$sourceDir/build/lib/x86 + else + export LIBRARY_PATH=$LIBRARY_PATH:$sourceDir/build/lib + fi + + cmake -S llvm -B build -G Ninja \ + $cmakeDirArgs \ + -DCMAKE_BUILD_TYPE=Release \ + $cmakeFlags \ + -DCMAKE_INSTALL_BINDIR=bin \ + -DCMAKE_SKIP_RPATH=YES \ + -DCOMPILER_RT_BUILD_SANITIZERS=OFF \ + -DLLVM_ENABLE_RTTI=ON -DLLVM_LINK_LLVM_DYLIB=YES \ + -DLIBUNWIND_ENABLE_STATIC=OFF \ + -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;compiler-rt" \ + -DLLVM_ENABLE_RUNTIMES="libunwind" \ + -DLLVM_TARGETS_TO_BUILD="AArch64;AMDGPU;ARM;RISCV;WebAssembly;X86" + + cmake --build build $jobArgs +} + +INSTALL() +{ + if [ -n "$secondaryArchSuffix" ]; then + binDir=$prefix/bin + fi + + cmake --install build + + cd build + mkdir -p $binDir $developDir $dataDir $docDir $includeDir $manDir $libDir + + # GENERIC: all python_setuptools-based installs need this + local pythonPackageName="${portName}_python310-$portFullVersion" + local packageLinksDir=$(dirname $portPackageLinksDir) + python=$packageLinksDir/${pythonPackageName}/cmd~python$PYTHON3_VERSION/bin/python$PYTHON3_VERSION + pythonVersion=$($python --version 2>&1 | sed 's/Python //' | head -c3) + installLocation=$prefix/lib/python$pythonVersion/vendor-packages/ + export PYTHONPATH=$installLocation:$OLDPYTHONPATH + + pushd ../llvm/utils/lit + $python setup.py install --root=/ --prefix="$prefix" -O1 + popd + + # You can try and be fancy here parsing each arch in a for loop... but + # not all arches contain the same libraries. The inventory for each arch + # also changes between releases... so lets KISS. + prepareInstalledDevelLibs \ + libclang \ + libclang-cpp \ + libclangAPINotes \ + libclangARCMigrate \ + libclangAST \ + libclangASTMatchers \ + libclangAnalysis \ + libclangAnalysisFlowSensitive \ + libclangAnalysisFlowSensitiveModels \ + libclangApplyReplacements \ + libclangBasic \ + libclangChangeNamespace \ + libclangCodeGen \ + libclangCrossTU \ + libclangDaemon \ + libclangDaemonTweaks \ + libclangDependencyScanning \ + libclangDirectoryWatcher \ + libclangDoc \ + libclangDriver \ + libclangDynamicASTMatchers \ + libclangEdit \ + libclangExtractAPI \ + libclangFormat \ + libclangFrontend \ + libclangFrontendTool \ + libclangHandleCXX \ + libclangHandleLLVM \ + libclangIncludeCleaner \ + libclangIncludeFixer \ + libclangIncludeFixerPlugin \ + libclangIndex \ + libclangIndexSerialization \ + libclangInstallAPI \ + libclangInterpreter \ + libclangLex \ + libclangMove \ + libclangParse \ + libclangQuery \ + libclangReorderFields \ + libclangRewrite \ + libclangRewriteFrontend \ + libclangSema \ + libclangSerialization \ + libclangStaticAnalyzerCheckers \ + libclangStaticAnalyzerCore \ + libclangStaticAnalyzerFrontend \ + libclangSupport \ + libclangTidy \ + libclangTidyAbseilModule \ + libclangTidyAlteraModule \ + libclangTidyAndroidModule \ + libclangTidyBoostModule \ + libclangTidyBugproneModule \ + libclangTidyCERTModule \ + libclangTidyConcurrencyModule \ + libclangTidyCppCoreGuidelinesModule \ + libclangTidyDarwinModule \ + libclangTidyFuchsiaModule \ + libclangTidyGoogleModule \ + libclangTidyHICPPModule \ + libclangTidyLLVMLibcModule \ + libclangTidyLLVMModule \ + libclangTidyLinuxKernelModule \ + libclangTidyMPIModule \ + libclangTidyMain \ + libclangTidyMiscModule \ + libclangTidyModernizeModule \ + libclangTidyObjCModule \ + libclangTidyOpenMPModule \ + libclangTidyPerformanceModule \ + libclangTidyPlugin \ + libclangTidyPortabilityModule \ + libclangTidyReadabilityModule \ + libclangTidyUtils \ + libclangTidyZirconModule \ + libclangTooling \ + libclangToolingASTDiff \ + libclangToolingCore \ + libclangToolingInclusions \ + libclangToolingInclusionsStdlib \ + libclangToolingRefactoring \ + libclangToolingSyntax \ + libclangTransformer \ + libclangdMain \ + libclangdRemoteIndex \ + libclangdSupport \ + libfindAllSymbols \ + libLLVM* \ + libLTO \ + liblld* \ + libRemarks \ + libunwind + + # adjust cmake library paths because prepareInstalledDevelLibs moved them + sed -i 's,\${_IMPORT_PREFIX}/lib/,\${_IMPORT_PREFIX}/develop/lib/,' \ + $libDir/cmake/clang/ClangTargets-release.cmake \ + $libDir/cmake/lld/LLDTargets-release.cmake \ + $libDir/cmake/llvm/LLVMExports-release.cmake + + mv $prefix/include/* $includeDir/ + rmdir $prefix/include + + # clang package + packageEntries clang \ + $binDir/amdgpu-arch \ + $binDir/c-index-test \ + $binDir/clang* \ + $binDir/diagtool \ + $binDir/find-all-symbols \ + $binDir/git-clang-format \ + $binDir/hmaptool \ + $binDir/modularize \ + $binDir/nvptx-arch \ + $binDir/pp-trace \ + $binDir/run-clang-tidy \ + $dataDir/clang \ + $includeDir/clang* \ + $libDir/clang \ + $libDir/libclang* \ + $libDir/cmake/clang \ + $developLibDir/libclang* + + # analysis package + packageEntries clang_analysis \ + $binDir/analyze-build \ + $binDir/intercept-build \ + $binDir/scan-build \ + $binDir/scan-build-py \ + $binDir/scan-view \ + $libExecDir/c++-analyzer \ + $libExecDir/ccc-analyzer \ + $dataDir/scan-build \ + $dataDir/scan-view \ + $manDir/man1/scan-build.1 + + # lld package + packageEntries lld \ + $binDir/ld.lld \ + $binDir/ld64.lld \ + $binDir/lld \ + $binDir/lld-link \ + $binDir/wasm-ld \ + $includeDir/lld* \ + $developLibDir/liblld* + + # libs package + packageEntries libs \ + $libDir/libLLVM* \ + $libDir/libLTO* \ + $libDir/libRemarks* + + # python310 package + packageEntries python310 \ + $prefix/bin/lit \ + $prefix/lib/python* + + # libunwind package + packageEntries libunwind \ + $libDir/libunwind* + + packageEntries libunwind_devel \ + $developLibDir/libunwind* \ + $includeDir/unwind*.h \ + $includeDir/libunwind*.h \ + $includeDir/libunwind.modulemap \ + $includeDir/__libunwind*.h \ + $includeDir/mach-o/compact_unwind_encoding.h + + # Remove empty folders + rmdir $includeDir/mach-o + rmdir $manDir/man1 + rmdir $manDir +} + +TEST() +{ + export LIT_ARGS="-v" + if [ "$targetArchitecture" = x86_gcc2 ];then + export LIBRARY_PATH=$LIBRARY_PATH:$sourceDir/build/lib/x86 + else + export LIBRARY_PATH=$LIBRARY_PATH:$sourceDir/build/lib + fi + ninja -C build check-llvm check-compiler-rt check-unwind +} diff --git a/sys-devel/llvm/patches/llvm20-20.1.0.patchset b/sys-devel/llvm/patches/llvm20-20.1.0.patchset new file mode 100644 index 000000000..edf68bb2a --- /dev/null +++ b/sys-devel/llvm/patches/llvm20-20.1.0.patchset @@ -0,0 +1,371 @@ +From 920df4d90d7b5b1ecdfb6033bf39fd9619d13421 Mon Sep 17 00:00:00 2001 +From: Calvin Hill +Date: Sun, 9 Sep 2018 16:11:42 +0100 +Subject: llvm: import header dir suffix patch from 3dEyes + + +diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp +index d5b76b1..df3fb59 100644 +--- a/llvm/tools/llvm-config/llvm-config.cpp ++++ b/llvm/tools/llvm-config/llvm-config.cpp +@@ -366,7 +366,11 @@ int main(int argc, char **argv) { + sys::fs::make_absolute(ActivePrefix, Path); + ActiveBinDir = std::string(Path); + } ++#ifdef __HAIKU__ ++ ActiveLibDir = ActivePrefix + "/develop/lib" + LLVM_LIBDIR_SUFFIX; ++#else + ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX; ++#endif + { + SmallString<256> Path(LLVM_INSTALL_PACKAGE_DIR); + sys::fs::make_absolute(ActivePrefix, Path); +-- +2.45.2 + + +From ed3025a659d54efbb542f9a3d8efe8bc331d1a8c Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Sat, 3 Apr 2021 23:23:24 +0200 +Subject: lld: MachO needs libunwind somehow, disable + + +diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt +index 64c9f23..38168f3 100644 +--- a/lld/CMakeLists.txt ++++ b/lld/CMakeLists.txt +@@ -203,7 +203,9 @@ endif() + add_subdirectory(docs) + add_subdirectory(COFF) + add_subdirectory(ELF) ++if (NOT HAIKU) + add_subdirectory(MachO) ++endif() + add_subdirectory(MinGW) + add_subdirectory(wasm) + +diff --git a/lld/include/lld/Common/Driver.h b/lld/include/lld/Common/Driver.h +index 8520e6e..9562ab7 100644 +--- a/lld/include/lld/Common/Driver.h ++++ b/lld/include/lld/Common/Driver.h +@@ -58,6 +58,15 @@ Result lldMain(llvm::ArrayRef args, llvm::raw_ostream &stdoutOS, + + // An array which declares that all LLD drivers are linked in your executable. + // Must be used along with LLD_HAS_DRIVERS. See examples in LLD unittests. ++#ifdef __HAIKU__ ++#define LLD_ALL_DRIVERS \ ++ { \ ++ {lld::WinLink, &lld::coff::link}, {lld::Gnu, &lld::elf::link}, \ ++ {lld::MinGW, &lld::mingw::link}, { \ ++ lld::Wasm, &lld::wasm::link \ ++ } \ ++ } ++#else + #define LLD_ALL_DRIVERS \ + { \ + {lld::WinLink, &lld::coff::link}, {lld::Gnu, &lld::elf::link}, \ +@@ -65,5 +74,6 @@ Result lldMain(llvm::ArrayRef args, llvm::raw_ostream &stdoutOS, + lld::Wasm, &lld::wasm::link \ + } \ + } ++#endif + + #endif +diff --git a/lld/tools/lld/CMakeLists.txt b/lld/tools/lld/CMakeLists.txt +index 8498a91..bbbfe80 100644 +--- a/lld/tools/lld/CMakeLists.txt ++++ b/lld/tools/lld/CMakeLists.txt +@@ -24,6 +24,16 @@ function(lld_target_link_libraries target type) + target_link_libraries(${target} ${type} ${ARGN}) + endfunction() + ++if (HAIKU) ++lld_target_link_libraries(lld ++ PRIVATE ++ lldCommon ++ lldCOFF ++ lldELF ++ lldMinGW ++ lldWasm ++ ) ++else() + lld_target_link_libraries(lld + PRIVATE + lldCommon +@@ -33,6 +43,7 @@ lld_target_link_libraries(lld + lldMinGW + lldWasm + ) ++endif() + + if(NOT LLD_SYMLINKS_TO_CREATE) + set(LLD_SYMLINKS_TO_CREATE +diff --git a/lld/tools/lld/lld.cpp b/lld/tools/lld/lld.cpp +index d6800fa..d2bac9f 100644 +--- a/lld/tools/lld/lld.cpp ++++ b/lld/tools/lld/lld.cpp +@@ -69,7 +69,9 @@ static unsigned inTestVerbosity() { + LLD_HAS_DRIVER(coff) + LLD_HAS_DRIVER(elf) + LLD_HAS_DRIVER(mingw) ++#ifndef __HAIKU__ + LLD_HAS_DRIVER(macho) ++#endif + LLD_HAS_DRIVER(wasm) + + int lld_main(int argc, char **argv, const llvm::ToolContext &) { +-- +2.45.2 + + +From 81a00ba4632a38984abc8bf5400d14e1da394b35 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= +Date: Mon, 18 Jul 2016 14:13:19 +0200 +Subject: clang: support for secondary arch. + + +diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt +index 24e656e..ea63eaf 100644 +--- a/clang/CMakeLists.txt ++++ b/clang/CMakeLists.txt +@@ -362,6 +362,10 @@ if (APPLE AND NOT CMAKE_LINKER MATCHES ".*lld.*") + get_darwin_linker_version(HOST_LINK_VERSION) + message(STATUS "Host linker version: ${HOST_LINK_VERSION}") + endif() ++if(DEFINED HAIKU_HYBRID_SECONDARY) ++ add_definitions(-DHAIKU_HYBRID_SECONDARY=${HAIKU_HYBRID_SECONDARY}) ++endif() ++ + + include(AddClang) + +diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp +index f56eeda..dd55d89 100644 +--- a/clang/lib/Driver/ToolChains/Gnu.cpp ++++ b/clang/lib/Driver/ToolChains/Gnu.cpp +@@ -2336,7 +2336,11 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( + StringRef SysRoot) { + + if (TargetTriple.isOSHaiku()) { ++#ifdef HAIKU_HYBRID_SECONDARY ++ Prefixes.push_back(concat(SysRoot, "/boot/system/develop/tools/" HAIKU_HYBRID_SECONDARY)); ++#else + Prefixes.push_back(concat(SysRoot, "/boot/system/develop/tools")); ++#endif + return; + } + +diff --git a/clang/lib/Driver/ToolChains/Haiku.cpp b/clang/lib/Driver/ToolChains/Haiku.cpp +index af74f43..fa3f8cb 100644 +--- a/clang/lib/Driver/ToolChains/Haiku.cpp ++++ b/clang/lib/Driver/ToolChains/Haiku.cpp +@@ -168,8 +168,16 @@ Haiku::Haiku(const Driver &D, const llvm::Triple& Triple, const ArgList &Args) + + GCCInstallation.init(Triple, Args); + ++#ifdef HAIKU_HYBRID_SECONDARY ++ getProgramPaths().insert(getProgramPaths().begin(), getDriver().SysRoot ++ + "/boot/system/bin/" HAIKU_HYBRID_SECONDARY); ++ getFilePaths().clear(); ++ getFilePaths().push_back(getDriver().SysRoot + "/boot/system/lib/" HAIKU_HYBRID_SECONDARY); ++ getFilePaths().push_back(getDriver().SysRoot + "/boot/system/develop/lib/" HAIKU_HYBRID_SECONDARY); ++#else + getFilePaths().push_back(concat(getDriver().SysRoot, "/boot/system/lib")); + getFilePaths().push_back(concat(getDriver().SysRoot, "/boot/system/develop/lib")); ++#endif + + if (GCCInstallation.isValid()) + getFilePaths().push_back(GCCInstallation.getInstallPath().str()); +@@ -204,8 +212,14 @@ void Haiku::AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, + return; + } + ++#ifdef HAIKU_HYBRID_SECONDARY ++ addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, ++ "/boot/system/non-packaged/develop/headers/" ++ HAIKU_HYBRID_SECONDARY)); ++#else + addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, + "/boot/system/non-packaged/develop/headers")); ++#endif + addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, + "/boot/system/develop/headers/os")); + addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, +@@ -268,6 +282,17 @@ void Haiku::AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, + "/boot/system/develop/headers/gnu")); + addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, + "/boot/system/develop/headers/posix")); ++#ifdef HAIKU_HYBRID_SECONDARY ++ addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, ++ "/boot/system/develop/headers/" ++ HAIKU_HYBRID_SECONDARY)); ++ addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, ++ "/boot/system/develop/headers/" ++ HAIKU_HYBRID_SECONDARY "/os")); ++ addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, ++ "/boot/system/develop/headers/" ++ HAIKU_HYBRID_SECONDARY "/os/opengl")); ++#endif + addSystemInclude(DriverArgs, CC1Args, concat(D.SysRoot, + "/boot/system/develop/headers")); + } +-- +2.45.2 + + +From b1640acf15be9cb605135329e734f9ee07b2b5bd Mon Sep 17 00:00:00 2001 +From: David Karoly +Date: Thu, 21 Sep 2023 17:44:12 +0000 +Subject: fix build on x86 secondary arch + + +diff --git a/clang/lib/Headers/CMakeLists.txt b/clang/lib/Headers/CMakeLists.txt +index 4312411..04db3fb 100644 +--- a/clang/lib/Headers/CMakeLists.txt ++++ b/clang/lib/Headers/CMakeLists.txt +@@ -384,7 +384,7 @@ set(zos_wrapper_files + ) + + include(GetClangResourceDir) +-get_clang_resource_dir(output_dir PREFIX ${LLVM_LIBRARY_OUTPUT_INTDIR}/.. SUBDIR include) ++get_clang_resource_dir(output_dir PREFIX ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR} SUBDIR include) + set(out_files) + set(generated_files) + +-- +2.45.2 + + +From d58666b39f5bde76bb6decb8ee36a7f3b6ac714a Mon Sep 17 00:00:00 2001 +From: David Karoly +Date: Mon, 6 Nov 2023 14:24:21 +0100 +Subject: clang: Haiku: patch for analyzer scripts + + +diff --git a/clang/tools/scan-build/bin/scan-build b/clang/tools/scan-build/bin/scan-build +index b90e635..09105ca 100755 +--- a/clang/tools/scan-build/bin/scan-build ++++ b/clang/tools/scan-build/bin/scan-build +@@ -447,7 +447,7 @@ sub CopyFiles { + + my $Dir = shift; + +- my $JS = Cwd::realpath("$RealBin/../share/scan-build/sorttable.js"); ++ my $JS = Cwd::realpath("$RealBin/../data/scan-build/sorttable.js"); + + DieDiag("Cannot find 'sorttable.js'.\n") + if (! -r $JS); +@@ -457,7 +457,7 @@ sub CopyFiles { + DieDiag("Could not copy 'sorttable.js' to '$Dir'.\n") + if (! -r "$Dir/sorttable.js"); + +- my $CSS = Cwd::realpath("$RealBin/../share/scan-build/scanview.css"); ++ my $CSS = Cwd::realpath("$RealBin/../data/scan-build/scanview.css"); + + DieDiag("Cannot find 'scanview.css'.\n") + if (! -r $CSS); +@@ -1908,8 +1908,8 @@ if ($Clang !~ /\+\+(\.exe)?$/) { + + # Determine the location of ccc-analyzer. + my $AbsRealBin = Cwd::realpath($RealBin); +-my $Cmd = "$AbsRealBin/../libexec/ccc-analyzer"; +-my $CmdCXX = "$AbsRealBin/../libexec/c++-analyzer"; ++my $Cmd = "$AbsRealBin/../lib/ccc-analyzer"; ++my $CmdCXX = "$AbsRealBin/../lib/c++-analyzer"; + + # Portability: use less strict but portable check -e (file exists) instead of + # non-portable -x (file is executable). On some windows ports -x just checks +diff --git a/clang/tools/scan-view/bin/scan-view b/clang/tools/scan-view/bin/scan-view +index d01aebb..43ba8c3 100755 +--- a/clang/tools/scan-view/bin/scan-view ++++ b/clang/tools/scan-view/bin/scan-view +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + + from __future__ import print_function + +@@ -64,7 +64,7 @@ def start_browser(port, options): + + def run(port, options, root): + # Prefer to look relative to the installed binary +- share = os.path.dirname(__file__) + "/../share/scan-view" ++ share = os.path.dirname(__file__) + "/../data/scan-view" + if not os.path.isdir(share): + # Otherwise look relative to the source + share = os.path.dirname(__file__) + "/../../scan-view/share" +-- +2.45.2 + + +From 663b4882ccb14afa66202cf7337ac5d7acebc0db Mon Sep 17 00:00:00 2001 +From: Brad Smith +Date: Mon, 10 Jun 2024 11:13:29 +0200 +Subject: A slightly better llvm-config diff that doesn't use #ifdef. + + +diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp +index df3fb59..30cb748 100644 +--- a/llvm/tools/llvm-config/llvm-config.cpp ++++ b/llvm/tools/llvm-config/llvm-config.cpp +@@ -327,6 +327,7 @@ int main(int argc, char **argv) { + std::string ActivePrefix, ActiveBinDir, ActiveIncludeDir, ActiveLibDir, + ActiveCMakeDir; + std::string ActiveIncludeOption; ++ const Triple HostTriple(Triple::normalize(LLVM_HOST_TRIPLE)); + if (IsInDevelopmentTree) { + ActiveIncludeDir = std::string(LLVM_SRC_ROOT) + "/include"; + ActivePrefix = CurrentExecPrefix; +@@ -366,11 +367,10 @@ int main(int argc, char **argv) { + sys::fs::make_absolute(ActivePrefix, Path); + ActiveBinDir = std::string(Path); + } +-#ifdef __HAIKU__ +- ActiveLibDir = ActivePrefix + "/develop/lib" + LLVM_LIBDIR_SUFFIX; +-#else +- ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX; +-#endif ++ if (HostTriple.isOSHaiku()) ++ ActiveLibDir = ActivePrefix + "/develop/lib" + LLVM_LIBDIR_SUFFIX; ++ else ++ ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX; + { + SmallString<256> Path(LLVM_INSTALL_PACKAGE_DIR); + sys::fs::make_absolute(ActivePrefix, Path); +@@ -389,7 +389,6 @@ int main(int argc, char **argv) { + StringRef SharedExt, SharedVersionedExt, SharedDir, SharedPrefix, StaticExt, + StaticPrefix, StaticDir = "lib"; + std::string DirSep = "/"; +- const Triple HostTriple(Triple::normalize(LLVM_HOST_TRIPLE)); + if (HostTriple.isOSWindows()) { + SharedExt = "dll"; + SharedVersionedExt = LLVM_DYLIB_VERSION ".dll"; +-- +2.45.2 + + +From 09b123858f988a81b865efbaa682d030cad10512 Mon Sep 17 00:00:00 2001 +From: Gerasim Troeglazov <3dEyes@gmail.com> +Date: Sun, 19 May 2024 10:31:55 +0200 +Subject: Allow linking gcc compiled code with lld + +https://github.com/haikuports/haikuports/issues/10445 + +diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp +index a1e9eca..cc563d7 100644 +--- a/lld/ELF/Driver.cpp ++++ b/lld/ELF/Driver.cpp +@@ -174,8 +174,8 @@ static std::tuple parseEmulation(Ctx &ctx, + .Case("elf64lriscv", {ELF64LEKind, EM_RISCV}) + .Case("elf64ppc", {ELF64BEKind, EM_PPC64}) + .Case("elf64lppc", {ELF64LEKind, EM_PPC64}) +- .Cases("elf_amd64", "elf_x86_64", {ELF64LEKind, EM_X86_64}) +- .Case("elf_i386", {ELF32LEKind, EM_386}) ++ .Cases("elf_amd64", "elf_x86_64", "elf_x86_64_haiku", {ELF64LEKind, EM_X86_64}) ++ .Cases("elf_i386", "elf_i386_haiku", {ELF32LEKind, EM_386}) + .Case("elf_iamcu", {ELF32LEKind, EM_IAMCU}) + .Case("elf64_sparc", {ELF64BEKind, EM_SPARCV9}) + .Case("msp430elf", {ELF32LEKind, EM_MSP430}) +-- +2.45.2 +