diff options
| author | Renato Golin <renato.golin@linaro.org> | 2013-08-28 23:56:07 +0000 |
|---|---|---|
| committer | Renato Golin <renato.golin@linaro.org> | 2013-08-28 23:56:07 +0000 |
| commit | 8d5f31432e6e1f542baa917331bb5c271560c601 (patch) | |
| tree | a21895d00ca2da8055e047f059e158a15bd8a4ee /clang/lib/Driver | |
| parent | e9236587b0a77267ed3b0e96050195253b11ca39 (diff) | |
| download | bcm5719-llvm-8d5f31432e6e1f542baa917331bb5c271560c601.tar.gz bcm5719-llvm-8d5f31432e6e1f542baa917331bb5c271560c601.zip | |
use the last passed -munaligned-access / -mno-unaligned-access
Passing inconsistent munaligned-access / mno-unaligned-access
flags, intentionally resulted in a warning and the flag
no-unaligned-access being used.
Gcc does, at least in practice, use the last flag in such a
case. This patch updates clang behaviour accordingly; use the
last flag or base alignment behaviour on the target (which
llvm will do if no flag is explicitly passed)
Patch by Jeroen Hofstee.
llvm-svn: 189542
Diffstat (limited to 'clang/lib/Driver')
| -rw-r--r-- | clang/lib/Driver/Tools.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 6862e76df6e..9633d6b3e25 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -2944,12 +2944,15 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, } // -mkernel implies -mstrict-align; don't add the redundant option. if (!KernelOrKext) { - if (Args.hasArg(options::OPT_mno_unaligned_access)) { - CmdArgs.push_back("-backend-option"); - CmdArgs.push_back("-arm-strict-align"); - } else if (Args.hasArg(options::OPT_munaligned_access)) { - CmdArgs.push_back("-backend-option"); - CmdArgs.push_back("-arm-no-strict-align"); + if (Arg *A = Args.getLastArg(options::OPT_mno_unaligned_access, + options::OPT_munaligned_access)) { + if (A->getOption().matches(options::OPT_mno_unaligned_access)) { + CmdArgs.push_back("-backend-option"); + CmdArgs.push_back("-arm-strict-align"); + } else { + CmdArgs.push_back("-backend-option"); + CmdArgs.push_back("-arm-no-strict-align"); + } } } |

