From c1b383cb294669f70dba6cde888f7c45d534b0c8 Mon Sep 17 00:00:00 2001 From: PulkoMandy Date: Sun, 19 May 2024 12:21:02 +0200 Subject: [PATCH] llvm17: allow to link object fiels built with gcc. Fixes #10445 --- sys-devel/llvm/llvm17-17.0.6.recipe | 2 +- sys-devel/llvm/patches/llvm17-17.0.6.patchset | 106 +++++++++++------- 2 files changed, 67 insertions(+), 41 deletions(-) diff --git a/sys-devel/llvm/llvm17-17.0.6.recipe b/sys-devel/llvm/llvm17-17.0.6.recipe index 6a8b1bece..df671318a 100644 --- a/sys-devel/llvm/llvm17-17.0.6.recipe +++ b/sys-devel/llvm/llvm17-17.0.6.recipe @@ -30,7 +30,7 @@ other than the ones listed above. HOMEPAGE="https://www.llvm.org/" COPYRIGHT="2003-2023 University of Illinois at Urbana-Champaign" LICENSE="Apache v2 with LLVM Exception" -REVISION="1" +REVISION="2" SOURCE_URI="https://github.com/llvm/llvm-project/releases/download/llvmorg-$portVersion/llvm-project-$portVersion.src.tar.xz" CHECKSUM_SHA256="58a8818c60e6627064f312dbf46c02d9949956558340938b71cf731ad8bc0813" SOURCE_DIR="llvm-project-$portVersion.src" diff --git a/sys-devel/llvm/patches/llvm17-17.0.6.patchset b/sys-devel/llvm/patches/llvm17-17.0.6.patchset index 76b5ce247..4264a5b2b 100644 --- a/sys-devel/llvm/patches/llvm17-17.0.6.patchset +++ b/sys-devel/llvm/patches/llvm17-17.0.6.patchset @@ -1,4 +1,4 @@ -From 99d8d39bf18e3f7bed815475d15404f9495e82b1 Mon Sep 17 00:00:00 2001 +From a29b1d9c4d44dc235c9c1fa67d8d79c798c910de 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 @@ -21,10 +21,10 @@ index e86eb2b..395a857 100644 SmallString<256> Path(LLVM_INSTALL_PACKAGE_DIR); sys::fs::make_absolute(ActivePrefix, Path); -- -2.42.0 +2.43.2 -From 0c87fff14ccd78ccbdc573eb2daaded323c63837 Mon Sep 17 00:00:00 2001 +From 1a7cfee4cafe015be4f0788ff80aba56decb29ab 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. @@ -129,10 +129,10 @@ index 41382d7..de70e50 100644 break; case llvm::Triple::RTEMS: -- -2.42.0 +2.43.2 -From c1fbc349b0af1cb0e13d31335290419b018e231b Mon Sep 17 00:00:00 2001 +From 0d4269231f8b0e81704183ee7553899906ca1283 Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Thu, 7 Apr 2016 18:30:52 +0000 Subject: clang: add a test for haiku driver. @@ -158,20 +158,20 @@ index 0000000..9591739 +// CHECK-X86: gcc{{.*}}" "-o" "a.out" "{{.*}}.o" + -- -2.42.0 +2.43.2 -From 86cef90d17a1769f68f53e33adede7810e9c1dfd Mon Sep 17 00:00:00 2001 +From 69a76b92d25a0ceaae543456ab2fb7b2bc6ec9ad 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: Enable thread-local storage and disable PIE by default diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h -index 8f4331b..0b798a4 100644 +index cf8cc8e..f570406 100644 --- a/clang/lib/Basic/Targets/OSTargets.h +++ b/clang/lib/Basic/Targets/OSTargets.h -@@ -298,7 +298,6 @@ public: +@@ -302,7 +302,6 @@ public: this->IntPtrType = TargetInfo::SignedLong; this->PtrDiffType = TargetInfo::SignedLong; this->ProcessIDType = TargetInfo::SignedLong; @@ -195,10 +195,10 @@ index 669379a..fd82022 100644 void addLibCxxIncludePaths( const llvm::opt::ArgList &DriverArgs, -- -2.42.0 +2.43.2 -From 04fa2c7335744534d329d06d0cf2d3d0739e97c0 Mon Sep 17 00:00:00 2001 +From 1d2e2594305fc12d8258e262ed2b822876b03ab1 Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Mon, 13 Feb 2023 16:28:39 +0100 Subject: clang: Haiku: defaults to PIC @@ -217,10 +217,10 @@ index fd82022..f649d8d 100644 void addLibCxxIncludePaths( const llvm::opt::ArgList &DriverArgs, -- -2.42.0 +2.43.2 -From 4a64b5f8a11c7e045a06adc8775c1601d53d5649 Mon Sep 17 00:00:00 2001 +From 4aa960b6b5d54db7b2137b4df737db0be31ea973 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 @@ -311,10 +311,10 @@ index 2c30bc9..5069361 100644 int lld_main(int argc, char **argv, const llvm::ToolContext &) { -- -2.42.0 +2.43.2 -From 26a2cbf078195ede11957d5d4b6acf25c37fa7d7 Mon Sep 17 00:00:00 2001 +From 2d834d2fdcc250220f3a9696b828918174e28936 Mon Sep 17 00:00:00 2001 From: X512 Date: Wed, 16 Mar 2022 07:04:18 +0900 Subject: libunwind: Haiku: Signal frame unwinding support @@ -437,10 +437,10 @@ index dde9477..e4811a7 100644 result = this->stepThroughSigReturn(); } else -- -2.42.0 +2.43.2 -From c6216f8fc5b2f9fd95556e97b08bd46eb5475430 Mon Sep 17 00:00:00 2001 +From ca6ef9e202b30045a30362192b9b3635d8ec6f92 Mon Sep 17 00:00:00 2001 From: Trung Nguyen Date: Thu, 7 Jul 2022 22:19:34 +0700 Subject: libunwind: Haiku: Initial support @@ -614,10 +614,10 @@ index 6707d59..db1df8c 100644 // Assume an ELF system with a dl_iterate_phdr function. #define _LIBUNWIND_USE_DL_ITERATE_PHDR 1 -- -2.42.0 +2.43.2 -From c444a515fbfc06edaa4f4a02a1698fe766c60f89 Mon Sep 17 00:00:00 2001 +From fd4647097b43e3c90699501641db11049b5dbe9f Mon Sep 17 00:00:00 2001 From: X512 Date: Mon, 10 Oct 2022 12:18:55 +0900 Subject: Haiku: reimplement toolchain driver, make lld functional @@ -911,10 +911,10 @@ index f649d8d..70fc0dc 100644 } // end namespace toolchains -- -2.42.0 +2.43.2 -From e23ce64748507485c07cb1868c5e81c2dc6f1a1a Mon Sep 17 00:00:00 2001 +From 7306a47448a920cfaf34c8314208dc8e90e974dc Mon Sep 17 00:00:00 2001 From: David Karoly Date: Wed, 9 Aug 2023 23:05:15 +0200 Subject: Haiku: implement GCC installation detection @@ -989,10 +989,10 @@ index eea14dd..217315f 100644 ToolChain::CXXStdlibType Haiku::GetDefaultCXXStdlibType() const { -- -2.42.0 +2.43.2 -From 38cc2cc243e1b374728002c432f3257d5a3393dc Mon Sep 17 00:00:00 2001 +From 5b016fae657630d1a5b36342840f18699d22f74e Mon Sep 17 00:00:00 2001 From: Trung Nguyen <57174311+trungnt2910@users.noreply.github.com> Date: Mon, 14 Aug 2023 14:58:56 +1000 Subject: clang: Haiku: Add missing GNU headers include path @@ -1011,10 +1011,10 @@ index de70e50..0e8df73 100644 #ifdef HAIKU_HYBRID_SECONDARY AddPath("/boot/system/develop/headers/" HAIKU_HYBRID_SECONDARY, System, false); -- -2.42.0 +2.43.2 -From 8769573725dca85af3a49fcd9e90c3b4735d42c2 Mon Sep 17 00:00:00 2001 +From 7dde7c825b682812aaf056b0c23216393738562f Mon Sep 17 00:00:00 2001 From: David Karoly Date: Sat, 26 Aug 2023 09:36:42 +0200 Subject: clang: Haiku: silence warning for -pie @@ -1035,10 +1035,10 @@ index 217315f..e9d1187 100644 CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot)); /* -- -2.42.0 +2.43.2 -From c58231b90a3e22fbacf961df3d64315fdbc4dee7 Mon Sep 17 00:00:00 2001 +From 4e903e74f30a02083405a4d86cd04d0af6a9cb29 Mon Sep 17 00:00:00 2001 From: David Karoly Date: Sun, 27 Aug 2023 19:32:12 +0200 Subject: clang: Haiku: silence warning for -pthread and -pthreads when linking @@ -1061,10 +1061,10 @@ index e9d1187..f5f7e99 100644 if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles, -- -2.42.0 +2.43.2 -From 7b4ba9f39d2a761b4590ead1cdb6277f42dc4d25 Mon Sep 17 00:00:00 2001 +From 3328623756634a436e960e2d3c682d76c3b07d4e Mon Sep 17 00:00:00 2001 From: David Karoly Date: Tue, 12 Sep 2023 18:30:30 +0200 Subject: clang: Haiku: remove custom addLibStdCxxIncludePaths implementation @@ -1110,20 +1110,20 @@ index 70fc0dc..be3425e 100644 Tool *buildLinker() const override; }; -- -2.42.0 +2.43.2 -From 8d6ade601f6a15511bb406ba93da9ed336c7f145 Mon Sep 17 00:00:00 2001 +From aac28899eea2b1cf54126640617cec7cfbe84323 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 f2b0c5c..f5fbcb5 100644 +index db47de2..afde831 100644 --- a/clang/lib/Headers/CMakeLists.txt +++ b/clang/lib/Headers/CMakeLists.txt -@@ -311,7 +311,7 @@ set(llvm_libc_wrapper_files +@@ -313,7 +313,7 @@ set(llvm_libc_wrapper_files ) include(GetClangResourceDir) @@ -1133,10 +1133,10 @@ index f2b0c5c..f5fbcb5 100644 set(generated_files) -- -2.42.0 +2.43.2 -From 8556cdb5c7337ef7d70655272e193f9c06053627 Mon Sep 17 00:00:00 2001 +From f9a07dd58630073b9cfbc1a828d0ce377f42bf1c Mon Sep 17 00:00:00 2001 From: David Karoly Date: Fri, 13 Oct 2023 21:35:29 +0200 Subject: clang: link against crti.o @@ -1155,10 +1155,10 @@ index 60434c6..2b507b1 100644 if (crt1) CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crt1))); -- -2.42.0 +2.43.2 -From b08d5d27f4124bbe05c654a1bcab35d923ac4c83 Mon Sep 17 00:00:00 2001 +From ce89b900eee3a997a64386b17ef14499b678fd0b Mon Sep 17 00:00:00 2001 From: Calvin Hill Date: Thu, 2 Nov 2023 07:44:17 +0000 Subject: lld: Make --no-undefined-version into a warning @@ -1203,10 +1203,10 @@ index b99fb17..9cdfa1e 100644 # ERR3: version script assignment of 'local' to symbol 'und' failed: symbol not defined -- -2.42.0 +2.43.2 -From 96f29d1128de89cc355223c2928005fe6c626f3d Mon Sep 17 00:00:00 2001 +From 88c81c50dc3d82881dbf214e5468f0fbd3640ada 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 @@ -1238,5 +1238,31 @@ index d01aebb..f337580 100755 from __future__ import print_function -- -2.42.0 +2.43.2 + + +From c673cac7374e2a5895f0be337775c1074237f7e0 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 c2059c7..31541a4 100644 +--- a/lld/ELF/Driver.cpp ++++ b/lld/ELF/Driver.cpp +@@ -186,8 +186,8 @@ static std::tuple 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.43.2