From 0878cc9320ad8bdd842593aba182a9bacfc0c5fb Mon Sep 17 00:00:00 2001 From: Britney Fransen Date: Fri, 2 Mar 2018 14:02:30 +0000 Subject: llvm: update to 5.0.1 --- ...GCC-compatibility-Ignore-the-fno-plt-flag.patch | 37 +++ .../llvm/0002-Enable-SSP-and-PIE-by-default.patch | 268 +++++++++++++++++++++ ...raction-between-WQM-and-polygon-stippling.patch | 140 ----------- abs/extra/llvm/PKGBUILD | 122 ++++++---- abs/extra/llvm/__changelog | 2 - abs/extra/llvm/disable-llvm-symbolizer-test.patch | 26 ++ abs/extra/llvm/llvm-Config-llvm-config.h | 9 - abs/extra/llvm/llvm-config.h | 9 + ...t-initialization-failure-with-newer-glibc.patch | 103 -------- 9 files changed, 409 insertions(+), 307 deletions(-) create mode 100644 abs/extra/llvm/0001-GCC-compatibility-Ignore-the-fno-plt-flag.patch create mode 100644 abs/extra/llvm/0002-Enable-SSP-and-PIE-by-default.patch delete mode 100644 abs/extra/llvm/AMDGPU-Fix-an-interaction-between-WQM-and-polygon-stippling.patch delete mode 100644 abs/extra/llvm/__changelog create mode 100644 abs/extra/llvm/disable-llvm-symbolizer-test.patch delete mode 100644 abs/extra/llvm/llvm-Config-llvm-config.h create mode 100644 abs/extra/llvm/llvm-config.h delete mode 100644 abs/extra/llvm/msan-prevent-initialization-failure-with-newer-glibc.patch diff --git a/abs/extra/llvm/0001-GCC-compatibility-Ignore-the-fno-plt-flag.patch b/abs/extra/llvm/0001-GCC-compatibility-Ignore-the-fno-plt-flag.patch new file mode 100644 index 0000000..7398b50 --- /dev/null +++ b/abs/extra/llvm/0001-GCC-compatibility-Ignore-the-fno-plt-flag.patch @@ -0,0 +1,37 @@ +From fedcf1d9691bf669d8cd771a032e851d8247aff9 Mon Sep 17 00:00:00 2001 +From: Evangelos Foutras +Date: Thu, 6 Jul 2017 18:53:05 +0300 +Subject: [PATCH 1/2] GCC compatibility: Ignore the -fno-plt flag + +--- + include/clang/Driver/Options.td | 1 + + test/Driver/clang_f_opts.c | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td +index 05dc9d7eb3..c93e6cc08c 100644 +--- a/include/clang/Driver/Options.td ++++ b/include/clang/Driver/Options.td +@@ -2505,6 +2505,7 @@ defm ivopts : BooleanFFlag<"ivopts">, Group, Group; + defm peel_loops : BooleanFFlag<"peel-loops">, Group; + defm permissive : BooleanFFlag<"permissive">, Group; ++defm plt : BooleanFFlag<"plt">, Group; + defm prefetch_loop_arrays : BooleanFFlag<"prefetch-loop-arrays">, Group; + defm printf : BooleanFFlag<"printf">, Group; + defm profile : BooleanFFlag<"profile">, Group; +diff --git a/test/Driver/clang_f_opts.c b/test/Driver/clang_f_opts.c +index c17cec6eba..d9480c915e 100644 +--- a/test/Driver/clang_f_opts.c ++++ b/test/Driver/clang_f_opts.c +@@ -277,6 +277,7 @@ + // RUN: -fno-caller-saves -fcaller-saves \ + // RUN: -fno-reorder-blocks -freorder-blocks \ + // RUN: -fno-schedule-insns2 -fschedule-insns2 \ ++// RUN: -fno-plt -fplt \ + // RUN: -fno-stack-check \ + // RUN: -fno-check-new -fcheck-new \ + // RUN: -ffriend-injection \ +-- +2.14.1 + diff --git a/abs/extra/llvm/0002-Enable-SSP-and-PIE-by-default.patch b/abs/extra/llvm/0002-Enable-SSP-and-PIE-by-default.patch new file mode 100644 index 0000000..030146c --- /dev/null +++ b/abs/extra/llvm/0002-Enable-SSP-and-PIE-by-default.patch @@ -0,0 +1,268 @@ +From 60fa751da239e592b31bde2533342dac64359e7f Mon Sep 17 00:00:00 2001 +From: Evangelos Foutras +Date: Thu, 6 Jul 2017 18:15:43 +0300 +Subject: [PATCH 2/2] Enable SSP and PIE by default + +This is a minimal set of changes needed to make clang use SSP and PIE by +default on Arch Linux. Tests that were easy to adjust have been changed +accordingly; only test/Driver/linux-ld.c has been marked as "expected +failure" due to the number of changes it would require (mostly replacing +crtbegin.o with crtbeginS.o). + +Doing so is needed in order to align clang with the new default GCC +behavior in Arch which generates PIE executables by default and also +defaults to -fstack-protector-strong. It is not meant to be a long term +solution, but a simple temporary fix. + +Hopefully these changes will be obsoleted by the introduction upstream +of a compile-time option (https://bugs.llvm.org/show_bug.cgi?id=13410) +--- + lib/Driver/ToolChains/Gnu.cpp | 1 + + lib/Driver/ToolChains/Linux.cpp | 14 +++++++++++++- + lib/Driver/ToolChains/Linux.h | 1 + + test/Driver/cross-linux.c | 16 ++++++++-------- + test/Driver/env.c | 2 +- + test/Driver/fsanitize.c | 18 ++++++++++-------- + test/Driver/gcc-toolchain.cpp | 2 +- + test/Driver/hexagon-toolchain-elf.c | 2 +- + test/Driver/linux-as.c | 4 ++-- + test/Driver/linux-ld.c | 2 ++ + test/Driver/stack-protector.c | 4 ++-- + 11 files changed, 42 insertions(+), 24 deletions(-) + +diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp +index 72a9f85ba3..4fd567b03b 100644 +--- a/lib/Driver/ToolChains/Gnu.cpp ++++ b/lib/Driver/ToolChains/Gnu.cpp +@@ -417,6 +417,7 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, + const bool IsIAMCU = ToolChain.getTriple().isOSIAMCU(); + const bool IsPIE = + !Args.hasArg(options::OPT_shared) && !Args.hasArg(options::OPT_static) && ++ !Args.hasArg(options::OPT_nopie) && + (Args.hasArg(options::OPT_pie) || ToolChain.isPIEDefault()); + const bool HasCRTBeginEndFiles = + ToolChain.getTriple().hasEnvironment() || +diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp +index 08a27fa7fe..1dd70b115d 100644 +--- a/lib/Driver/ToolChains/Linux.cpp ++++ b/lib/Driver/ToolChains/Linux.cpp +@@ -810,7 +810,19 @@ void Linux::AddIAMCUIncludeArgs(const ArgList &DriverArgs, + } + } + +-bool Linux::isPIEDefault() const { return getSanitizerArgs().requiresPIE(); } ++bool Linux::isPIEDefault() const { ++ const bool IsMips = tools::isMipsArch(getTriple().getArch()); ++ const bool IsAndroid = getTriple().isAndroid(); ++ ++ if (IsMips || IsAndroid) ++ return getSanitizerArgs().requiresPIE(); ++ ++ return true; ++} ++ ++unsigned Linux::GetDefaultStackProtectorLevel(bool KernelOrKext) const { ++ return 2; ++} + + SanitizerMask Linux::getSupportedSanitizers() const { + const bool IsX86 = getTriple().getArch() == llvm::Triple::x86; +diff --git a/lib/Driver/ToolChains/Linux.h b/lib/Driver/ToolChains/Linux.h +index 9778c1832c..ddd46a1d58 100644 +--- a/lib/Driver/ToolChains/Linux.h ++++ b/lib/Driver/ToolChains/Linux.h +@@ -36,6 +36,7 @@ public: + void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args) const override; + bool isPIEDefault() const override; ++ unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override; + SanitizerMask getSupportedSanitizers() const override; + void addProfileRTLibs(const llvm::opt::ArgList &Args, + llvm::opt::ArgStringList &CmdArgs) const override; +diff --git a/test/Driver/cross-linux.c b/test/Driver/cross-linux.c +index a5ea832e77..1949c05a60 100644 +--- a/test/Driver/cross-linux.c ++++ b/test/Driver/cross-linux.c +@@ -42,8 +42,8 @@ + // CHECK-MULTI32-I386: "{{.*}}/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/bin{{/|\\\\}}ld" + // CHECK-MULTI32-I386: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]" + // CHECK-MULTI32-I386: "-m" "elf_i386" +-// CHECK-MULTI32-I386: "crti.o" "[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0]]{{/|\\\\}}crtbegin.o" +-// CHECK-MULTI32-I386: "-L[[gcc_install]]" ++// CHECK-MULTI32-I386: "crti.o" "crtbeginS.o" ++// CHECK-MULTI32-I386: "-L[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0]]" + // CHECK-MULTI32-I386: "-L[[gcc_install]]/../../../../i386-unknown-linux/lib/../lib32" + // CHECK-MULTI32-I386: "-L[[gcc_install]]/../../../../i386-unknown-linux/lib" + // CHECK-MULTI32-I386: "-L[[sysroot]]/lib" +@@ -59,8 +59,8 @@ + // CHECK-MULTI32-X86-64: "{{.*}}/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/bin{{/|\\\\}}ld" + // CHECK-MULTI32-X86-64: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]" + // CHECK-MULTI32-X86-64: "-m" "elf_x86_64" +-// CHECK-MULTI32-X86-64: "crti.o" "[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0]]/64{{/|\\\\}}crtbegin.o" +-// CHECK-MULTI32-X86-64: "-L[[gcc_install]]/64" ++// CHECK-MULTI32-X86-64: "crti.o" "crtbeginS.o" ++// CHECK-MULTI32-X86-64: "-L[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0]]/64" + // CHECK-MULTI32-X86-64: "-L[[gcc_install]]/../../../../i386-unknown-linux/lib/../lib64" + // CHECK-MULTI32-X86-64: "-L[[gcc_install]]" + // CHECK-MULTI32-X86-64: "-L[[gcc_install]]/../../../../i386-unknown-linux/lib" +@@ -77,8 +77,8 @@ + // CHECK-MULTI64-I386: "{{.*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/bin{{/|\\\\}}ld" + // CHECK-MULTI64-I386: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]" + // CHECK-MULTI64-I386: "-m" "elf_i386" +-// CHECK-MULTI64-I386: "crti.o" "[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0]]/32{{/|\\\\}}crtbegin.o" +-// CHECK-MULTI64-I386: "-L[[gcc_install]]/32" ++// CHECK-MULTI64-I386: "crti.o" "crtbeginS.o" ++// CHECK-MULTI64-I386: "-L[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0]]/32" + // CHECK-MULTI64-I386: "-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib/../lib32" + // CHECK-MULTI64-I386: "-L[[gcc_install]]" + // CHECK-MULTI64-I386: "-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib" +@@ -95,8 +95,8 @@ + // CHECK-MULTI64-X86-64: "{{.*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/bin{{/|\\\\}}ld" + // CHECK-MULTI64-X86-64: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]" + // CHECK-MULTI64-X86-64: "-m" "elf_x86_64" +-// CHECK-MULTI64-X86-64: "crti.o" "[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0]]{{/|\\\\}}crtbegin.o" +-// CHECK-MULTI64-X86-64: "-L[[gcc_install]]" ++// CHECK-MULTI64-X86-64: "crti.o" "crtbeginS.o" ++// CHECK-MULTI64-X86-64: "-L[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0]]" + // CHECK-MULTI64-X86-64: "-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib/../lib64" + // CHECK-MULTI64-X86-64: "-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib" + // CHECK-MULTI64-X86-64: "-L[[sysroot]]/lib" +diff --git a/test/Driver/env.c b/test/Driver/env.c +index 0371bc91c4..ea89f52512 100644 +--- a/test/Driver/env.c ++++ b/test/Driver/env.c +@@ -20,7 +20,7 @@ + // + // CHECK-LD-32-NOT: warning: + // CHECK-LD-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +-// CHECK-LD-32: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o" ++// CHECK-LD-32: "crtbeginS.o" + // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0" + // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib" + // CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.." +diff --git a/test/Driver/fsanitize.c b/test/Driver/fsanitize.c +index 0752ef6df0..5d1e211b24 100644 +--- a/test/Driver/fsanitize.c ++++ b/test/Driver/fsanitize.c +@@ -192,13 +192,13 @@ + // RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fno-sanitize=vptr -fsanitize=undefined,address %s -### 2>&1 + // OK + +-// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE +-// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE ++// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE ++// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE + // RUN: %clang -target x86_64-unknown-freebsd -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE + // RUN: %clang -target aarch64-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE + // RUN: %clang -target arm-linux-androideabi -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE +-// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE +-// RUN: %clang -target i386-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE ++// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE ++// RUN: %clang -target i386-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE + + // CHECK-NO-PIE-NOT: "-pie" + // CHECK-NO-PIE: "-mrelocation-model" "static" +@@ -491,12 +491,12 @@ + // RUN: %clang -fno-sanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NOSP + // NOSP-NOT: "-fsanitize=safe-stack" + +-// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP +-// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP-ASAN ++// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP ++// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP-ASAN + // RUN: %clang -target x86_64-linux-gnu -fstack-protector -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP + // RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=SP +-// RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP +-// RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP ++// RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP ++// RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP + // RUN: %clang -target i386-contiki-unknown -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP + // NO-SP-NOT: stack-protector + // NO-SP: "-fsanitize=safe-stack" +@@ -506,6 +506,8 @@ + + // NO-SP-ASAN-NOT: stack-protector + // NO-SP-ASAN: "-fsanitize=address,safe-stack" ++// SP-ASAN: "-fsanitize=address,safe-stack" ++// SP-ASAN: -stack-protector + // NO-SP-ASAN-NOT: stack-protector + + // RUN: %clang -target powerpc64-unknown-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s -check-prefix=CHECK-SANM +diff --git a/test/Driver/gcc-toolchain.cpp b/test/Driver/gcc-toolchain.cpp +index ca96757a2b..ae1c25e989 100644 +--- a/test/Driver/gcc-toolchain.cpp ++++ b/test/Driver/gcc-toolchain.cpp +@@ -24,6 +24,6 @@ + // the same precise formatting of the path as the '-internal-system' flags + // above, so we just blanket wildcard match the 'crtbegin.o'. + // CHECK: "{{[^"]*}}ld{{(.exe)?}}" +-// CHECK: "{{[^"]*}}/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5{{/|\\\\}}crtbegin.o" ++// CHECK: "crtbeginS.o" + // CHECK: "-L[[TOOLCHAIN]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5" + // CHECK: "-L[[TOOLCHAIN]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../.." +diff --git a/test/Driver/hexagon-toolchain-elf.c b/test/Driver/hexagon-toolchain-elf.c +index 98582450e3..b2da01eaf5 100644 +--- a/test/Driver/hexagon-toolchain-elf.c ++++ b/test/Driver/hexagon-toolchain-elf.c +@@ -449,7 +449,7 @@ + // RUN: %s 2>&1 \ + // RUN: | FileCheck -check-prefix=CHECK042 %s + // CHECK042: "-cc1" +-// CHECK042: "-mrelocation-model" "static" ++// CHECK042: "-mrelocation-model" "pic" + // CHECK042: "-mllvm" "-hexagon-small-data-threshold=8" + // CHECK042-NEXT: llvm-mc + // CHECK042: "-gpsize=8" +diff --git a/test/Driver/linux-as.c b/test/Driver/linux-as.c +index c5cb1cd600..1ad86d8ead 100644 +--- a/test/Driver/linux-as.c ++++ b/test/Driver/linux-as.c +@@ -133,7 +133,7 @@ + // CHECK-PPC-NO-MCPU-NOT: as{{.*}} "-mcpu=invalid-cpu" + // + // RUN: %clang -target sparc64-linux -mcpu=invalid-cpu -### \ +-// RUN: -no-integrated-as -c %s 2>&1 \ ++// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ + // RUN: | FileCheck -check-prefix=CHECK-SPARCV9 %s + // CHECK-SPARCV9: as + // CHECK-SPARCV9: -64 +@@ -142,7 +142,7 @@ + // CHECK-SPARCV9: -o + // + // RUN: %clang -target sparc64-linux -mcpu=invalid-cpu -### \ +-// RUN: -no-integrated-as -fpic -c %s 2>&1 \ ++// RUN: -no-integrated-as -c %s 2>&1 \ + // RUN: | FileCheck -check-prefix=CHECK-SPARCV9PIC %s + // CHECK-SPARCV9PIC: as + // CHECK-SPARCV9PIC: -64 +diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c +index 1c5f1a4556..2885f78045 100644 +--- a/test/Driver/linux-ld.c ++++ b/test/Driver/linux-ld.c +@@ -1,3 +1,5 @@ ++// XFAIL: linux ++ + // General tests that ld invocations on Linux targets sane. Note that we use + // sysroot to make these tests independent of the host system. + // +diff --git a/test/Driver/stack-protector.c b/test/Driver/stack-protector.c +index 6769b65f63..180e26f3ea 100644 +--- a/test/Driver/stack-protector.c ++++ b/test/Driver/stack-protector.c +@@ -3,11 +3,11 @@ + // NOSSP-NOT: "-stack-protector-buffer-size" + + // RUN: %clang -target i386-unknown-linux -fstack-protector -### %s 2>&1 | FileCheck %s -check-prefix=SSP +-// SSP: "-stack-protector" "1" ++// SSP: "-stack-protector" "2" + // SSP-NOT: "-stack-protector-buffer-size" + + // RUN: %clang -target i386-unknown-linux -fstack-protector --param ssp-buffer-size=16 -### %s 2>&1 | FileCheck %s -check-prefix=SSP-BUF +-// SSP-BUF: "-stack-protector" "1" ++// SSP-BUF: "-stack-protector" "2" + // SSP-BUF: "-stack-protector-buffer-size" "16" + + // RUN: %clang -target i386-pc-openbsd -### %s 2>&1 | FileCheck %s -check-prefix=OPENBSD +-- +2.14.1 + diff --git a/abs/extra/llvm/AMDGPU-Fix-an-interaction-between-WQM-and-polygon-stippling.patch b/abs/extra/llvm/AMDGPU-Fix-an-interaction-between-WQM-and-polygon-stippling.patch deleted file mode 100644 index f23b916..0000000 --- a/abs/extra/llvm/AMDGPU-Fix-an-interaction-between-WQM-and-polygon-stippling.patch +++ /dev/null @@ -1,140 +0,0 @@ -From 25e2616626caafb896517e18cd8aa724fba2b200 Mon Sep 17 00:00:00 2001 -From: Tom Stellard -Date: Tue, 29 Nov 2016 03:41:28 +0000 -Subject: [PATCH] Merging r280589: - ------------------------------------------------------------------------- -r280589 | nhaehnle | 2016-09-03 05:26:32 -0700 (Sat, 03 Sep 2016) | 19 lines - -AMDGPU: Fix an interaction between WQM and polygon stippling - -Summary: -This fixes a rare bug in polygon stippling with non-monolithic pixel shaders. - -The underlying problem is as follows: the prolog part contains the polygon -stippling sequence, i.e. a kill. The main part then enables WQM based on the -_reduced_ exec mask, effectively undoing most of the polygon stippling. - -Since we cannot know whether polygon stippling will be used, the main part -of a non-monolithic shader must always return to exact mode to fix this -problem. - -Reviewers: arsenm, tstellarAMD, mareko - -Subscribers: arsenm, llvm-commits, kzhuravl - -Differential Revision: https://reviews.llvm.org/D23131 - ------------------------------------------------------------------------- - -git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_39@288105 91177308-0d34-0410-b5e6-96231b3b80d8 ---- - lib/Target/AMDGPU/SIInstructions.td | 1 + - lib/Target/AMDGPU/SIWholeQuadMode.cpp | 7 ----- - test/CodeGen/AMDGPU/wqm.ll | 49 ++++++++++++++++++++++++++++++++--- - 3 files changed, 46 insertions(+), 11 deletions(-) - -diff --git a/lib/Target/AMDGPU/SIInstructions.td b/lib/Target/AMDGPU/SIInstructions.td -index 18b7d5d..dde5f2f 100644 ---- a/lib/Target/AMDGPU/SIInstructions.td -+++ b/lib/Target/AMDGPU/SIInstructions.td -@@ -2029,6 +2029,7 @@ def SI_RETURN : PseudoInstSI < - let hasSideEffects = 1; - let SALU = 1; - let hasNoSchedulingInfo = 1; -+ let DisableWQM = 1; - } - - let Uses = [EXEC], Defs = [EXEC, VCC, M0], -diff --git a/lib/Target/AMDGPU/SIWholeQuadMode.cpp b/lib/Target/AMDGPU/SIWholeQuadMode.cpp -index b200c15..1534d58 100644 ---- a/lib/Target/AMDGPU/SIWholeQuadMode.cpp -+++ b/lib/Target/AMDGPU/SIWholeQuadMode.cpp -@@ -219,13 +219,6 @@ char SIWholeQuadMode::scanInstructions(MachineFunction &MF, - markInstruction(MI, Flags, Worklist); - GlobalFlags |= Flags; - } -- -- if (WQMOutputs && MBB.succ_empty()) { -- // This is a prolog shader. Make sure we go back to exact mode at the end. -- Blocks[&MBB].OutNeeds = StateExact; -- Worklist.push_back(&MBB); -- GlobalFlags |= StateExact; -- } - } - - return GlobalFlags; -diff --git a/test/CodeGen/AMDGPU/wqm.ll b/test/CodeGen/AMDGPU/wqm.ll -index 809a7ba..41e4264 100644 ---- a/test/CodeGen/AMDGPU/wqm.ll -+++ b/test/CodeGen/AMDGPU/wqm.ll -@@ -17,17 +17,18 @@ main_body: - ;CHECK-LABEL: {{^}}test2: - ;CHECK-NEXT: ; %main_body - ;CHECK-NEXT: s_wqm_b64 exec, exec --;CHECK: image_sample - ;CHECK-NOT: exec --;CHECK: _load_dword v0, --define amdgpu_ps float @test2(<8 x i32> inreg %rsrc, <4 x i32> inreg %sampler, float addrspace(1)* inreg %ptr, <4 x i32> %c) { -+define amdgpu_ps void @test2(<8 x i32> inreg %rsrc, <4 x i32> inreg %sampler, float addrspace(1)* inreg %ptr, <4 x i32> %c) { - main_body: - %c.1 = call <4 x float> @llvm.SI.image.sample.v4i32(<4 x i32> %c, <8 x i32> %rsrc, <4 x i32> %sampler, i32 15, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0) - %c.2 = bitcast <4 x float> %c.1 to <4 x i32> - %c.3 = extractelement <4 x i32> %c.2, i32 0 - %gep = getelementptr float, float addrspace(1)* %ptr, i32 %c.3 - %data = load float, float addrspace(1)* %gep -- ret float %data -+ -+ call void @llvm.SI.export(i32 15, i32 1, i32 1, i32 0, i32 1, float %data, float undef, float undef, float undef) -+ -+ ret void - } - - ; ... but disabled for stores (and, in this simple case, not re-enabled). -@@ -414,6 +415,46 @@ entry: - ret void - } - -+; Must return to exact at the end of a non-void returning shader, -+; otherwise the EXEC mask exported by the epilog will be wrong. This is true -+; even if the shader has no kills, because a kill could have happened in a -+; previous shader fragment. -+; -+; CHECK-LABEL: {{^}}test_nonvoid_return: -+; CHECK: s_mov_b64 [[LIVE:s\[[0-9]+:[0-9]+\]]], exec -+; CHECK: s_wqm_b64 exec, exec -+; -+; CHECK: s_and_b64 exec, exec, [[LIVE]] -+; CHECK-NOT: exec -+define amdgpu_ps <4 x float> @test_nonvoid_return() nounwind { -+ %tex = call <4 x float> @llvm.SI.image.sample.v4i32(<4 x i32> undef, <8 x i32> undef, <4 x i32> undef, i32 15, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0) -+ %tex.i = bitcast <4 x float> %tex to <4 x i32> -+ %dtex = call <4 x float> @llvm.SI.image.sample.v4i32(<4 x i32> %tex.i, <8 x i32> undef, <4 x i32> undef, i32 15, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0) -+ ret <4 x float> %dtex -+} -+ -+; CHECK-LABEL: {{^}}test_nonvoid_return_unreachable: -+; CHECK: s_mov_b64 [[LIVE:s\[[0-9]+:[0-9]+\]]], exec -+; CHECK: s_wqm_b64 exec, exec -+; -+; CHECK: s_and_b64 exec, exec, [[LIVE]] -+; CHECK-NOT: exec -+define amdgpu_ps <4 x float> @test_nonvoid_return_unreachable(i32 inreg %c) nounwind { -+entry: -+ %tex = call <4 x float> @llvm.SI.image.sample.v4i32(<4 x i32> undef, <8 x i32> undef, <4 x i32> undef, i32 15, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0) -+ %tex.i = bitcast <4 x float> %tex to <4 x i32> -+ %dtex = call <4 x float> @llvm.SI.image.sample.v4i32(<4 x i32> %tex.i, <8 x i32> undef, <4 x i32> undef, i32 15, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0) -+ -+ %cc = icmp sgt i32 %c, 0 -+ br i1 %cc, label %if, label %else -+ -+if: -+ store volatile <4 x float> %dtex, <4 x float>* undef -+ unreachable -+ -+else: -+ ret <4 x float> %dtex -+} - - declare void @llvm.amdgcn.image.store.v4i32(<4 x float>, <4 x i32>, <8 x i32>, i32, i1, i1, i1, i1) #1 - declare void @llvm.amdgcn.buffer.store.f32(float, <4 x i32>, i32, i32, i1, i1) #1 diff --git a/abs/extra/llvm/PKGBUILD b/abs/extra/llvm/PKGBUILD index 9e69c02..64ba5b2 100644 --- a/abs/extra/llvm/PKGBUILD +++ b/abs/extra/llvm/PKGBUILD @@ -9,62 +9,64 @@ # Contributor: Roberto Alsina # Contributor: Gerardo Exequiel Pozzi -pkgname=('llvm' 'llvm-libs' 'llvm-ocaml' 'lldb' 'clang' 'clang-tools-extra') -pkgver=3.9.1 +pkgname=('llvm' 'llvm-libs' 'llvm-ocaml' 'lld' 'lldb' 'clang' 'clang-tools-extra') +pkgver=5.0.1 pkgrel=2 -_ocaml_ver=4.04.0 -arch=('i686' 'x86_64') +_ocaml_ver=4.06.0 +arch=('x86_64') url="http://llvm.org/" license=('custom:University of Illinois/NCSA Open Source License') -makedepends=('cmake' 'libffi' 'python2' "ocaml=$_ocaml_ver" 'python2-sphinx' +makedepends=('cmake' 'libffi' 'python2' "ocaml=$_ocaml_ver" 'python-sphinx' 'ocaml-ctypes' 'ocaml-findlib' 'libedit' 'swig') -# Use gcc-multilib to build 32-bit compiler-rt libraries on x86_64 (FS#41911) -#makedepends_x86_64=('gcc-multilib') +# Build 32-bit compiler-rt libraries on x86_64 (FS#41911) +makedepends_x86_64=('lib32-gcc-libs') options=('staticlibs') -source=(http://llvm.org/releases/$pkgver/llvm-$pkgver.src.tar.xz{,.sig} - http://llvm.org/releases/$pkgver/cfe-$pkgver.src.tar.xz{,.sig} - http://llvm.org/releases/$pkgver/clang-tools-extra-$pkgver.src.tar.xz{,.sig} - http://llvm.org/releases/$pkgver/compiler-rt-$pkgver.src.tar.xz{,.sig} - http://llvm.org/releases/$pkgver/lldb-$pkgver.src.tar.xz{,.sig} - AMDGPU-Fix-an-interaction-between-WQM-and-polygon-stippling.patch - msan-prevent-initialization-failure-with-newer-glibc.patch - llvm-Config-llvm-config.h) -sha256sums=('1fd90354b9cf19232e8f168faf2220e79be555df3aa743242700879e8fd329ee' +source=(https://releases.llvm.org/$pkgver/llvm-$pkgver.src.tar.xz{,.sig} + https://releases.llvm.org/$pkgver/cfe-$pkgver.src.tar.xz{,.sig} + https://releases.llvm.org/$pkgver/clang-tools-extra-$pkgver.src.tar.xz{,.sig} + https://releases.llvm.org/$pkgver/compiler-rt-$pkgver.src.tar.xz{,.sig} + https://releases.llvm.org/$pkgver/lld-$pkgver.src.tar.xz{,.sig} + https://releases.llvm.org/$pkgver/lldb-$pkgver.src.tar.xz{,.sig} + 0001-GCC-compatibility-Ignore-the-fno-plt-flag.patch + 0002-Enable-SSP-and-PIE-by-default.patch + disable-llvm-symbolizer-test.patch + llvm-config.h) +sha256sums=('5fa7489fc0225b11821cab0362f5813a05f2bcf2533e8a4ea9c9c860168807b0' 'SKIP' - 'e6c4cebb96dee827fa0470af313dff265af391cb6da8d429842ef208c8f25e63' + '135f6c9b0cd2da1aff2250e065946258eb699777888df39ca5a5b4fe5e23d0ff' 'SKIP' - '29a5b65bdeff7767782d4427c7c64d54c3a8684bc6b217b74a70e575e4813635' + '9aada1f9d673226846c3399d13fab6bba4bfd38bcfe8def5ee7b0ec24f8cd225' 'SKIP' - 'd30967b1a5fa51a2503474aacc913e69fd05ae862d37bf310088955bdb13ec99' + '4edd1417f457a9b3f0eb88082530490edf3cf6a7335cdce8ecbc5d3e16a895da' 'SKIP' - '7e3311b2a1f80f4d3426e09f9459d079cab4d698258667e50a46dccbaaa460fc' + 'd5b36c0005824f07ab093616bdff247f3da817cae2c51371e1d1473af717d895' 'SKIP' - 'adadc41090ab0eb33fe4449a0ea3f02b15d03f186262dd89576848a2c66d0ce6' - '8e4f194c2283b91644a7fff43bc4e58c36b5507f2a4d90b72f275c0bd7511c20' + 'b7c1c9e67975ca219089a3a6a9c77c2d102cead2dc38264f2524aa3326da376a' + 'SKIP' + 'a1ba7fb859ac157c4b4342435cd656e29b1e1d9bddcb8ae0158a91c0a8ba6203' + '186f2d10b013395f2dd6e1fd3baf4961a2e40c403f115517c9b253682934f50f' + '6fff47ab5ede79d45fe64bb4903b7dfc27212a38e6cd5d01e60ebd24b7557359' '597dc5968c695bbdbb0eac9e8eb5117fcd2773bc91edf5ec103ecffffab8bc48') validpgpkeys=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D' '11E521D646982372EB577A1F8F0871F202119294') prepare() { cd "$srcdir/llvm-$pkgver.src" + mkdir build - # At the present, clang must reside inside the LLVM source code tree to build - # See http://llvm.org/bugs/show_bug.cgi?id=4840 mv "$srcdir/cfe-$pkgver.src" tools/clang - mv "$srcdir/clang-tools-extra-$pkgver.src" tools/clang/tools/extra - mv "$srcdir/compiler-rt-$pkgver.src" projects/compiler-rt - + mv "$srcdir/lld-$pkgver.src" tools/lld mv "$srcdir/lldb-$pkgver.src" tools/lldb - # https://bugs.freedesktop.org/show_bug.cgi?id=99078 - patch -Rp1 -i ../AMDGPU-Fix-an-interaction-between-WQM-and-polygon-stippling.patch + # Disable test that fails when compiled as PIE + # https://bugs.llvm.org/show_bug.cgi?id=31870 + patch -Np1 <../disable-llvm-symbolizer-test.patch - # https://reviews.llvm.org/D24736 - patch -Np0 -d projects/compiler-rt <../msan-prevent-initialization-failure-with-newer-glibc.patch - - mkdir build + # Enable SSP and PIE by default + patch -Np1 -d tools/clang <../0001-GCC-compatibility-Ignore-the-fno-plt-flag.patch + patch -Np1 -d tools/clang <../0002-Enable-SSP-and-PIE-by-default.patch } build() { @@ -82,7 +84,6 @@ build() { -DLLVM_BUILD_DOCS=ON \ -DLLVM_ENABLE_SPHINX=ON \ -DLLVM_ENABLE_DOXYGEN=OFF \ - -DLLDB_DISABLE_LIBEDIT=1 \ -DSPHINX_WARNINGS_AS_ERRORS=OFF \ -DFFI_INCLUDE_DIR=$(pkg-config --variable=includedir libffi) \ -DLLVM_BINUTILS_INCDIR=/usr/include \ @@ -92,20 +93,19 @@ build() { make ocaml_doc # Disable automatic installation of components that go into subpackages - sed -i '/\(clang\|lldb\)\/cmake_install.cmake/d' tools/cmake_install.cmake + sed -i '/\(clang\|lld\|lldb\)\/cmake_install.cmake/d' tools/cmake_install.cmake sed -i '/extra\/cmake_install.cmake/d' tools/clang/tools/cmake_install.cmake sed -i '/compiler-rt\/cmake_install.cmake/d' projects/cmake_install.cmake } check() { cd "$srcdir/llvm-$pkgver.src/build" - make check - make check-clang + make check-{llvm,clang,clang-tools,lld} } package_llvm() { pkgdesc="Low Level Virtual Machine" - depends=("llvm-libs=$pkgver-$pkgrel" 'perl') + depends=('llvm-libs' 'perl') cd "$srcdir/llvm-$pkgver.src" @@ -115,21 +115,19 @@ package_llvm() { rm -r "$pkgdir"/usr/share/doc/$pkgname/html/{_sources,.buildinfo} # The runtime libraries go into llvm-libs - mv -f "$pkgdir"/usr/lib/lib{LLVM,LTO}*.so "$srcdir" + mv -f "$pkgdir"/usr/lib/lib{LLVM,LTO}*.so* "$srcdir" mv -f "$pkgdir"/usr/lib/LLVMgold.so "$srcdir" # OCaml bindings go to a separate package rm -rf "$srcdir"/ocaml.{lib,doc} mv "$pkgdir/usr/lib/ocaml" "$srcdir/ocaml.lib" - mv "$pkgdir/usr/docs/ocaml/html" "$srcdir/ocaml.doc" - rm -r "$pkgdir/usr/docs" + mv "$pkgdir/usr/share/doc/$pkgname/ocaml-html" "$srcdir/ocaml.doc" if [[ $CARCH == x86_64 ]]; then # Needed for multilib (https://bugs.archlinux.org/task/29951) # Header stub is taken from Fedora mv "$pkgdir/usr/include/llvm/Config/llvm-config"{,-64}.h - cp "$srcdir/llvm-Config-llvm-config.h" \ - "$pkgdir/usr/include/llvm/Config/llvm-config.h" + cp "$srcdir/llvm-config.h" "$pkgdir/usr/include/llvm/Config/llvm-config.h" fi install -Dm644 LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE" @@ -141,7 +139,7 @@ package_llvm-libs() { install -d "$pkgdir/usr/lib" cp -P \ - "$srcdir"/lib{LLVM,LTO}*.so \ + "$srcdir"/lib{LLVM,LTO}*.so* \ "$srcdir"/LLVMgold.so \ "$pkgdir/usr/lib/" @@ -156,21 +154,36 @@ package_llvm-libs() { package_llvm-ocaml() { pkgdesc="OCaml bindings for LLVM" - depends=("llvm=$pkgver-$pkgrel" "ocaml=$_ocaml_ver" 'ocaml-ctypes') + depends=('llvm' "ocaml=$_ocaml_ver" 'ocaml-ctypes') cd "$srcdir/llvm-$pkgver.src" - install -d "$pkgdir"/{usr/lib,usr/share/doc} + install -d "$pkgdir"/{usr/lib,usr/share/doc/$pkgname} cp -a "$srcdir/ocaml.lib" "$pkgdir/usr/lib/ocaml" - cp -a "$srcdir/ocaml.doc" "$pkgdir/usr/share/doc/$pkgname" + cp -a "$srcdir/ocaml.doc" "$pkgdir/usr/share/doc/$pkgname/html" install -Dm644 LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE" } +package_lld() { + pkgdesc="Linker from the LLVM project" + url="http://lld.llvm.org/" + depends=('llvm-libs') + + cd "$srcdir/llvm-$pkgver.src" + + make -C build/tools/lld DESTDIR="$pkgdir" install + + # Remove documentation sources + rm -r "$pkgdir"/usr/share/doc/$pkgname/html/{_sources,.buildinfo} + + install -Dm644 tools/$pkgname/LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE" +} + package_lldb() { pkgdesc="Next generation, high-performance debugger" url="http://lldb.llvm.org/" - depends=('libxml2' 'python2' 'python2-six') + depends=('llvm-libs' 'libxml2' 'python2' 'python2-six') cd "$srcdir/llvm-$pkgver.src" @@ -178,7 +191,7 @@ package_lldb() { # https://bugs.archlinux.org/task/50759 sed -i "/import_module('_lldb')/s/_lldb/lldb.&/" \ - "$pkgdir/usr/lib/python2.7/site-packages/lldb/__init__.py" + "$pkgdir/usr/lib/python2.7/site-packages/lldb/__init__.py" # Remove bundled six library rm "$pkgdir/usr/lib/python2.7/site-packages/six.py" @@ -187,13 +200,13 @@ package_lldb() { python2 -m compileall "$pkgdir/usr/lib/python2.7/site-packages/lldb" python2 -O -m compileall "$pkgdir/usr/lib/python2.7/site-packages/lldb" - install -Dm644 tools/lldb/LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE" + install -Dm644 tools/$pkgname/LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE" } package_clang() { pkgdesc="C language family frontend for LLVM" url="http://clang.llvm.org/" - depends=("llvm-libs=$pkgver-$pkgrel" 'gcc' 'libxml2') + depends=('llvm-libs' 'gcc' 'libxml2') optdepends=('openmp: OpenMP support in clang with -fopenmp' 'python2: for scan-view and git-clang-format') provides=("clang-analyzer=$pkgver") @@ -227,19 +240,22 @@ package_clang() { python2 -m compileall "$pkgdir" python2 -O -m compileall "$pkgdir" - install -Dm644 tools/clang/LICENSE.TXT \ + install -Dm644 tools/$pkgname/LICENSE.TXT \ "$pkgdir/usr/share/licenses/$pkgname/LICENSE" } package_clang-tools-extra() { pkgdesc="Extra tools built using clang's tooling APIs" url="http://clang.llvm.org/" - depends=("clang=$pkgver-$pkgrel") + depends=('clang') cd "$srcdir/llvm-$pkgver.src" make -C build/tools/clang/tools/extra DESTDIR="$pkgdir" install + # Remove documentation sources + rm -r "$pkgdir"/usr/share/doc/clang-tools/html/{_sources,.buildinfo} + # Use Python 2 sed -i 's|/usr/bin/env python|&2|' \ "$pkgdir"/usr/share/clang/{clang-tidy-diff,run-clang-tidy,run-find-all-symbols}.py diff --git a/abs/extra/llvm/__changelog b/abs/extra/llvm/__changelog deleted file mode 100644 index 57db2dd..0000000 --- a/abs/extra/llvm/__changelog +++ /dev/null @@ -1,2 +0,0 @@ -PKGBUILD: change python-sphinx to python2-sphinx -PKGBUILD: remove gcc-multilib diff --git a/abs/extra/llvm/disable-llvm-symbolizer-test.patch b/abs/extra/llvm/disable-llvm-symbolizer-test.patch new file mode 100644 index 0000000..f949169 --- /dev/null +++ b/abs/extra/llvm/disable-llvm-symbolizer-test.patch @@ -0,0 +1,26 @@ +Description: Silent a test failing on yakkety amd64 + /tmp/buildd/llvm-toolchain-snapshot-4.0~svn279801/test/tools/llvm-symbolizer/print_context.c:16:11: error: expected string not found in input + // CHECK: inc + ^ + :1:1: note: scanning from here + _fini + ^ + :1:3: note: possible intended match here + _fini + ^ +Author: Sylvestre +Last-Update: 2016-08-26 + +Index: llvm-toolchain-3.9-3.9~+rc1/test/tools/llvm-symbolizer/print_context.c +=================================================================== +--- llvm-toolchain-3.9-3.9~+rc1.orig/test/tools/llvm-symbolizer/print_context.c ++++ llvm-toolchain-3.9-3.9~+rc1/test/tools/llvm-symbolizer/print_context.c +@@ -1,7 +1,7 @@ + // REQUIRES: x86_64-linux + // RUN: %host_cc -O0 -g %s -o %t 2>&1 + // RUN: %t 2>&1 | llvm-symbolizer -print-source-context-lines=5 -obj=%t | FileCheck %s +- ++// XFAIL: * + #include + + int inc(int a) { diff --git a/abs/extra/llvm/llvm-Config-llvm-config.h b/abs/extra/llvm/llvm-Config-llvm-config.h deleted file mode 100644 index 2fa08c9..0000000 --- a/abs/extra/llvm/llvm-Config-llvm-config.h +++ /dev/null @@ -1,9 +0,0 @@ -#include - -#if __WORDSIZE == 32 -#include "llvm-config-32.h" -#elif __WORDSIZE == 64 -#include "llvm-config-64.h" -#else -#error "Unknown word size" -#endif diff --git a/abs/extra/llvm/llvm-config.h b/abs/extra/llvm/llvm-config.h new file mode 100644 index 0000000..2fa08c9 --- /dev/null +++ b/abs/extra/llvm/llvm-config.h @@ -0,0 +1,9 @@ +#include + +#if __WORDSIZE == 32 +#include "llvm-config-32.h" +#elif __WORDSIZE == 64 +#include "llvm-config-64.h" +#else +#error "Unknown word size" +#endif diff --git a/abs/extra/llvm/msan-prevent-initialization-failure-with-newer-glibc.patch b/abs/extra/llvm/msan-prevent-initialization-failure-with-newer-glibc.patch deleted file mode 100644 index 57387a6..0000000 --- a/abs/extra/llvm/msan-prevent-initialization-failure-with-newer-glibc.patch +++ /dev/null @@ -1,103 +0,0 @@ -Index: lib/msan/msan_interceptors.cc -=================================================================== ---- lib/msan/msan_interceptors.cc (revision 282231) -+++ lib/msan/msan_interceptors.cc (revision 282232) -@@ -64,6 +64,23 @@ - return in_interceptor_scope; - } - -+static uptr allocated_for_dlsym; -+static const uptr kDlsymAllocPoolSize = 1024; -+static uptr alloc_memory_for_dlsym[kDlsymAllocPoolSize]; -+ -+static bool IsInDlsymAllocPool(const void *ptr) { -+ uptr off = (uptr)ptr - (uptr)alloc_memory_for_dlsym; -+ return off < sizeof(alloc_memory_for_dlsym); -+} -+ -+static void *AllocateFromLocalPool(uptr size_in_bytes) { -+ uptr size_in_words = RoundUpTo(size_in_bytes, kWordSize) / kWordSize; -+ void *mem = (void *)&alloc_memory_for_dlsym[allocated_for_dlsym]; -+ allocated_for_dlsym += size_in_words; -+ CHECK_LT(allocated_for_dlsym, kDlsymAllocPoolSize); -+ return mem; -+} -+ - #define ENSURE_MSAN_INITED() do { \ - CHECK(!msan_init_is_running); \ - if (!msan_inited) { \ -@@ -227,7 +244,7 @@ - - INTERCEPTOR(void, free, void *ptr) { - GET_MALLOC_STACK_TRACE; -- if (!ptr) return; -+ if (!ptr || UNLIKELY(IsInDlsymAllocPool(ptr))) return; - MsanDeallocate(&stack, ptr); - } - -@@ -234,7 +251,7 @@ - #if !SANITIZER_FREEBSD - INTERCEPTOR(void, cfree, void *ptr) { - GET_MALLOC_STACK_TRACE; -- if (!ptr) return; -+ if (!ptr || UNLIKELY(IsInDlsymAllocPool(ptr))) return; - MsanDeallocate(&stack, ptr); - } - #define MSAN_MAYBE_INTERCEPT_CFREE INTERCEPT_FUNCTION(cfree) -@@ -907,27 +924,29 @@ - - INTERCEPTOR(void *, calloc, SIZE_T nmemb, SIZE_T size) { - GET_MALLOC_STACK_TRACE; -- if (UNLIKELY(!msan_inited)) { -+ if (UNLIKELY(!msan_inited)) - // Hack: dlsym calls calloc before REAL(calloc) is retrieved from dlsym. -- const SIZE_T kCallocPoolSize = 1024; -- static uptr calloc_memory_for_dlsym[kCallocPoolSize]; -- static SIZE_T allocated; -- SIZE_T size_in_words = ((nmemb * size) + kWordSize - 1) / kWordSize; -- void *mem = (void*)&calloc_memory_for_dlsym[allocated]; -- allocated += size_in_words; -- CHECK(allocated < kCallocPoolSize); -- return mem; -- } -+ return AllocateFromLocalPool(nmemb * size); - return MsanCalloc(&stack, nmemb, size); - } - - INTERCEPTOR(void *, realloc, void *ptr, SIZE_T size) { - GET_MALLOC_STACK_TRACE; -+ if (UNLIKELY(IsInDlsymAllocPool(ptr))) { -+ uptr offset = (uptr)ptr - (uptr)alloc_memory_for_dlsym; -+ uptr copy_size = Min(size, kDlsymAllocPoolSize - offset); -+ void *new_ptr = AllocateFromLocalPool(size); -+ internal_memcpy(new_ptr, ptr, copy_size); -+ return new_ptr; -+ } - return MsanReallocate(&stack, ptr, size, sizeof(u64), false); - } - - INTERCEPTOR(void *, malloc, SIZE_T size) { - GET_MALLOC_STACK_TRACE; -+ if (UNLIKELY(!msan_inited)) -+ // Hack: dlsym calls malloc before REAL(malloc) is retrieved from dlsym. -+ return AllocateFromLocalPool(size); - return MsanReallocate(&stack, nullptr, size, sizeof(u64), false); - } - -Index: lib/asan/asan_malloc_linux.cc -=================================================================== ---- lib/asan/asan_malloc_linux.cc (revision 282231) -+++ lib/asan/asan_malloc_linux.cc (revision 282232) -@@ -78,7 +78,11 @@ - if (UNLIKELY(IsInDlsymAllocPool(ptr))) { - uptr offset = (uptr)ptr - (uptr)alloc_memory_for_dlsym; - uptr copy_size = Min(size, kDlsymAllocPoolSize - offset); -- void *new_ptr = asan_malloc(size, &stack); -+ void *new_ptr; -+ if (UNLIKELY(!asan_inited)) -+ new_ptr = AllocateFromLocalPool(size); -+ else -+ new_ptr = asan_malloc(size, &stack); - internal_memcpy(new_ptr, ptr, copy_size); - return new_ptr; - } -- cgit v0.12