From 485577dcac0b0877cfb5395b365490a0189c66f5 Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Fri, 9 Nov 2012 18:27:01 +0000 Subject: [PATCH] Implement -mstrict-align using '-backend-option -arm-strict-align' as this saves us from having to make any backend changes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167623 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Frontend/CodeGenOptions.def | 1 - lib/CodeGen/BackendUtil.cpp | 1 - lib/Driver/Tools.cpp | 3 ++- lib/Frontend/CompilerInvocation.cpp | 1 - test/Driver/strictalign.c | 2 -- 5 files changed, 2 insertions(+), 6 deletions(-) delete mode 100644 test/Driver/strictalign.c diff --git a/include/clang/Frontend/CodeGenOptions.def b/include/clang/Frontend/CodeGenOptions.def index 3df0b2fa7d..558e6f1111 100644 --- a/include/clang/Frontend/CodeGenOptions.def +++ b/include/clang/Frontend/CodeGenOptions.def @@ -100,7 +100,6 @@ CODEGENOPT(VerifyModule , 1, 1) ///< Control whether the module should be r CODEGENOPT(StackRealignment , 1, 0) ///< Control whether to permit stack ///< realignment. -CODEGENOPT(StrictAlign , 1, 0) ///< Force all memory accesses to be aligned. CODEGENOPT(UseInitArray , 1, 0) ///< Control whether to use .init_array or ///< .ctors. VALUE_CODEGENOPT(StackAlignment , 32, 0) ///< Overrides default stack diff --git a/lib/CodeGen/BackendUtil.cpp b/lib/CodeGen/BackendUtil.cpp index 4fe5d81a4d..62f87c983b 100644 --- a/lib/CodeGen/BackendUtil.cpp +++ b/lib/CodeGen/BackendUtil.cpp @@ -401,7 +401,6 @@ TargetMachine *EmitAssemblyHelper::CreateTargetMachine(bool MustCreateTM) { Options.UseSoftFloat = CodeGenOpts.SoftFloat; Options.StackAlignmentOverride = CodeGenOpts.StackAlignment; Options.RealignStack = CodeGenOpts.StackRealignment; - Options.StrictAlign = CodeGenOpts.StrictAlign; Options.DisableTailCalls = CodeGenOpts.DisableTailCalls; Options.TrapFuncName = CodeGenOpts.TrapFuncName; Options.PositionIndependentExecutable = LangOpts.PIELevel != 0; diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 3a6ecd7d3b..00894c4547 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -2534,7 +2534,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back(Args.MakeArgString("-mstack-alignment=" + alignment)); } if (Args.hasArg(options::OPT_mstrict_align)) { - CmdArgs.push_back(Args.MakeArgString("-mstrict-align")); + CmdArgs.push_back("-backend-option"); + CmdArgs.push_back("-arm-strict-align"); } // Forward -f options with positive and negative forms; we translate diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 5663d8b750..d0ff7d2345 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -407,7 +407,6 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, Opts.SSPBufferSize = Args.getLastArgIntValue(OPT_stack_protector_buffer_size, 8, Diags); Opts.StackRealignment = Args.hasArg(OPT_mstackrealign); - Opts.StrictAlign = Args.hasArg(OPT_mstrict_align); if (Arg *A = Args.getLastArg(OPT_mstack_alignment)) { StringRef Val = A->getValue(); unsigned StackAlignment = Opts.StackAlignment; diff --git a/test/Driver/strictalign.c b/test/Driver/strictalign.c deleted file mode 100644 index e48c07c5c5..0000000000 --- a/test/Driver/strictalign.c +++ /dev/null @@ -1,2 +0,0 @@ -// RUN: %clang -### -mstrict-align %s 2>&1 | FileCheck %s -// CHECK: -mstrict-align -- 2.40.0