Unverified Commit 31633b82 authored by David McFarland's avatar David McFarland Committed by GitHub
Browse files

swift: fix linux build (#485380)

parents 29dd3361 20a48f24
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -348,6 +348,17 @@ stdenv.mkDerivation {
    patch -p1 -d swift -i $TMPDIR/swift-separate-lib.patch

    patch -p1 -d llvm-project/llvm -i ${./patches/llvm-module-cache.patch}
    for root in llvm-project/llvm swift/stdlib; do
      patch -p1 -d $root -i ${
        (fetchpatch {
          name = "fix-SmallVector-compile-error.patch";
          url = "https://github.com/llvm/llvm-project/commit/7e44305041d96b064c197216b931ae3917a34ac1.patch";
          stripLen = 1;
          hash = "sha256-1htuzsaPHbYgravGc1vrR8sqpQ/NSQ8PUZeAU8ucCFk=";
        })
      }
    done
    patch -p2 -d llvm-project/llvm -i ${./patches/llvm-fix-X86MCTargetDesc-compile-error.patch}

    for lldbPatch in ${
      lib.escapeShellArgs [
@@ -363,6 +374,12 @@ stdenv.mkDerivation {
          stripLen = 1;
          hash = "sha256-QCGhsL/mi7610ZNb5SqxjRGjwJeK2rwtsFVGeG3PUGc=";
        })
        (fetchpatch {
          name = "LLDB-Add-cstdint-to-AddressableBits-102110.patch";
          url = "https://github.com/llvm/llvm-project/commit/bb59f04e7e75dcbe39f1bf952304a157f0035314.patch";
          stripLen = 1;
          hash = "sha256-+CcmZRxCaozFe1Kuf2HX+kGKuh/PDuoFBEFA/t7tL9A=";
        })
      ]
    }; do
      patch -p1 -d llvm-project/lldb -i $lldbPatch
+34 −0
Original line number Diff line number Diff line
From f03ab75680385b1ea62af3ab15c423a3bc0f3588 Mon Sep 17 00:00:00 2001
From: Stephan Hageboeck <stephan.hageboeck@cern.ch>
Date: Mon, 20 Jan 2025 17:52:47 +0100
Subject: [PATCH] Add missing include to X86MCTargetDesc.h (#123320)

In gcc-15, explicit includes of `<cstdint>` are required when fixed-size
integers are used. In this file, this include only happened as a side
effect of including SmallVector.h

Although llvm compiles fine, the root-project would benefit from
explicitly including it here, so we can backport the patch.

Maybe interesting for @hahnjo and @vgvassilev

(cherry picked from commit 7abf44069aec61eee147ca67a6333fc34583b524)
---
 llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h b/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h
index d0530bd4d650..10b59462aebe 100644
--- a/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h
+++ b/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h
@@ -13,6 +13,7 @@
 #ifndef LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCTARGETDESC_H
 #define LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCTARGETDESC_H
 
+#include <cstdint>
 #include <memory>
 #include <string>
 
-- 
2.52.0
+2 −2
Original line number Diff line number Diff line
@@ -21,10 +21,10 @@ patch it to also consider `-idirafter` and `-isystem` as added by cc-wrapper.
+  llvm::append_range(includeDirs,
+                     DriverArgs.getAllArgValues(
+                         clang::driver::options::OPT_idirafter));
+  // Nix adds the C++ stdlib include path using `-isystem`.
+  // Nix adds the C++ stdlib include path using `-cxx-isystem`.
+  llvm::append_range(includeDirs,
+                     DriverArgs.getAllArgValues(
+                         clang::driver::options::OPT_isystem));
+                         clang::driver::options::OPT_cxx_isystem));
 
   for (const auto &includeDir : includeDirs) {
     Path dir(includeDir);
+1 −0
Original line number Diff line number Diff line
@@ -259,6 +259,7 @@ let

    patches = [
      ./patches/llbuild-cmake-disable-rpath.patch
      ./patches/llbuild-fix-missing-cstdint.patch
    ];

    postPatch = ''
+12 −0
Original line number Diff line number Diff line
diff --git a/utils/unittest/googletest/src/gtest-death-test.cc b/utils/unittest/googletest/src/gtest-death-test.cc
index ede8378..bdef225 100644
--- a/utils/unittest/googletest/src/gtest-death-test.cc
+++ b/utils/unittest/googletest/src/gtest-death-test.cc
@@ -33,6 +33,7 @@
 #include "gtest/gtest-death-test.h"
 
 #include <utility>
+#include <cstdint>
 
 #include "gtest/internal/gtest-port.h"
 #include "gtest/internal/custom/gtest.h"
Loading