diff --git a/pkgs/development/compilers/llvm/12/llvm/default.nix b/pkgs/development/compilers/llvm/12/llvm/default.nix index 04321b3598cf..2c035ee67a9e 100644 --- a/pkgs/development/compilers/llvm/12/llvm/default.nix +++ b/pkgs/development/compilers/llvm/12/llvm/default.nix @@ -63,6 +63,9 @@ in stdenv.mkDerivation (rec { # a native libLLVM.so (which would fail) we force llvm-config to be linked # statically against the necessary LLVM components always. ../../llvm-config-link-static.patch + # Fix llvm being miscompiled by some gccs. See llvm/llvm-project#49955 + # Fix llvm being miscompiled by some gccs. See https://github.com/llvm/llvm-project/issues/49955 + ./fix-llvm-issue-49955.patch ./gnu-install-dirs.patch # On older CPUs (e.g. Hydra/wendy) we'd be getting an error in this test. diff --git a/pkgs/development/compilers/llvm/12/llvm/fix-llvm-issue-49955.patch b/pkgs/development/compilers/llvm/12/llvm/fix-llvm-issue-49955.patch new file mode 100644 index 000000000000..b515583a0c42 --- /dev/null +++ b/pkgs/development/compilers/llvm/12/llvm/fix-llvm-issue-49955.patch @@ -0,0 +1,13 @@ +diff --git a/lib/CodeGen/AsmPrinter/CMakeLists.txt b/lib/CodeGen/AsmPrinter/CMakeLists.txt +index eb924282..c77c140b 100644 +--- a/lib/CodeGen/AsmPrinter/CMakeLists.txt ++++ b/lib/CodeGen/AsmPrinter/CMakeLists.txt +@@ -44,3 +44,8 @@ add_llvm_component_library(LLVMAsmPrinter + Support + Target + ) ++ ++if (CMAKE_COMPILER_IS_GNUCXX) ++ set_source_files_properties(DwarfCompileUnit.cpp PROPERTIES ++ COMPILE_FLAGS -fno-strict-aliasing) ++endif()