[Driver] Disable -faddrsig on Gentoo by default
authorMichal Gorny <mgorny@gentoo.org>
Sun, 23 Dec 2018 15:07:26 +0000 (15:07 +0000)
committerMichal Gorny <mgorny@gentoo.org>
Sun, 23 Dec 2018 15:07:26 +0000 (15:07 +0000)
Gentoo supports combining clang toolchain with GNU binutils, and many
users actually do that.  As -faddrsig is not supported by GNU strip,
this results in a lot of warnings.  Disable it by default and let users
enable it explicitly if they want it; with the intent of reevaluating
when the underlying feature becomes standarized.

See also: https://bugs.gentoo.org/667854

Differential Revision: https://reviews.llvm.org/D56047

llvm-svn: 350028

clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/addrsig.c
clang/test/lit.cfg.py

index ec4fdd2..10487a6 100644 (file)
@@ -25,6 +25,7 @@
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/ObjCRuntime.h"
 #include "clang/Basic/Version.h"
+#include "clang/Driver/Distro.h"
 #include "clang/Driver/DriverDiagnostic.h"
 #include "clang/Driver/Options.h"
 #include "clang/Driver/SanitizerArgs.h"
@@ -5290,6 +5291,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
                     TC.getTriple().isOSBinFormatCOFF()) &&
                       !TC.getTriple().isPS4() &&
                       !TC.getTriple().isOSNetBSD() &&
+                      !Distro(D.getVFS()).IsGentoo() &&
                        TC.useIntegratedAs()))
     CmdArgs.push_back("-faddrsig");
 
index 739dcc3..556a908 100644 (file)
@@ -1,3 +1,6 @@
+// Gentoo disables -faddrsig by default
+// XFAIL: gentoo
+
 // RUN: %clang -### -target x86_64-unknown-linux -c %s 2>&1 | FileCheck -check-prefix=ADDRSIG %s
 // RUN: %clang -### -target x86_64-pc-win32 -c %s 2>&1 | FileCheck -check-prefix=ADDRSIG %s
 // RUN: %clang -### -target x86_64-unknown-linux -fno-integrated-as -c %s 2>&1 | FileCheck -check-prefix=NO-ADDRSIG %s
index d105f8d..e61b4bb 100644 (file)
@@ -190,3 +190,6 @@ lit.util.usePlatformSdkOnDarwin(config, lit_config)
 macOSSDKVersion = lit.util.findPlatformSdkVersionOnMacOS(config, lit_config)
 if macOSSDKVersion is not None:
     config.available_features.add('macos-sdk-' + macOSSDKVersion)
+
+if os.path.exists('/etc/gentoo-release'):
+    config.available_features.add('gentoo')