From 9b5539e2ce96af00c820c471ffffa76011764e51 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Wed, 31 May 2017 09:58:32 +0000 Subject: [PATCH 1/6] Driver: Update devtoolset usage for RHEL - remove path to dts-1.x (corresponds to gcc 4.7) - add path to dts-6 (corresponds to 6.x) Patch By: Maria Gottschalk Differential Revision: https://reviews.llvm.org/D29855 git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_40@304292 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/ToolChains.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 9bc9ae4f6a..5ddc32bfc6 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -1442,11 +1442,10 @@ void Generic_GCC::GCCInstallationDetector::init( // Then look for distribution supplied gcc installations. if (D.SysRoot.empty()) { // Look for RHEL devtoolsets. + Prefixes.push_back("/opt/rh/devtoolset-6/root/usr"); Prefixes.push_back("/opt/rh/devtoolset-4/root/usr"); Prefixes.push_back("/opt/rh/devtoolset-3/root/usr"); Prefixes.push_back("/opt/rh/devtoolset-2/root/usr"); - Prefixes.push_back("/opt/rh/devtoolset-1.1/root/usr"); - Prefixes.push_back("/opt/rh/devtoolset-1.0/root/usr"); // And finally in /usr. Prefixes.push_back("/usr"); } From 476b65415fd05f9825ffec4af4a98844c6885c84 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Wed, 31 May 2017 09:58:34 +0000 Subject: [PATCH 2/6] Driver: Don't mix system tools with devtoolset tools on RHEL For example, we don't want to mix a devtoolset gcc with system ld, because they don't always work together. git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_40@304293 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/ToolChains.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 5ddc32bfc6..1dd34ae70a 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -4111,6 +4111,15 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) Distro Distro(D.getVFS()); + if (Distro.IsRedhat()) { + // On RHEL, we want to add a bin directory that is relative to the detected + // gcc install, because if we are using devtoolset gcc then we want to + // use other tools from devtoolset (e.g. ld) instead of the standard system + // tools. + PPaths.push_back(Twine(GCCInstallation.getParentLibPath() + + "/../bin").str()); + } + if (Distro.IsOpenSUSE() || Distro.IsUbuntu()) { ExtraOpts.push_back("-z"); ExtraOpts.push_back("relro"); From 8bd8e90853ec347c5cf68ff7d01fa195d2ab22fc Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Wed, 31 May 2017 09:58:36 +0000 Subject: [PATCH 3/6] Merging r298177: ------------------------------------------------------------------------ r298177 | niravd | 2017-03-17 20:43:39 -0400 (Fri, 17 Mar 2017) | 7 lines [X86] Add NumRegisterParameters Module Flag. Reviewers: rnk, mkuper Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D27051 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_40@304294 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.cpp | 7 +++++++ test/CodeGen/pr3997.c | 13 +++++++++++++ test/Headers/altivec-header.c | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 test/CodeGen/pr3997.c diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 36005430ae..f14354a12d 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -159,6 +159,12 @@ CodeGenModule::CodeGenModule(ASTContext &C, const HeaderSearchOptions &HSO, // CoverageMappingModuleGen object. if (CodeGenOpts.CoverageMapping) CoverageMapping.reset(new CoverageMappingModuleGen(*this, *CoverageInfo)); + + // Record mregparm value now so it is visible through rest of codegen. + if (Context.getTargetInfo().getTriple().getArch() == llvm::Triple::x86) + getModule().addModuleFlag(llvm::Module::Error, "NumRegisterParameters", + CodeGenOpts.NumRegisterParameters); + } CodeGenModule::~CodeGenModule() {} @@ -416,6 +422,7 @@ void CodeGenModule::Release() { (Context.getLangOpts().Modules || !LinkerOptionsMetadata.empty())) { EmitModuleLinkOptions(); } + if (CodeGenOpts.DwarfVersion) { // We actually want the latest version when there are conflicts. // We can change from Warning to Latest if such mode is supported. diff --git a/test/CodeGen/pr3997.c b/test/CodeGen/pr3997.c new file mode 100644 index 0000000000..814144cd14 --- /dev/null +++ b/test/CodeGen/pr3997.c @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 %s -triple i386-unknown-linux-gnu -mregparm 3 -emit-llvm -o - | FileCheck %s + +void *memcpy(void *dest, const void *src, unsigned int n); + +void use_builtin_memcpy(void *dest, const void *src, unsigned int n) { + __builtin_memcpy(dest, src, n); +} + +void use_memcpy(void *dest, const void *src, unsigned int n) { + memcpy(dest, src, n); +} + +//CHECK: !{i32 1, !"NumRegisterParameters", i32 3} diff --git a/test/Headers/altivec-header.c b/test/Headers/altivec-header.c index 0ea9e2b52d..26f42e1400 100644 --- a/test/Headers/altivec-header.c +++ b/test/Headers/altivec-header.c @@ -9,4 +9,4 @@ // CHECK: target triple = "powerpc64- // CHECK-NEXT: {{^$}} -// CHECK-NEXT: llvm.ident +// CHECK-NEXT: {{llvm\..*}} From c6e339a400e46d4784433114aa45a70ea159fc22 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Wed, 31 May 2017 10:01:13 +0000 Subject: [PATCH 4/6] Revert "Driver: Update devtoolset usage for RHEL" This reverts commit r304292. This was committed accidentally. git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_40@304295 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/ToolChains.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index 1dd34ae70a..a06a8a5863 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -1442,10 +1442,11 @@ void Generic_GCC::GCCInstallationDetector::init( // Then look for distribution supplied gcc installations. if (D.SysRoot.empty()) { // Look for RHEL devtoolsets. - Prefixes.push_back("/opt/rh/devtoolset-6/root/usr"); Prefixes.push_back("/opt/rh/devtoolset-4/root/usr"); Prefixes.push_back("/opt/rh/devtoolset-3/root/usr"); Prefixes.push_back("/opt/rh/devtoolset-2/root/usr"); + Prefixes.push_back("/opt/rh/devtoolset-1.1/root/usr"); + Prefixes.push_back("/opt/rh/devtoolset-1.0/root/usr"); // And finally in /usr. Prefixes.push_back("/usr"); } From 3c8961bedc65c9a15cbe67a2ef385a0938f7cfef Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Wed, 31 May 2017 10:01:14 +0000 Subject: [PATCH 5/6] Revert "Driver: Don't mix system tools with devtoolset tools on RHEL" This reverts commit r304293. This was comitted accidentally. git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_40@304296 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/ToolChains.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp index a06a8a5863..9bc9ae4f6a 100644 --- a/lib/Driver/ToolChains.cpp +++ b/lib/Driver/ToolChains.cpp @@ -4112,15 +4112,6 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) Distro Distro(D.getVFS()); - if (Distro.IsRedhat()) { - // On RHEL, we want to add a bin directory that is relative to the detected - // gcc install, because if we are using devtoolset gcc then we want to - // use other tools from devtoolset (e.g. ld) instead of the standard system - // tools. - PPaths.push_back(Twine(GCCInstallation.getParentLibPath() + - "/../bin").str()); - } - if (Distro.IsOpenSUSE() || Distro.IsUbuntu()) { ExtraOpts.push_back("-z"); ExtraOpts.push_back("relro"); From 052e39e595d0907bc20ef4f6633a4698656457d6 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Wed, 14 Jun 2017 12:46:04 -0600 Subject: [PATCH 6/6] undo permssion changes --- lib/Driver/ToolChains.cpp | 0 lib/Driver/ToolChains.h | 0 lib/Driver/Tools.h | 0 lib/Driver/Types.cpp | 0 4 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 lib/Driver/ToolChains.cpp mode change 100755 => 100644 lib/Driver/ToolChains.h mode change 100755 => 100644 lib/Driver/Tools.h mode change 100755 => 100644 lib/Driver/Types.cpp diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp old mode 100755 new mode 100644 diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h old mode 100755 new mode 100644 diff --git a/lib/Driver/Tools.h b/lib/Driver/Tools.h old mode 100755 new mode 100644 diff --git a/lib/Driver/Types.cpp b/lib/Driver/Types.cpp old mode 100755 new mode 100644