llvm19: new recipe

This commit is contained in:
Jérôme Duval
2024-11-06 19:54:35 +01:00
parent 9f2b9e8b4b
commit 9727d53c1a
2 changed files with 1544 additions and 0 deletions

View File

@@ -0,0 +1,803 @@
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-2024 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="324d483ff0b714c8ce7819a1b679dd9e4706cf91c6caf7336dc4ac0c1d3bf636"
SOURCE_DIR="llvm-project-$portVersion.src"
PATCHES="llvm19-$portVersion.patchset"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
portVersionCompat="$portVersion compat >= ${portVersion%%.*}"
PROVIDES="
llvm19$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_config = $portVersionCompat
cmd:llvm_cov
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_19$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: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:libLLVMExegesisX86$secondaryArchSuffix
devel:libLLVMExtensions$secondaryArchSuffix
devel:libLLVMFileCheck$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: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
"
PROVIDES_clang="
llvm19${secondaryArchSuffix}_clang = $portVersion
cmd:amdgpu_arch = $portVersion
cmd:c_index_test = $portVersion
cmd:clang = $portVersion
cmd:clang++ = $portVersion
cmd:clang_19 = $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_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
"
PROVIDES_clang_analysis="
llvm19${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="
llvm19${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
"
PROVIDES_lld="
llvm19${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="
llvm19${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="
llvm19${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="
llvm19${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
"
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="
llvm19${secondaryArchSuffix}_libunwind_devel = $portVersion
devel:libunwind$secondaryArchSuffix = $libunwindLibVersion compat >= $libunwindSoVersion
"
REQUIRES_libunwind_devel="
llvm19${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 \
libclangPseudo \
libclangPseudoCLI \
libclangPseudoCXX \
libclangPseudoGrammar \
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
}

View File

@@ -0,0 +1,741 @@
From 59a56fb3717dd70ef2a0a1c98492d57e8511f8e6 Mon Sep 17 00:00:00 2001
From: Calvin Hill <calvin@hakobaito.co.uk>
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 f7ce5d413599ef3a3bc747222d78eb0c5ab8d7c0 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
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<const char *> 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<const char *> 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 527cb07241fd921779e86dde54d2faa5d80f56ef Mon Sep 17 00:00:00 2001
From: Trung Nguyen <trungnt282910@gmail.com>
Date: Thu, 7 Jul 2022 22:19:34 +0700
Subject: libunwind: Haiku: Initial support
diff --git a/libunwind/cmake/config-ix.cmake b/libunwind/cmake/config-ix.cmake
index 126c872..d4b8610 100644
--- a/libunwind/cmake/config-ix.cmake
+++ b/libunwind/cmake/config-ix.cmake
@@ -125,5 +125,6 @@ else()
endif()
if(HAIKU)
+ set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_DEFAULT_SOURCE")
check_library_exists(bsd dl_iterate_phdr "" LIBUNWIND_HAS_BSD_LIB)
endif()
diff --git a/libunwind/src/CMakeLists.txt b/libunwind/src/CMakeLists.txt
index 780430b..2ffaf45 100644
--- a/libunwind/src/CMakeLists.txt
+++ b/libunwind/src/CMakeLists.txt
@@ -118,10 +118,27 @@ if (HAIKU)
add_library_flags_if(LIBUNWIND_HAS_ROOT_LIB root)
add_library_flags_if(LIBUNWIND_HAS_BSD_LIB bsd)
+ add_compile_flags_if(LIBUNWIND_HAS_BSD_LIB -D_DEFAULT_SOURCE=1)
add_compile_flags_if(LIBUNWIND_HAS_BSD_LIB -D_LIBUNWIND_USE_HAIKU_BSD_LIB=1)
add_compile_flags("-D_DEFAULT_SOURCE")
add_compile_flags("-DPT_GNU_EH_FRAME=PT_EH_FRAME")
+
+ find_path(LIBUNWIND_HAIKU_PRIVATE_HEADERS
+ "commpage_defs.h"
+ PATHS ${CMAKE_SYSTEM_INCLUDE_PATH}
+ PATH_SUFFIXES "/private/system"
+ NO_DEFAULT_PATH
+ REQUIRED)
+
+ include_directories(SYSTEM "${LIBUNWIND_HAIKU_PRIVATE_HEADERS}")
+ if (LIBUNWIND_TARGET_TRIPLE)
+ if (${LIBUNWIND_TARGET_TRIPLE} MATCHES "^x86_64")
+ include_directories(SYSTEM "${LIBUNWIND_HAIKU_PRIVATE_HEADERS}/arch/x86_64")
+ endif()
+ else()
+ include_directories(SYSTEM "${LIBUNWIND_HAIKU_PRIVATE_HEADERS}/arch/${CMAKE_SYSTEM_PROCESSOR}")
+ endif()
endif ()
string(REPLACE ";" " " LIBUNWIND_COMPILE_FLAGS "${LIBUNWIND_COMPILE_FLAGS}")
--
2.45.2
From 3b1802d1c1ff0d06c52e2dd0f1da751a99c64a3a Mon Sep 17 00:00:00 2001
From: X512 <danger_mail@list.ru>
Date: Wed, 16 Mar 2022 07:04:18 +0900
Subject: libunwind: Haiku: Signal frame unwinding support
diff --git a/libunwind/src/UnwindCursor.hpp b/libunwind/src/UnwindCursor.hpp
index 06e6541..19fd8a7 100644
--- a/libunwind/src/UnwindCursor.hpp
+++ b/libunwind/src/UnwindCursor.hpp
@@ -1010,6 +1010,9 @@ private:
template <typename Registers> int stepThroughSigReturn(Registers &) {
return UNW_STEP_END;
}
+#elif defined(_LIBUNWIND_TARGET_HAIKU) && defined(_LIBUNWIND_TARGET_X86_64)
+ bool setInfoForSigReturn();
+ int stepThroughSigReturn();
#endif
#if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
@@ -1313,7 +1316,8 @@ private:
unw_proc_info_t _info;
bool _unwindInfoMissing;
bool _isSignalFrame;
-#if defined(_LIBUNWIND_CHECK_LINUX_SIGRETURN)
+#if defined(_LIBUNWIND_CHECK_LINUX_SIGRETURN) \
+ || defined(_LIBUNWIND_TARGET_HAIKU) && defined(_LIBUNWIND_TARGET_X86_64)
bool _isSigReturn = false;
#endif
};
@@ -2557,7 +2561,8 @@ int UnwindCursor<A, R>::stepWithTBTable(pint_t pc, tbtable *TBTable,
template <typename A, typename R>
void UnwindCursor<A, R>::setInfoBasedOnIPRegister(bool isReturnAddress) {
-#if defined(_LIBUNWIND_CHECK_LINUX_SIGRETURN)
+#if defined(_LIBUNWIND_CHECK_LINUX_SIGRETURN) \
+ || defined(_LIBUNWIND_TARGET_HAIKU) && defined(_LIBUNWIND_TARGET_X86_64)
_isSigReturn = false;
#endif
@@ -2681,7 +2686,8 @@ void UnwindCursor<A, R>::setInfoBasedOnIPRegister(bool isReturnAddress) {
}
#endif // #if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND)
-#if defined(_LIBUNWIND_CHECK_LINUX_SIGRETURN)
+#if defined(_LIBUNWIND_CHECK_LINUX_SIGRETURN) \
+ || defined(_LIBUNWIND_TARGET_HAIKU) && defined(_LIBUNWIND_TARGET_X86_64)
if (setInfoForSigReturn())
return;
#endif
@@ -2757,6 +2763,65 @@ int UnwindCursor<A, R>::stepThroughSigReturn(Registers_arm64 &) {
_isSignalFrame = true;
return UNW_STEP_SUCCESS;
}
+#elif defined(_LIBUNWIND_TARGET_HAIKU) && defined(_LIBUNWIND_TARGET_X86_64)
+
+#include <commpage_defs.h>
+#include <signal.h>
+
+extern "C" {
+extern void *__gCommPageAddress;
+}
+
+template <typename A, typename R>
+bool UnwindCursor<A, R>::setInfoForSigReturn() {
+#if defined(_LIBUNWIND_TARGET_X86_64)
+ addr_t signal_handler = (((addr_t*)__gCommPageAddress)[COMMPAGE_ENTRY_X86_SIGNAL_HANDLER] + (addr_t)__gCommPageAddress);
+ addr_t signal_handler_ret = signal_handler + 45;
+#endif
+ pint_t pc = static_cast<pint_t>(this->getReg(UNW_REG_IP));
+ if (pc == signal_handler_ret) {
+ //printf("signal frame detected\n");
+ _info = {};
+ _info.start_ip = signal_handler;
+ _info.end_ip = signal_handler_ret;
+ _isSigReturn = true;
+ return true;
+ }
+ return false;
+}
+
+template <typename A, typename R>
+int UnwindCursor<A, R>::stepThroughSigReturn() {
+ //printf("stepThroughSigReturn\n");
+ _isSignalFrame = true;
+ pint_t sp = _registers.getSP();
+ // printf("sp: %p\n", (void*)sp);
+#if defined(_LIBUNWIND_TARGET_X86_64)
+ vregs *regs = (vregs*)(sp + 0x70);
+ //printf("&regs: %p\n", regs);
+
+ _registers.setRegister(UNW_REG_IP, regs->rip);
+ _registers.setRegister(UNW_REG_SP, regs->rsp);
+ _registers.setRegister(UNW_X86_64_RAX, regs->rax);
+ _registers.setRegister(UNW_X86_64_RDX, regs->rdx);
+ _registers.setRegister(UNW_X86_64_RCX, regs->rcx);
+ _registers.setRegister(UNW_X86_64_RBX, regs->rbx);
+ _registers.setRegister(UNW_X86_64_RSI, regs->rsi);
+ _registers.setRegister(UNW_X86_64_RDI, regs->rdi);
+ _registers.setRegister(UNW_X86_64_RBP, regs->rbp);
+ _registers.setRegister(UNW_X86_64_R8, regs->r8);
+ _registers.setRegister(UNW_X86_64_R9, regs->r9);
+ _registers.setRegister(UNW_X86_64_R10, regs->r10);
+ _registers.setRegister(UNW_X86_64_R11, regs->r11);
+ _registers.setRegister(UNW_X86_64_R12, regs->r12);
+ _registers.setRegister(UNW_X86_64_R13, regs->r13);
+ _registers.setRegister(UNW_X86_64_R14, regs->r14);
+ _registers.setRegister(UNW_X86_64_R15, regs->r15);
+ // TODO: XMM
+#endif
+
+ return UNW_STEP_SUCCESS;
+}
#endif // defined(_LIBUNWIND_CHECK_LINUX_SIGRETURN) &&
// defined(_LIBUNWIND_TARGET_AARCH64)
@@ -2925,7 +2990,8 @@ template <typename A, typename R> int UnwindCursor<A, R>::step(bool stage2) {
// Use unwinding info to modify register set as if function returned.
int result;
-#if defined(_LIBUNWIND_CHECK_LINUX_SIGRETURN)
+#if defined(_LIBUNWIND_CHECK_LINUX_SIGRETURN) \
+ || defined(_LIBUNWIND_TARGET_HAIKU) && defined(_LIBUNWIND_TARGET_X86_64)
if (_isSigReturn) {
result = this->stepThroughSigReturn();
} else
--
2.45.2
From 02ae39edb6bc17003443c437c8368800c3688c69 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= <jerome.duval@gmail.com>
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 c649616..9dbd11e 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -361,6 +361,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(CMakeParseArguments)
include(AddClang)
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index 5e9a655..06ba589 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2382,7 +2382,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 346652a..8fc9b49 100644
--- a/clang/lib/Driver/ToolChains/Haiku.cpp
+++ b/clang/lib/Driver/ToolChains/Haiku.cpp
@@ -167,8 +167,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());
@@ -203,8 +211,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,
@@ -267,6 +281,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 e3e699e6a2af227715307b6015a6c93e5e539500 Mon Sep 17 00:00:00 2001
From: David Karoly <karolyd577@gmail.com>
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 89fa0ec..c91d5b7 100644
--- a/clang/lib/Headers/CMakeLists.txt
+++ b/clang/lib/Headers/CMakeLists.txt
@@ -342,7 +342,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 94978fdcc333012207a24c32dacf5f5faa9cecdb Mon Sep 17 00:00:00 2001
From: David Karoly <david.karoly@outlook.com>
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 37241c6..f6739c4 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);
@@ -1897,8 +1897,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 60090eee94a8ec1e9fd1b161eabc5393c787698e Mon Sep 17 00:00:00 2001
From: David Karoly <karolyd577@gmail.com>
Date: Sun, 3 Mar 2024 21:58:38 +0100
Subject: Link libnetwork on Haiku in llvm-jitlink
diff --git a/llvm/tools/llvm-jitlink/CMakeLists.txt b/llvm/tools/llvm-jitlink/CMakeLists.txt
index 1487e78..da270a7 100644
--- a/llvm/tools/llvm-jitlink/CMakeLists.txt
+++ b/llvm/tools/llvm-jitlink/CMakeLists.txt
@@ -36,4 +36,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
target_link_libraries(llvm-jitlink PRIVATE socket)
endif()
+ if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
+ target_link_libraries(llvm-jitlink PRIVATE network)
+ endif()
export_executable_symbols(llvm-jitlink)
--
2.45.2
From 65ed0a4df2a1d129e15d16087a4b48fb3727cf79 Mon Sep 17 00:00:00 2001
From: Brad Smith <brad@comstyle.com>
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 5232e95b3d51c2db496c6ace9f18edbd2f6b4f7e 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 eb6734d..4a66983 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -194,8 +194,8 @@ static std::tuple<ELFKind, uint16_t, uint8_t> parseEmulation(StringRef emul) {
.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
From 351e8dbf0b54c6de725915334150bf1bec339e1a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= <jerome.duval@gmail.com>
Date: Mon, 2 Sep 2024 17:41:04 +0200
Subject: Add support for LLVM profile for Haiku
Haiku uses typical UNIX interfaces.
diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
index dad557a..baaaf3c 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -38,7 +38,11 @@ check_c_compiler_flag(-nodefaultlibs C_SUPPORTS_NODEFAULTLIBS_FLAG)
if (C_SUPPORTS_NODEFAULTLIBS_FLAG)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs")
if (COMPILER_RT_HAS_LIBC)
- list(APPEND CMAKE_REQUIRED_LIBRARIES c)
+ if (HAIKU)
+ list(APPEND CMAKE_REQUIRED_LIBRARIES root)
+ else ()
+ list(APPEND CMAKE_REQUIRED_LIBRARIES c)
+ endif ()
endif ()
if (COMPILER_RT_USE_BUILTINS_LIBRARY)
# TODO: remote this check once we address PR51389.
@@ -816,7 +820,7 @@ else()
endif()
if (PROFILE_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND
- OS_NAME MATCHES "Darwin|Linux|FreeBSD|Windows|Android|Fuchsia|SunOS|NetBSD|AIX")
+ OS_NAME MATCHES "Darwin|Linux|FreeBSD|Windows|Android|Fuchsia|SunOS|NetBSD|AIX|Haiku")
set(COMPILER_RT_HAS_PROFILE TRUE)
else()
set(COMPILER_RT_HAS_PROFILE FALSE)
diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c b/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
index b766436..e8df534 100644
--- a/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
+++ b/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
@@ -8,7 +8,7 @@
#if defined(__linux__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
(defined(__sun__) && defined(__svr4__)) || defined(__NetBSD__) || \
- defined(_AIX)
+ defined(_AIX) || defined(__HAIKU__)
#if !defined(_AIX)
#include <elf.h>
diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformOther.c b/compiler-rt/lib/profile/InstrProfilingPlatformOther.c
index aa79a56..1d10f0b 100644
--- a/compiler-rt/lib/profile/InstrProfilingPlatformOther.c
+++ b/compiler-rt/lib/profile/InstrProfilingPlatformOther.c
@@ -8,7 +8,7 @@
#if !defined(__APPLE__) && !defined(__linux__) && !defined(__FreeBSD__) && \
!defined(__Fuchsia__) && !(defined(__sun__) && defined(__svr4__)) && \
- !defined(__NetBSD__) && !defined(_WIN32) && !defined(_AIX)
+ !defined(__NetBSD__) && !defined(_WIN32) && !defined(_AIX) && !defined(__HAIKU__)
#include <stdlib.h>
#include <stdio.h>
diff --git a/compiler-rt/test/builtins/Unit/ctor_dtor.c b/compiler-rt/test/builtins/Unit/ctor_dtor.c
index 4756072..58dffba 100644
--- a/compiler-rt/test/builtins/Unit/ctor_dtor.c
+++ b/compiler-rt/test/builtins/Unit/ctor_dtor.c
@@ -1,7 +1,7 @@
// REQUIRES: crt
// RUN: %clang -fno-use-init-array -g -c %s -o %t.o
-// RUN: %clang -o %t -no-pie -nostdlib %crt1 %crti %crtbegin %t.o -lc %libgcc %crtend %crtn
+// RUN: %clang -o %t -no-pie -nostdlib %crt1 %crti %crtbegin %t.o %libc %libgcc %crtend %crtn
// RUN: %run %t 2>&1 | FileCheck %s
#include <stdio.h>
diff --git a/compiler-rt/test/builtins/Unit/dso_handle.cpp b/compiler-rt/test/builtins/Unit/dso_handle.cpp
index 7967469..183e29b 100644
--- a/compiler-rt/test/builtins/Unit/dso_handle.cpp
+++ b/compiler-rt/test/builtins/Unit/dso_handle.cpp
@@ -2,8 +2,8 @@
// RUN: %clangxx -g -fno-exceptions -DCRT_SHARED -c %s -fPIC -o %tshared.o
// RUN: %clangxx -g -fno-exceptions -c %s -fPIC -o %t.o
-// RUN: %clangxx -g -shared -o %t.so -nostdlib %crti %crtbegin %tshared.o %libstdcxx -lc -lm %libgcc %crtend %crtn
-// RUN: %clangxx -g -o %t -fno-pic -no-pie -nostdlib %crt1 %crti %crtbegin %t.o %libstdcxx -lc -lm %libgcc %t.so %crtend %crtn
+// RUN: %clangxx -g -shared -o %t.so -nostdlib %crti %crtbegin %tshared.o %libstdcxx %libc -lm %libgcc %crtend %crtn
+// RUN: %clangxx -g -o %t -fno-pic -no-pie -nostdlib %crt1 %crti %crtbegin %t.o %libstdcxx %libc -lm %libgcc %t.so %crtend %crtn
// RUN: %run %t 2>&1 | FileCheck %s
// UNSUPPORTED: target={{(arm|aarch64).*}}
diff --git a/compiler-rt/test/builtins/Unit/lit.cfg.py b/compiler-rt/test/builtins/Unit/lit.cfg.py
index f63d159..f1f63df 100644
--- a/compiler-rt/test/builtins/Unit/lit.cfg.py
+++ b/compiler-rt/test/builtins/Unit/lit.cfg.py
@@ -104,7 +104,10 @@ else:
if sys.platform in ["win32"] and execute_external:
# Don't pass dosish path separator to msys bash.exe.
base_lib = base_lib.replace("\\", "/")
- config.substitutions.append(("%librt ", base_lib + " -lc -lm "))
+ if config.host_os == "Haiku":
+ config.substitutions.append(("%librt ", base_lib + " -lroot "))
+ else:
+ config.substitutions.append(("%librt ", base_lib + " -lc -lm "))
builtins_build_crt = get_required_attr(config, "builtins_build_crt")
if builtins_build_crt:
@@ -123,6 +126,7 @@ if builtins_build_crt:
config.substitutions.append(("%crtn", get_library_path("crtn.o")))
config.substitutions.append(("%libgcc", get_libgcc_file_name()))
+ config.substitutions.append(("%libc", "-lroot" if sys.platform.startswith("haiku") else "-lc"))
config.substitutions.append(
("%libstdcxx", "-l" + config.sanitizer_cxx_lib.lstrip("lib"))
diff --git a/compiler-rt/test/builtins/Unit/test b/compiler-rt/test/builtins/Unit/test
index e068379..7f3e43f 100755
--- a/compiler-rt/test/builtins/Unit/test
+++ b/compiler-rt/test/builtins/Unit/test
@@ -13,7 +13,11 @@ if test `uname` = "Darwin"; then
LIBS="-lSystem"
fi
else
- LIBS="-lc -lm"
+ if test `uname` = "Haiku"; then
+ LIBS="-lroot"
+ else
+ LIBS="-lc -lm"
+ fi
fi
for ARCH in $ARCHS; do
diff --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py
index 0690c3a..16893a7 100644
--- a/compiler-rt/test/lit.common.cfg.py
+++ b/compiler-rt/test/lit.common.cfg.py
@@ -82,6 +82,8 @@ def push_dynamic_library_lookup_path(config, new_path):
dynamic_library_lookup_var = "PATH"
elif platform.system() == "Darwin":
dynamic_library_lookup_var = "DYLD_LIBRARY_PATH"
+ elif platform.system() == "Haiku":
+ dynamic_library_lookup_var = "LIBRARY_PATH"
else:
dynamic_library_lookup_var = "LD_LIBRARY_PATH"
@@ -264,7 +266,6 @@ possibly_dangerous_env_vars = [
"COMPILER_PATH",
"RC_DEBUG_OPTIONS",
"CINDEXTEST_PREAMBLE_FILE",
- "LIBRARY_PATH",
"CPATH",
"C_INCLUDE_PATH",
"CPLUS_INCLUDE_PATH",
diff --git a/compiler-rt/test/profile/lit.cfg.py b/compiler-rt/test/profile/lit.cfg.py
index d3ba115..c9a272e 100644
--- a/compiler-rt/test/profile/lit.cfg.py
+++ b/compiler-rt/test/profile/lit.cfg.py
@@ -166,6 +166,7 @@ if config.host_os not in [
"NetBSD",
"SunOS",
"AIX",
+ "Haiku",
]:
config.unsupported = True
--
2.45.2