зеркало из https://github.com/microsoft/clang-1.git
Add a check that -static is not used with -dynamic or -mdynamic-no-pic.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81421 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
88a3d6cf5e
Коммит
e2fd66418e
|
@ -48,6 +48,17 @@ static void CheckPreprocessingOptions(const Driver &D, const ArgList &Args) {
|
|||
<< A->getAsString(Args) << "-E";
|
||||
}
|
||||
|
||||
/// CheckCodeGenerationOptions - Perform some validation of code generation
|
||||
/// arguments that is shared with gcc.
|
||||
static void CheckCodeGenerationOptions(const Driver &D, const ArgList &Args) {
|
||||
// In gcc, only ARM checks this, but it seems reasonable to check universally.
|
||||
if (Args.hasArg(options::OPT_static))
|
||||
if (const Arg *A = Args.getLastArg(options::OPT_dynamic,
|
||||
options::OPT_mdynamic_no_pic))
|
||||
D.Diag(clang::diag::err_drv_argument_not_allowed_with)
|
||||
<< A->getAsString(Args) << "-static";
|
||||
}
|
||||
|
||||
void Clang::AddPreprocessingOptions(const Driver &D,
|
||||
const ArgList &Args,
|
||||
ArgStringList &CmdArgs,
|
||||
|
@ -321,6 +332,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
Args.AddAllArgValues(CmdArgs, options::OPT_Xanalyzer);
|
||||
}
|
||||
|
||||
CheckCodeGenerationOptions(D, Args);
|
||||
|
||||
// Perform argument translation for LLVM backend. This
|
||||
// takes some care in reconciling with llvm-gcc. The
|
||||
// issue is that llvm-gcc translates these options based on
|
||||
|
@ -897,6 +910,10 @@ darwin::CC1::getDependencyFileName(const ArgList &Args,
|
|||
|
||||
void darwin::CC1::AddCC1Args(const ArgList &Args,
|
||||
ArgStringList &CmdArgs) const {
|
||||
const Driver &D = getToolChain().getHost().getDriver();
|
||||
|
||||
CheckCodeGenerationOptions(D, Args);
|
||||
|
||||
// Derived from cc1 spec.
|
||||
if (!Args.hasArg(options::OPT_mkernel) && !Args.hasArg(options::OPT_static) &&
|
||||
!Args.hasArg(options::OPT_mdynamic_no_pic))
|
||||
|
|
Загрузка…
Ссылка в новой задаче