forked from OSchip/llvm-project
[X86] Add -mno-iamcu option.
Add -mno-iamcu option to: 1) Countervail -miamcu option easily 2) Be compatible with GCC which supports this option Differential Revision: http://reviews.llvm.org/D21469 llvm-svn: 273147
This commit is contained in:
parent
d03f97211a
commit
e8e1ffef11
|
@ -1311,6 +1311,7 @@ def mx32 : Flag<["-"], "mx32">, Group<m_Group>, Flags<[DriverOption, CoreOption]
|
|||
def mabi_EQ : Joined<["-"], "mabi=">, Group<m_Group>;
|
||||
def miamcu : Flag<["-"], "miamcu">, Group<m_Group>, Flags<[DriverOption, CoreOption]>,
|
||||
HelpText<"Use Intel MCU ABI">;
|
||||
def mno_iamcu : Flag<["-"], "mno-iamcu">, Group<m_Group>, Flags<[DriverOption, CoreOption]>;
|
||||
def malign_functions_EQ : Joined<["-"], "malign-functions=">, Group<clang_ignored_m_Group>;
|
||||
def malign_loops_EQ : Joined<["-"], "malign-loops=">, Group<clang_ignored_m_Group>;
|
||||
def malign_jumps_EQ : Joined<["-"], "malign-jumps=">, Group<clang_ignored_m_Group>;
|
||||
|
|
|
@ -280,8 +280,9 @@ DerivedArgList *Driver::TranslateInputArgs(const InputArgList &Args) const {
|
|||
}
|
||||
|
||||
// Enforce -static if -miamcu is present.
|
||||
if (Args.hasArg(options::OPT_miamcu))
|
||||
DAL->AddFlagArg(0, Opts->getOption(options::OPT_static));
|
||||
if (Arg *Ar = Args.getLastArg(options::OPT_miamcu, options::OPT_mno_iamcu))
|
||||
if (Ar->getOption().matches(options::OPT_miamcu))
|
||||
DAL->AddFlagArg(0, Opts->getOption(options::OPT_static));
|
||||
|
||||
// Add a default value of -mlinker-version=, if one was given and the user
|
||||
// didn't specify one.
|
||||
|
@ -375,22 +376,24 @@ static llvm::Triple computeTargetTriple(const Driver &D,
|
|||
}
|
||||
|
||||
// Handle -miamcu flag.
|
||||
if (Args.hasArg(options::OPT_miamcu)) {
|
||||
if (Target.get32BitArchVariant().getArch() != llvm::Triple::x86)
|
||||
D.Diag(diag::err_drv_unsupported_opt_for_target) << "-miamcu"
|
||||
<< Target.str();
|
||||
if (Arg *Ar = Args.getLastArg(options::OPT_miamcu, options::OPT_mno_iamcu)) {
|
||||
if (Ar->getOption().matches(options::OPT_miamcu)) {
|
||||
if (Target.get32BitArchVariant().getArch() != llvm::Triple::x86)
|
||||
D.Diag(diag::err_drv_unsupported_opt_for_target) << "-miamcu"
|
||||
<< Target.str();
|
||||
|
||||
if (A && !A->getOption().matches(options::OPT_m32))
|
||||
D.Diag(diag::err_drv_argument_not_allowed_with)
|
||||
<< "-miamcu" << A->getBaseArg().getAsString(Args);
|
||||
if (A && !A->getOption().matches(options::OPT_m32))
|
||||
D.Diag(diag::err_drv_argument_not_allowed_with)
|
||||
<< "-miamcu" << A->getBaseArg().getAsString(Args);
|
||||
|
||||
Target.setArch(llvm::Triple::x86);
|
||||
Target.setArchName("i586");
|
||||
Target.setEnvironment(llvm::Triple::UnknownEnvironment);
|
||||
Target.setEnvironmentName("");
|
||||
Target.setOS(llvm::Triple::ELFIAMCU);
|
||||
Target.setVendor(llvm::Triple::UnknownVendor);
|
||||
Target.setVendorName("intel");
|
||||
Target.setArch(llvm::Triple::x86);
|
||||
Target.setArchName("i586");
|
||||
Target.setEnvironment(llvm::Triple::UnknownEnvironment);
|
||||
Target.setEnvironmentName("");
|
||||
Target.setOS(llvm::Triple::ELFIAMCU);
|
||||
Target.setVendor(llvm::Triple::UnknownVendor);
|
||||
Target.setVendorName("intel");
|
||||
}
|
||||
}
|
||||
|
||||
return Target;
|
||||
|
|
|
@ -2243,10 +2243,12 @@ void Clang::AddX86TargetArgs(const ArgList &Args,
|
|||
}
|
||||
|
||||
// Set flags to support MCU ABI.
|
||||
if (Args.hasArg(options::OPT_miamcu)) {
|
||||
CmdArgs.push_back("-mfloat-abi");
|
||||
CmdArgs.push_back("soft");
|
||||
CmdArgs.push_back("-mstack-alignment=4");
|
||||
if (Arg *A = Args.getLastArg(options::OPT_miamcu, options::OPT_mno_iamcu)) {
|
||||
if (A->getOption().matches(options::OPT_miamcu)) {
|
||||
CmdArgs.push_back("-mfloat-abi");
|
||||
CmdArgs.push_back("soft");
|
||||
CmdArgs.push_back("-mstack-alignment=4");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,9 +4,11 @@
|
|||
// RUN: %clang -miamcu -no-canonical-prefixes %s -### -o %t.o 2>&1 | FileCheck %s
|
||||
// RUN: %clang -miamcu -no-canonical-prefixes -m32 %s -### -o %t.o 2>&1 | FileCheck %s
|
||||
// RUN: %clang -miamcu -no-canonical-prefixes -target x86_64-unknown-linux-gnu %s -### -o %t.o 2>&1 | FileCheck %s
|
||||
// RUN: %clang -mno-iamcu -miamcu -no-canonical-prefixes %s -### -o %t.o 2>&1 | FileCheck %s
|
||||
// RUN: %clang -miamcu -no-canonical-prefixes -m64 %s -### -o %t.o 2>&1 | FileCheck %s -check-prefix=M64
|
||||
// RUN: %clang -miamcu -no-canonical-prefixes -dynamic %s -### -o %t.o 2>&1 | FileCheck %s -check-prefix=DYNAMIC
|
||||
// RUN: %clang -miamcu -no-canonical-prefixes -target armv8-eabi %s -### -o %t.o 2>&1 | FileCheck %s -check-prefix=NOT-X86
|
||||
// RUN: %clang -miamcu -mno-iamcu -no-canonical-prefixes -target x86_64-unknown-linux-gnu %s -### -o %t.o 2>&1 | FileCheck %s -check-prefix=MNOIAMCU
|
||||
|
||||
// M64: error: invalid argument '-miamcu' not allowed with '-m64'
|
||||
|
||||
|
@ -14,6 +16,8 @@
|
|||
|
||||
// NOT-X86: error: unsupported option '-miamcu' for target 'armv8---eabi'
|
||||
|
||||
// MNOIAMCU-NOT: "-triple" "i586-intel-elfiamcu"
|
||||
|
||||
// CHECK: "{{.*}}clang{{.*}}" "-cc1"
|
||||
// CHECK: "-triple" "i586-intel-elfiamcu"
|
||||
// CHECK: "-static-define"
|
||||
|
|
Loading…
Reference in New Issue