Skip to content

Commit

Permalink
[Driver] Disable -faddrsig on Gentoo by default
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mgorny committed Dec 23, 2018
1 parent f241228 commit dae01c3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions clang/lib/Driver/ToolChains/Clang.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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");

Expand Down
3 changes: 3 additions & 0 deletions clang/test/Driver/addrsig.c
@@ -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
Expand Down
3 changes: 3 additions & 0 deletions clang/test/lit.cfg.py
Expand Up @@ -190,3 +190,6 @@ def calculate_arch_features(arch_string):
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')

0 comments on commit dae01c3

Please sign in to comment.