<p dir="ltr">Hal, </p>
<p dir="ltr">Absolutely, I think the reason why it's there is that we didn't know better. Please, check with Jeroen for a revised patch. </p>
<p dir="ltr">Cheers, <br>
Renato </p>
<div class="gmail_quote">On 29 Aug 2013 04:50, "Hal Finkel" <<a href="mailto:hfinkel@anl.gov">hfinkel@anl.gov</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
----- Original Message -----<br>
> Author: rengolin<br>
> Date: Wed Aug 28 18:56:07 2013<br>
> New Revision: 189542<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=189542&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=189542&view=rev</a><br>
> Log:<br>
> use the last passed -munaligned-access / -mno-unaligned-access<br>
><br>
> Passing inconsistent munaligned-access / mno-unaligned-access<br>
> flags, intentionally resulted in a warning and the flag<br>
> no-unaligned-access being used.<br>
><br>
> Gcc does, at least in practice, use the last flag in such a<br>
> case. This patch updates clang behaviour accordingly; use the<br>
> last flag or base alignment behaviour on the target (which<br>
> llvm will do if no flag is explicitly passed)<br>
><br>
> Patch by Jeroen Hofstee.<br>
><br>
> Modified:<br>
>     cfe/trunk/lib/Driver/Tools.cpp<br>
>     cfe/trunk/test/Driver/arm-alignment.c<br>
><br>
> Modified: cfe/trunk/lib/Driver/Tools.cpp<br>
> URL:<br>
> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=189542&r1=189541&r2=189542&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=189542&r1=189541&r2=189542&view=diff</a><br>

> ==============================================================================<br>
> --- cfe/trunk/lib/Driver/Tools.cpp (original)<br>
> +++ cfe/trunk/lib/Driver/Tools.cpp Wed Aug 28 18:56:07 2013<br>
> @@ -2944,12 +2944,15 @@ void Clang::ConstructJob(Compilation &C,<br>
>    }<br>
>    // -mkernel implies -mstrict-align; don't add the redundant<br>
>    option.<br>
>    if (!KernelOrKext) {<br>
> -    if (Args.hasArg(options::OPT_mno_unaligned_access)) {<br>
> -      CmdArgs.push_back("-backend-option");<br>
> -      CmdArgs.push_back("-arm-strict-align");<br>
> -    } else if (Args.hasArg(options::OPT_munaligned_access)) {<br>
> -      CmdArgs.push_back("-backend-option");<br>
> -      CmdArgs.push_back("-arm-no-strict-align");<br>
> +    if (Arg *A = Args.getLastArg(options::OPT_mno_unaligned_access,<br>
> +                                 options::OPT_munaligned_access)) {<br>
> +      if (A->getOption().matches(options::OPT_mno_unaligned_access))<br>
> {<br>
> +        CmdArgs.push_back("-backend-option");<br>
> +        CmdArgs.push_back("-arm-strict-align");<br>
> +      } else {<br>
> +        CmdArgs.push_back("-backend-option");<br>
> +        CmdArgs.push_back("-arm-no-strict-align");<br>
<br>
>From what Chandler tells me, using -backend-option plays horribly when the compiler is used via the tooling interface, and should really be avoided. This seems like something that belongs in TargetOptions; can we move it there?<br>

<br>
 -Hal<br>
<br>
> +      }<br>
>      }<br>
>    }<br>
><br>
><br>
> Modified: cfe/trunk/test/Driver/arm-alignment.c<br>
> URL:<br>
> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-alignment.c?rev=189542&r1=189541&r2=189542&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-alignment.c?rev=189542&r1=189541&r2=189542&view=diff</a><br>

> ==============================================================================<br>
> --- cfe/trunk/test/Driver/arm-alignment.c (original)<br>
> +++ cfe/trunk/test/Driver/arm-alignment.c Wed Aug 28 18:56:07 2013<br>
> @@ -1,9 +1,25 @@<br>
>  // RUN: %clang -target arm-none-gnueeabi -munaligned-access -### %s<br>
>  2> %t<br>
>  // RUN: FileCheck --check-prefix=CHECK-UNALIGNED < %t %s<br>
><br>
> +// RUN: %clang -target arm-none-gnueeabi -mstrict-align<br>
> -munaligned-access -### %s 2> %t<br>
> +// RUN: FileCheck --check-prefix=CHECK-UNALIGNED < %t %s<br>
> +<br>
> +// RUN: %clang -target arm-none-gnueeabi -mno-unaligned-access<br>
> -munaligned-access -### %s 2> %t<br>
> +// RUN: FileCheck --check-prefix=CHECK-UNALIGNED < %t %s<br>
> +<br>
>  // CHECK-UNALIGNED: "-backend-option" "-arm-no-strict-align"<br>
><br>
> +<br>
>  // RUN: %clang -target arm-none-gnueeabi -mno-unaligned-access -###<br>
>  %s 2> %t<br>
>  // RUN: FileCheck --check-prefix=CHECK-ALIGNED < %t %s<br>
><br>
> +// RUN: %clang -target arm-none-gnueeabi -mstrict-align -### %s 2><br>
> %t<br>
> +// RUN: FileCheck --check-prefix=CHECK-ALIGNED < %t %s<br>
> +<br>
> +// RUN: %clang -target arm-none-gnueabi -munaligned-access<br>
> -mno-unaligned-access -### %s 2> %t<br>
> +// RUN: FileCheck --check-prefix=CHECK-ALIGNED < %t %s<br>
> +<br>
> +// RUN: %clang -target arm-none-gnueabi -munaligned-access<br>
> -mstrict-align -### %s 2> %t<br>
> +// RUN: FileCheck --check-prefix=CHECK-ALIGNED < %t %s<br>
> +<br>
>  // CHECK-ALIGNED: "-backend-option" "-arm-strict-align"<br>
><br>
><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
><br>
<br>
--<br>
Hal Finkel<br>
Assistant Computational Scientist<br>
Leadership Computing Facility<br>
Argonne National Laboratory<br>
</blockquote></div>