diff --git a/.gitignore b/.gitignore index 72c8511..02c09e2 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ /llvm-6.0.1rc2.src.tar.xz /llvm-6.0.1.src.tar.xz /llvm-7.0.0rc1.src.tar.xz +/llvm-7.0.0rc2.src.tar.xz diff --git a/0001-Don-t-run-BV-DAG-Combine-before-legalization-if-it-a.patch b/0001-Don-t-run-BV-DAG-Combine-before-legalization-if-it-a.patch deleted file mode 100644 index 31d2b44..0000000 --- a/0001-Don-t-run-BV-DAG-Combine-before-legalization-if-it-a.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 2eb830fed5b813c5624e770c244eec61dacb04d7 Mon Sep 17 00:00:00 2001 -From: Tom Stellard -Date: Mon, 9 Jul 2018 10:35:30 -0700 -Subject: [PATCH] Don't run BV DAG Combine before legalization if it assumes - legal types - ---- - lib/Target/PowerPC/PPCISelLowering.cpp | 13 ++++++++++--- - 1 file changed, 10 insertions(+), 3 deletions(-) - -diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp -index 26e9f13..f622b05 100644 ---- a/lib/Target/PowerPC/PPCISelLowering.cpp -+++ b/lib/Target/PowerPC/PPCISelLowering.cpp -@@ -11790,10 +11790,15 @@ static SDValue combineBVOfVecSExt(SDNode *N, SelectionDAG &DAG) { - auto isSExtOfVecExtract = [&](SDValue Op) -> bool { - if (!Op) - return false; -- if (Op.getOpcode() != ISD::SIGN_EXTEND) -+ if (Op.getOpcode() != ISD::SIGN_EXTEND && -+ Op.getOpcode() != ISD::SIGN_EXTEND_INREG) - return false; - -+ // A SIGN_EXTEND_INREG might be fed by an ANY_EXTEND to produce a value -+ // of the right width. - SDValue Extract = Op.getOperand(0); -+ if (Extract.getOpcode() == ISD::ANY_EXTEND) -+ Extract = Extract.getOperand(0); - if (Extract.getOpcode() != ISD::EXTRACT_VECTOR_ELT) - return false; - -@@ -11881,8 +11886,10 @@ SDValue PPCTargetLowering::DAGCombineBuildVector(SDNode *N, - return Reduced; - - // If we're building a vector out of extended elements from another vector -- // we have P9 vector integer extend instructions. -- if (Subtarget.hasP9Altivec()) { -+ // we have P9 vector integer extend instructions. The code assumes legal -+ // input types (i.e. it can't handle things like v4i16) so do not run before -+ // legalization. -+ if (Subtarget.hasP9Altivec() && !DCI.isBeforeLegalize()) { - Reduced = combineBVOfVecSExt(N, DAG); - if (Reduced) - return Reduced; --- -1.8.3.1 - diff --git a/0001-bpf-fix-an-assertion-in-BPFAsmBackend-applyFixup.patch b/0001-bpf-fix-an-assertion-in-BPFAsmBackend-applyFixup.patch new file mode 100644 index 0000000..7a5831c --- /dev/null +++ b/0001-bpf-fix-an-assertion-in-BPFAsmBackend-applyFixup.patch @@ -0,0 +1,77 @@ +From 39184e407cd937f2f20d3f61eec205925bae7b13 Mon Sep 17 00:00:00 2001 +From: Yonghong Song +Date: Wed, 22 Aug 2018 21:21:03 +0000 +Subject: [PATCH] bpf: fix an assertion in BPFAsmBackend applyFixup() + +Fix bug https://bugs.llvm.org/show_bug.cgi?id=38643 + +In BPFAsmBackend applyFixup(), there is an assertion for FixedValue to be 0. +This may not be true, esp. for optimiation level 0. +For example, in the above bug, for the following two +static variables: + @bpf_map_lookup_elem = internal global i8* (i8*, i8*)* + inttoptr (i64 1 to i8* (i8*, i8*)*), align 8 + @bpf_map_update_elem = internal global i32 (i8*, i8*, i8*, i64)* + inttoptr (i64 2 to i32 (i8*, i8*, i8*, i64)*), align 8 + +The static variable @bpf_map_update_elem will have a symbol +offset of 8 and a FK_SecRel_8 with FixupValue 8 will cause +the assertion if llvm is built with -DLLVM_ENABLE_ASSERTIONS=ON. + +The above relocations will not exist if the program is compiled +with optimization level -O1 and above as the compiler optimizes +those static variables away. In the below error message, -O2 +is suggested as this is the common practice. + +Note that FixedValue = 0 in applyFixup() does exist and is valid, +e.g., for the global variable my_map in the above bug. The bpf +loader will process them properly for map_id's before loading +the program into the kernel. + +The static variables, which are not optimized away by compiler, +may have FK_SecRel_8 relocation with non-zero FixedValue. + +The patch removed the offending assertion and will issue +a hard error as below if the FixedValue in applyFixup() +is not 0. + $ llc -march=bpf -filetype=obj fixup.ll + LLVM ERROR: Unsupported relocation: try to compile with -O2 or above, + or check your static variable usage + +Signed-off-by: Yonghong Song + +git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340455 91177308-0d34-0410-b5e6-96231b3b80d8 +--- + lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp b/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp +index 6c255e9..1822d86 100644 +--- a/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp ++++ b/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp +@@ -10,6 +10,8 @@ + #include "MCTargetDesc/BPFMCTargetDesc.h" + #include "llvm/ADT/StringRef.h" + #include "llvm/MC/MCAsmBackend.h" ++#include "llvm/MC/MCAssembler.h" ++#include "llvm/MC/MCContext.h" + #include "llvm/MC/MCFixup.h" + #include "llvm/MC/MCObjectWriter.h" + #include "llvm/Support/EndianStream.h" +@@ -71,7 +73,12 @@ void BPFAsmBackend::applyFixup(const MCAssembler &Asm, const MCFixup &Fixup, + bool IsResolved, + const MCSubtargetInfo *STI) const { + if (Fixup.getKind() == FK_SecRel_4 || Fixup.getKind() == FK_SecRel_8) { +- assert(Value == 0); ++ if (Value) { ++ MCContext &Ctx = Asm.getContext(); ++ Ctx.reportError(Fixup.getLoc(), ++ "Unsupported relocation: try to compile with -O2 or above, " ++ "or check your static variable usage"); ++ } + } else if (Fixup.getKind() == FK_Data_4) { + support::endian::write(&Data[Fixup.getOffset()], Value, Endian); + } else if (Fixup.getKind() == FK_Data_8) { +-- +1.8.3.1 + diff --git a/0001-gold-Fix-Tests-cases-on-i686.patch b/0001-gold-Fix-Tests-cases-on-i686.patch deleted file mode 100644 index f35db4f..0000000 --- a/0001-gold-Fix-Tests-cases-on-i686.patch +++ /dev/null @@ -1,103 +0,0 @@ -From bda67d3141acf120df8db57052603e9a18d86523 Mon Sep 17 00:00:00 2001 -From: Tom Stellard -Date: Fri, 10 Aug 2018 14:54:17 -0700 -Subject: [PATCH] [gold] Fix Tests cases on i686 - ---- - test/tools/gold/X86/common.ll | 10 +++++----- - test/tools/gold/X86/v1.16/wrap-1.ll | 4 ++-- - test/tools/gold/X86/v1.16/wrap-2.ll | 4 ++-- - 3 files changed, 9 insertions(+), 9 deletions(-) - -diff --git a/test/tools/gold/X86/common.ll b/test/tools/gold/X86/common.ll -index 1debe78..d8b4e03 100644 ---- a/test/tools/gold/X86/common.ll -+++ b/test/tools/gold/X86/common.ll -@@ -8,7 +8,7 @@ target triple = "x86_64-unknown-linux-gnu" - - @a = common global i16 0, align 8 - --; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \ -+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ - ; RUN: --plugin-opt=emit-llvm \ - ; RUN: -shared %t1.o %t2.o -o %t3.o - ; RUN: llvm-dis %t3.o -o - | FileCheck %s --check-prefix=A -@@ -16,7 +16,7 @@ target triple = "x86_64-unknown-linux-gnu" - ; Shared library case, we merge @a as common and keep it for the symbol table. - ; A: @a = common global [4 x i8] zeroinitializer, align 8 - --; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \ -+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ - ; RUN: --plugin-opt=emit-llvm \ - ; RUN: -shared %t1.o %t2b.o -o %t3.o - ; RUN: llvm-dis %t3.o -o - | FileCheck %s --check-prefix=B -@@ -24,7 +24,7 @@ target triple = "x86_64-unknown-linux-gnu" - ; (i16 align 8) + (i8 align 16) = i16 align 16 - ; B: @a = common global i16 0, align 16 - --; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \ -+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ - ; RUN: --plugin-opt=emit-llvm \ - ; RUN: -shared %t1.o %t2c.o -o %t3.o - ; RUN: llvm-dis %t3.o -o - | FileCheck %s --check-prefix=C -@@ -32,7 +32,7 @@ target triple = "x86_64-unknown-linux-gnu" - ; (i16 align 8) + (i8 align 1) = i16 align 8. - ; C: @a = common global i16 0, align 8 - --; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \ -+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ - ; RUN: --plugin-opt=emit-llvm \ - ; RUN: %t1.o %t2.o -o %t3.o - ; RUN: llvm-dis %t3.o -o - | FileCheck --check-prefix=EXEC %s -@@ -41,7 +41,7 @@ target triple = "x86_64-unknown-linux-gnu" - ; EXEC: @a = internal global [4 x i8] zeroinitializer, align 8 - - ; RUN: llc %p/Inputs/common.ll -o %t2native.o -filetype=obj --; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \ -+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext \ - ; RUN: --plugin-opt=emit-llvm \ - ; RUN: %t1.o %t2native.o -o %t3.o - ; RUN: llvm-dis %t3.o -o - | FileCheck --check-prefix=MIXED %s -diff --git a/test/tools/gold/X86/v1.16/wrap-1.ll b/test/tools/gold/X86/v1.16/wrap-1.ll -index 5ea83b0..806442e 100644 ---- a/test/tools/gold/X86/v1.16/wrap-1.ll -+++ b/test/tools/gold/X86/v1.16/wrap-1.ll -@@ -1,12 +1,12 @@ - ; LTO - ; RUN: llvm-as %s -o %t.o --; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext %t.o -o %t.out -wrap=bar -plugin-opt=save-temps -+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext %t.o -o %t.out -wrap=bar -plugin-opt=save-temps - ; RUN: llvm-readobj -t %t.out | FileCheck %s - ; RUN: cat %t.out.resolution.txt | FileCheck -check-prefix=RESOLS %s - - ; ThinLTO - ; RUN: opt -module-summary %s -o %t.o --; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext %t.o -o %t.out -wrap=bar -plugin-opt=save-temps -+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext %t.o -o %t.out -wrap=bar -plugin-opt=save-temps - ; RUN: llvm-readobj -t %t.out | FileCheck %s - ; RUN: cat %t.out.resolution.txt | FileCheck -check-prefix=RESOLS %s - -diff --git a/test/tools/gold/X86/v1.16/wrap-2.ll b/test/tools/gold/X86/v1.16/wrap-2.ll -index 7c1d95d..f36456c 100644 ---- a/test/tools/gold/X86/v1.16/wrap-2.ll -+++ b/test/tools/gold/X86/v1.16/wrap-2.ll -@@ -7,14 +7,14 @@ - ; LTO defsym handling, gold will need a fix (not the gold plugin). - ; RUN-TODO: llvm-as %s -o %t.o - ; RUN-TODO: llvm-as %S/Inputs/wrap-bar.ll -o %t1.o --; RUN-TODO: %gold -plugin %llvmshlibdir/LLVMgold%shlibext %t.o %t1.o -shared -o %t.so -wrap=bar -+; RUN-TODO: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext %t.o %t1.o -shared -o %t.so -wrap=bar - ; RUN-TODO: llvm-objdump -d %t.so | FileCheck %s - ; RUN-TODO: llvm-readobj -t %t.so | FileCheck -check-prefix=BIND %s - - ; ThinLTO - ; RUN: opt -module-summary %s -o %t.o - ; RUN: opt -module-summary %S/Inputs/wrap-bar.ll -o %t1.o --; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext %t.o %t1.o -shared -o %t.so -wrap=bar -+; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext %t.o %t1.o -shared -o %t.so -wrap=bar - ; RUN: llvm-objdump -d %t.so | FileCheck %s -check-prefix=THIN - ; RUN: llvm-readobj -t %t.so | FileCheck -check-prefix=BIND %s - --- -1.8.3.1 - diff --git a/llvm.spec b/llvm.spec index b6e2b71..10b03ce 100644 --- a/llvm.spec +++ b/llvm.spec @@ -12,7 +12,7 @@ %global maj_ver 7 %global min_ver 0 %global patch_ver 0 -%global rc_ver 1 +%global rc_ver 2 %ifarch s390x %global llvm_targets SystemZ;BPF @@ -50,7 +50,7 @@ Name: %{pkg_name} Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 0.6.rc%{rc_ver}%{?dist} +Release: 0.7.rc%{rc_ver}%{?dist} Summary: The Low Level Virtual Machine License: NCSA @@ -61,9 +61,9 @@ Source1: run-lit-tests Patch3: 0001-CMake-Split-static-library-exports-into-their-own-ex.patch Patch7: 0001-Filter-out-cxxflags-not-supported-by-clang.patch -Patch10: 0001-Don-t-run-BV-DAG-Combine-before-legalization-if-it-a.patch -Patch11: 0001-gold-Fix-Tests-cases-on-i686.patch Patch12: 0001-unittests-Don-t-install-TestPlugin.so.patch +# rhbz#1618958 +Patch13: 0001-bpf-fix-an-assertion-in-BPFAsmBackend-applyFixup.patch BuildRequires: gcc BuildRequires: gcc-c++ @@ -410,6 +410,9 @@ fi %endif %changelog +* Tue Aug 28 2018 Tom Stellard - 7.0.0-0.7.rc2 +- 7.0.0-rc2 Release + * Tue Aug 28 2018 Tom Stellard - 7.0.0-0.6.rc1 - Guard valgrind usage with valgrind_arches macro diff --git a/sources b/sources index 49e0836..f1fbd2c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (llvm-7.0.0rc1.src.tar.xz) = 9fe5de3b373e3e9f32b81ac920dfbb6fd6a03118f0c1e9c2b6d93a0a0742c122d5c08e97c71262a7c273badb1d336b813143c1055d7c49c22394151a1520e064 +SHA512 (llvm-7.0.0rc2.src.tar.xz) = 4211fdbd2278ed325d3f6a1f1fa706351e768e2cd1445abf6664bed39b7b5d0c5e04514711d627f9ae1e271300f410635bb54ba004a5bece0d68450d3a1b52e4